Interpolation of normalized homogeneous data on a predefined grid

Description

Homogenized data generated by homogen are normalized and interpolated on a grid provided by the user at every time step, and saved in a NetCDF file.

Usage

1
2
dahgrid(varcli, anyi, anyf, anyip=anyi, anyfp=anyf, grid, mh=FALSE, std=NA,
ini=NA, obsonly=TRUE)

Arguments

varcli

Acronym of the name of the studied climatic variable, as in the data file name.

anyi

Initial year of the homogenized data.

anyf

Final year of the homogenized data.

anyip

First year of the desired reference period. (The reference period defaults to the whole period of the data).

anyfp

Last year of the desired reference period.

grid

Grid on which interpolations must be performed.

mh

If TRUE, read monthly data from file ‘*-mh_*.dat’ (generated after a daily homogenization).

std

Type of normalization:

1:

deviations from the mean,

2:

rates to the mean (only for means greater than 1),

3:

standardization (subtract the mean and divide by the standard deviation of the sample).

ini

Initial date (first of January of anyi by default. This parameter is included in the ‘*.rda’ file, but this file is not read when mh=TRUE.

obsonly

Do not interpolate estimated missing data. (TRUE by default).

Details

Homogenized data are read from the binary file ‘VAR_ANYI-ANYF.rda’ generated by homogen. Only series reconstructed from their longest homogeneous sub-period are retained, and they are normalized by their means (and standard deviations, if std=3), computed for the selected reference period (or for the whole period of the data, by default).

Unless obsonly is set to FALSE, data that were missing in the observed series are deleted to avoid interpolation of already interpolated data.

Finally, the normalized homogeneous data are interpolated on the predefined grid for every time step using an inverse distance weight method, and the resulting grids are stored in a NetCDF file named ‘VAR_ANYIP-ANYFP.nc’, including grids of the reference means (and standard deviations, if applied).

The user must provide the grid as an object of class SpatialPixel, as in this example defining a grid from 40N,3E to 43N,7E with a resolution of 0.1 degrees:

grid <- expand.grid(x=seq(3,7,.1),y=seq(40,43,.1))
library(sp)
coordinates(grid) <- ~ x+y

The resolution of this grid need not be too high, but adjusted to the spatial density of the available series.

The user may be more interested in obtaining grids of absolute values, rather than normalized. This can be achieved simply by undoing the normalization on the grids with the help of the provided grids of reference means and standard deviations. However, the resulting grids will only be the product of a geometrical interpolation, and will not reflect the influence of orography and other physiographic effects on the studied climatic variable. Therefore, it is more advisable to derive better reference grids of means (and standard deviations, if needed) by applying a geostatistical model to the reference means (provided in the file ‘VAR_ANYIP-ANYFP_means.csv’ with their corresponding coordinates).

This better quality climatic maps will probably have a higher resolution than that of the grids of the NetCDF file provided by this function. In that case, these normalized grids must be interpolated to the grid of the geostatistically derived climatic maps before undoing the normalization to obtain the final maps of absolute values at all or selected time-steps of the studied period.

Value

This function does not return any value, since the results are stored in files.

See Also

homogen

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
## Not run: 
# This function reads data from files. In order to run the example, you should
# run the examples of the homogen function first.  Once the results from
# homogen have been generated, you need to define the grid to use. E.g., for
# the monthly means of the homogenized Ttest series:
#
grd=expand.grid(x=seq(-109,-107.7,.02),y=seq(44,45,.02))
library(sp)
coordinates(grd) <- ~ x+y
#
# Now we are ready to compute the grided homogenized monthly series:
#
dahgrid('Ttest', 1981, 2000, grid=grd, mh=TRUE)
#
# The resulting NetCDF file contains normalized values. You can obtain a new
# file with temperatures in degrees Celsius with externals tools, such as CDO:
#
cdo add -mul Ttest-mh_1981-2000.nc Ttest-mh_1981-2000_s.nc \
  Ttest-mh_1981-2000_m.nc Ttest-mu_1981-2000.nc
#
# But the new grids in Ttest-mu_1981-2000.nc are based on geometric
# interpolations only, and therefore it is better to build new files
# Ttest-mh_1981-2000_m.nc and Ttest-mh_1981-2000_s.nc through geostatistical
# methods.

## End(Not run)