summarypoints.Rd
Summarizes the meteorology of a single location, a set of spatial points, pixels in a grid, or weather stations of interpolation data.
summarypoint(x, var, fun = mean, freq = NULL, dates = NULL, months = NULL, ...)
summarypoints(points, var, fun = mean, freq = NULL, dates = NULL, months = NULL, ...)
summarygrid(grid, var, fun = mean, freq = NULL, dates = NULL, months = NULL, ...)
summarypixels(pixels, var, fun = mean, freq = NULL, dates = NULL, months = NULL, ...)
summaryinterpolationdata(object, var, fun = mean, freq = NULL, dates = NULL,
months = NULL, ...)
A data frame with dates in rows and meteorological variables in columns.
An object of class SpatialPointsMeteorology-class
with the coordinates and meteorological data of the locations for which summaries are desired. Alternatively, an object of class SpatialPointsDataFrame-class
containing the meta data (columns dir
, filename
and possibly format
) of meteorological files that will be sequentially read from the disk. Finally, points
can also be a string pointing to a netCDF.
The name of the meteorological variable to be summarized.
The function to be calculated on values of each point. If freq
is specified, the function will be calculated by intervals.
A string giving an interval specification (e.g., "week"
, "month"
, "quarter"
or "year"
). If NULL
then no intervals are defined.
An object of class Date
to define the period to be summarized. If dates = NULL
then all dates in points
are processed.
A numeric vector to indicate the subset of months for which summary is desired (e.g. c(7,8)
for July and August). This parameter allows studing particular seasons, when combined with freq
. For example freq = "years"
and months = 6:8
leads to summarizing summer months of each year.
Additional parameters to fun
.
An object of class SpatialGridMeteorology-class
with the meteorological data for a grid, or a string pointing to a NetCDF.
An object of class SpatialPixelsMeteorology-class
with the meteorological data for grid pixels, or a string pointing to a NetCDF.
An object of class MeteorologyInterpolationData-class
.
If var="ALL"
then function summarypoints
produces a summary of all variables with default statistics and returns an object of class SpatialPointsMeteorology
.
Function summarypoint
returns a named vector of values with dates as names.
Functions summarypoints
and summaryinterpolationdata
return an object of class SpatialPointsDataFrame
containing summaries (either one variable or several if freq
is specified).
Functions summarygrid
and summarypixels
return an object of class SpatialGridDataFrame
and SpatialPixelsDataFrame
, respectively, containing the summaries analogously to summarypoints
.
data(examplegridtopography)
data(exampleinterpolationdata)
#Creates spatial topography points from the grid
p = 1:2
spt = as(examplegridtopography, "SpatialPointsTopography")[p]
#Interpolation of two points for the whole time period (2000-2003)
mp = interpolationpoints(exampleinterpolationdata, spt)
#> Processing point '1' (1/2) - done.
#> Processing point '2' (2/2) - done.
#PET sums by months
mp.sum = summarypoints(mp, var="PET", freq="months", fun=sum)
#> Summarizing PET in 2 points...
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
#> Arranging output...
#>
|
| | 0%
|
|=================================== | 50%
|
|======================================================================| 100%
mp.sum
#> coordinates X2000.01.01 X2000.02.01 X2000.03.01 X2000.04.01 X2000.05.01
#> 1 (360000, 4640900) NA NA 78.63101 100.6697 146.5905
#> 2 (360100, 4640900) NA NA 81.17084 101.9224 147.0282
#> X2000.06.01 X2000.07.01 X2000.08.01 X2000.09.01 X2000.10.01 X2000.11.01
#> 1 NA NA NA NA NA 27.35733
#> 2 NA NA NA NA NA 29.67909
#> X2000.12.01 X2001.01.01 X2001.02.01 X2001.03.01 X2001.04.01 X2001.05.01
#> 1 18.35007 NA 37.37345 79.82006 NA NA
#> 2 20.57298 NA 39.83201 82.17796 NA NA
#> X2001.06.01 X2001.07.01 X2001.08.01 X2001.09.01 X2001.10.01 X2001.11.01
#> 1 184.6301 NA NA NA 70.14623 27.90239
#> 2 184.4692 NA NA NA 73.26370 30.06372
#> X2001.12.01 X2002.01.01 X2002.02.01 X2002.03.01 X2002.04.01 X2002.05.01
#> 1 12.16754 NA NA NA NA NA
#> 2 14.35313 NA NA NA NA NA
#> X2002.06.01 X2002.07.01 X2002.08.01 X2002.09.01 X2002.10.01 X2002.11.01
#> 1 NA NA NA NA NA NA
#> 2 NA NA NA NA NA NA
#> X2002.12.01 X2003.01.01 X2003.02.01 X2003.03.01 X2003.04.01 X2003.05.01
#> 1 NA NA NA NA NA NA
#> 2 NA NA NA NA NA NA
#> X2003.06.01 X2003.07.01 X2003.08.01 X2003.09.01 X2003.10.01 X2003.11.01
#> 1 NA NA NA NA NA NA
#> 2 NA NA NA NA NA NA
#> X2003.12.01
#> 1 NA
#> 2 NA