Averages the weather data series of points or grid pixels.

averagearea(object, na.rm = TRUE)

Arguments

object

An object of class SpatialPointsMeteorology-class, SpatialGridMeteorology-class or SpatialPixelsMeteorology-class.

na.rm

Boolean flag to indicate that missing values should be excluded from averages.

Value

An object of class as the input SpatialPointsMeteorology-class with weather series corresponding to the spatial average of the input.

Details

Assumes that all points/pixels represent the same area.

Author

Miquel De Cáceres Ainsa, CREAF

Examples

data(examplegridtopography)
data(exampleinterpolationdata)

#Interpolation of meteorology over a grid for two days
ml = interpolationgrid(exampleinterpolationdata, examplegridtopography,
                       as.Date(c("2001-02-03", "2001-06-03")))
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Interpolating day '2001-02-03' (1/2) - done.
#> Interpolating day '2001-06-03' (2/2) - done.

#Call averaging function
pa = averagearea(ml)

#Spatial information
pa
#> Object of class SpatialPointsMeteorology
#> Dates:  2  (initial: 2001-02-03 final: 2001-06-03)
#> SpatialPoints:
#>   coords.x1 coords.x2
#> 1    364950   4635950
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
#> Coordinate Reference System (CRS) arguments: +proj=utm +zone=31
#> +datum=WGS84 +units=m +no_defs 

#Weather data
pa@data[[1]]
#>            DOY MeanTemperature MinTemperature MaxTemperature Precipitation
#> 2001-02-03  34        7.036145     -0.6158631       12.01121             0
#> 2001-06-03 154       21.862234     12.2691998       28.09929             0
#>            MeanRelativeHumidity MinRelativeHumidity MaxRelativeHumidity
#> 2001-02-03             88.09210            63.02370                 100
#> 2001-06-03             93.71048            64.65177                 100
#>            Radiation WindSpeed WindDirection      PET
#> 2001-02-03  10.63484  1.388889           220 1.000833
#> 2001-06-03  26.18885  3.611111           240 5.543027