gpm2ts: Function to extract xts from STFDF for GPM-IMERG data

Description Usage Arguments Details Value Examples

Description

This function is a computationally efficient way to convert a large-scale GPM-IMERG STFDF (spacetime) object into an xts object, while also truncating the temporal extent to that of the supplied gauge time-series (xts object).

Usage

1
gpm2ts(gpm, gauge.ts)

Arguments

gpm

A STFDF (spacetime) object containing the GPM-IMERG spatial information (i.e. grid nodes with attributes) and temporal information (i.e. precipitation time-series for each grid node location).

gauge.ts

A zoo object containing the gauge observations.

Details

This function is a computationally efficient way to convert a large-scale GPM-IMERG STFDF (spacetime) object into an xts object, while also truncating the temporal extent to that of the supplied gauge time-series (xts object).

Value

Object gpm.ts A zoo, xts object with temporal extent from the start date to the end date of the corresponding gauge zoo object and GPM-IMERG estimates in columns for the GPM grid nodes. To ensure that the temporal extent of gpm.ts equals that of gauge.ts, ensure that gauge.ts has the same time-step length as GPM-IMERG (30-min) and time-stamps coincide.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(gpm.hh.piura) # STFDF object with gpm imerg observations for the Piura region in Peru
gpm <- gpm.hh.piura
data(gauges.hh.piura) # STFDF object with gauge observations for the Piura region in Peru
gauges <- gauges.hh.piura
gauges <- spacetime_gauge(gauges,projection="+proj=longlat +ellps=WGS84 +datum=WGS84", timezone=-5)
gauges <- colocate(gauges,gpm,resolution=0.1,longlat=TRUE)
gauge.sp <- gauges@sp
gpm.sp <- gpm@sp
gauge.ts <- as(gauges[,,1],"xts")
colnames(gauge.ts) <- gauge.sp$estacion
gpm.ts <- gpm2ts(gpm,gauge.ts)

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