Learn R Programming

hddtools (version 0.3.0)

TRMM: Download and convert TRMM data

Description

The TRMM dataset provide global historical rainfall estimation in a gridded format.

Usage

TRMM(inputLocation = "ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/", product = "3B43", version = 7, type = "precipitation.accum", timeExtent = NULL, bbox = NULL, outputfileLocation = NULL)

Arguments

inputLocation
location where data is stored. By default it points to the TRMM ftp server ("ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/") but it can also be a local directory. If you are using a local directory, this function expects to find inside 'inputLocation' a folder with the name of product and version (e.g. "i3B43_V7") and inside this a folder for each year( e.g. "2012").
product
this is the code that identifies a product, default is "3B43"
version
this is the version number, default is 7
type
this is the type of information needed, default is "precipitation.accum". Other types could be "gaugeRelativeWeighting.bin" and "relativeError.bin"
timeExtent
is a vector of dates and times for which the data should be retrieve
bbox
OPTIONAL bounding box, a list made of 4 elements: minimum longitude (lonMin), minimum latitude (latMin), maximum longitude (lonMax), maximum latitude (latMax)
outputfileLocation
file path where to save the GeoTiff

Value

Data is loaded as rasterbrick, then converted to a multilayer Geotiff that can

Details

This code is based upon Martin Brandt's blog post: http://matinbrandt.wordpress.com/2013/09/04/automatically-downloading-and-processing-trmm-rainfall-data/ and on the TRMM FAQ: http://disc.sci.gsfc.nasa.gov/additional/faq/precipitation_faq.shtml

Examples

Run this code
## Not run: 
#   # Define a bounding box
#   bbox <- list(lonMin=-3.82, latMin=48,lonMax=-3.63, latMax=50)
#   twindow <- seq(as.Date("2012-01-01"), as.Date("2012-01-31"), by="months")
# 
#   TRMM(inputLocation="ftp://disc2.nascom.nasa.gov/data/TRMM/Gridded/",
#        product = "3B43",
#        version = 7,
#        type = "precipitation.accum",
#        timeExtent = twindow,
#        bbox = bbox,
#        outputfileLocation = "~/")
# 
#   # or simply
#   TRMM(timeExtent = twindow, bbox = bbox)#'
#   plot(brick("~/trmm_acc.tif"))
# ## End(Not run)

Run the code above in your browser using DataLab