hdf2R: Function to convert GPM-IMERG files from .HDF5 to .RData

Description Usage Arguments Details Value Examples

Description

This function reads GPM IMERG .HDF5 files and extracts the variables "precipitationCal", "lat" and "lon" from all the specified HDF5 files and converts these into a STFDF (spacetime) object in R, which is written to the local directory as an .RData file and also returned. See NASA GPM Technical Documentation for format and structure of HDF5 files and meaning of variables. Also, see lines 59-75 below on current structure (GPM-IMERG v3, Feb. 2016). Be aware of the size of HDF5 when specifying the spatial bbox: as GPM IMERG is half-hourly, 48 values are stored for every grid node for every day. This can results in large amounts of data being stored in memory when working at national scales.

Usage

1
hdf2R(product, nrt_type, bbox, download_type)

Arguments

product

A character string defining the GPM-IMERG product to be downloaded. This can be either "production" (gauged-corrected, 4-month latency) or "nrt" (Near-real time, without gauge correction, latency < 1 day).

nrt_type

A character string defining the NRT product type to be downloaded. This can be either "early" (4-hr latency, raw satellite - no correction) or "late" (18-hr latency, satellite with climatological correction). The nrt_type is only relevant if product is set to "nrt" and is ignored otherwise.

bbox

A numeric vector containing four values that define the limits of the spatial bounding box in degrees latitude/longitude. The values are to be netered in this order: minLat, maxLat, minLon, maxLon.

download_type

A character string that defines which method was used to download the HDF5 files (i.e. system_download or rcurl_download). This affects the character strings in the download_list.txt file.

Details

This function reads GPM IMERG .HDF5 files and extracts the variables "precipitationCal", "lat" and "lon" from all the specified HDF5 files and converts these into a STFDF (spacetime) object in R, which is written to the local directory as an .RData file and also returned. Be aware of the size of HDF5 when specifying the spatial bbox: as GPM IMERG is half-hourly, 48 values are stored for every grid node for every day. This can results in large amounts of data being stored in memory when working at national scales.

Value

gpm A STFDF (spacetime) object containing the spatial information (grid node locations) and temporal information (observational time-series) of the extracted GPM-IMERG product. The object is also written to the local directory in an .RData file.

Examples

1
2
3
4
5
6
data(production_url_list) # list of GPM IMERG HDF5 files including NASA http URL
product <- "production"
nrt_type <- "late"
bbox <- c(-6,-4,-80,-78)
download_type <-"system"
# Not Run gpm <- hdf2R(product, nrt_product, bbox,download_type)

bastianmanz/GPM_rain documentation built on May 11, 2019, 9:20 p.m.