Gridding daily precipitation.

Share:

Description

This function uses serially-completed data to estimate new predicted values in each point and day of a given point dataset.

Usage

1
gridPcp(filled, points, sts, inidate, enddate, parallel = TRUE, ncpu = 2)

Arguments

filled

Object of class matrix containing the daily precipitation data. This dataset can be the Filled.RData resulting from gapFilling function. Each column represents one station. The names of columns have to be names of the stations.

points

Object of class matrix containing the points of the new grid info. Must have at least four fields: ID: station identifier; ALT: altitude; X: Longitude in UTM projection (meters); and Y: Latitude in UTM projection (meters). Tabulation separated.

sts

Object of class matrix containing the stations info. Must have at least four fields: ID: station identifier; ALT: altitude; X: Longitude in UTM projection (meters); and Y: Latitude in UTM projection (meters). Tabulation separated.

inidate

Object of class Date in format 'YYYY-mm-dd' defining the first day of quality control process

enddate

Object of class Date in format 'YYYY-mm-dd' defining the last day of quality control process

parallel

Logical. If TRUE, parallel computing is activated and the processes will be distributed among the ncpu number of processor cores.

ncpu

Only if parallel = TRUE. Sets the number of processor cores used to parallel computing.

Details

The precipitation data used to make the grid should be a serially-completed dataset without any missing value. If we use a dataset with gaps, the number of near stations to each point will change along the period and we will introduce inhomogeneities to the final series. We recommend to use the output of gapFilling function.

Value

A new gridded directory will be created in working path with one file per day. Each file contains a data.frame with many rows as points. The columns show the identifier (ID)of each station, the magnitude prediction pred and the standard error err of the model. All of these values are expresed in the same units as original values (mm*10).

Note

The time computing depends directly on the number of points of the points dataset. If you need to fill a large grid we recommend to use a powerful computer with many number of proccesor cores (to distribute properly the work) and RAM (to process the whole amount of data).

Author(s)

Roberto Serrano-Notivoli

Examples

1
2
3
4
5
6
  #loads example data
  data(precipDataset)

  #runs function (only for two days)
  gridPcp(filled=filled,points=points,sts=sts,inidate=as.Date('2001-01-01'),
    enddate=as.Date('2001-01-01'),parallel=TRUE,ncpu=2)