getPoint: NWP forecasts for a location

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/getPoint.R

Description

The getPoint* functions get outputs of the NWP models run by MeteoGalicia and NCEP (GFS, RAP, NAM) for a single location.

Usage

1
2
3
4
5
6
7
8
9
getPoint(point, vars = "swflx", day = Sys.Date(), run = "00",
         resolution = NULL, vertical = NA, service = mfService())

getPointDays(point, vars = "swflx", start = Sys.Date(), end,
             service = mfService(), ...)

getPointRuns(point, var = "swflx",
             start = Sys.Date() - 1, end = Sys.Date(),
             service = mfService(), ...) 

Arguments

point

Coordinates of the location. It can be a SpatialPoints or a numeric of length 2.

var, vars

Character. The name of the variables to retrieve. Use grepVar to know what variables are available in each service. getPointRuns only works with one variable.

day

Date or character

run

Character. The meteogalicia service executes the model at OOUTC and 12UTC. Therefore run can be '00' or '12'. With GFS and NAM run can be '00', '06', '12', and '18'. The RAP service is run every hour.

start

Date or character. First day of the time period to retrieve.

end

Date or character. Last day of the time period to retrieve.

resolution

Numeric. Resolution in kilometers of the raster. Valid choices are 4, 12, and 36. It is only used with service = 'meteogalicia'.

vertical

Numeric. Vertical coordinate for variables with several levels. Its default value is NA, meaning that only the first level will be retained.

service

Character, which service to use, 'meteogalicia', 'gfs', 'nam', or 'rap'.

...

Additional arguments for getPoint

Details

These functions download data from the MeteoGalicia and NCEP (GFS, RAP, NAM) servers using the NetCDF Subset Service. The result is returned as a zoo time series object, with one or more csv files stored in the temporary folder (as defined by tempdir()).

Value

getPoint and getPointDays produce a zoo time series with a column for each variable included in vars.

The time series returned by getPoint starts at 01UTC of day if run = '00' or 13UTC if run = '12'. It spans over 4 days (96 hours) if run = '00' or 84 hours if run = '12'.

The time series returned by getPointDays starts at 01UTC of start and finishes at 00UTC of end + 1. Each day comprised in the time period is constructed with the forecast outputs corresponding to the 00UTC run of that day. Therefore, only the first 24 values obtained with getPoint are used for each day.

The time series returned by getPointRuns starts at 01UTC of start and finishes at 00UTC of end + 1. It has 4 columns, named "D3_00", "D2_00", "D1_00" and "D0_00". The column "D3_00" corresponds to the forecast results produced 3 days before the time stamp of each row, and so on.

Author(s)

Oscar Perpiñán Lamigueiro with contributions from Marcelo Almeida

See Also

getRaster

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
## Not run: 
  today <- Sys.Date()
  testDay <- today - 7

  ## temperature (Kelvin) forecast from meteogalicia
  tempK <- getPoint(c(0, 40), vars = 'temp', day = testDay)
  ## Cell does not coincide exactly with request
  attr(tempK, 'lat')
  attr(tempK, 'lon')
  ## Units conversion
  tempC <- tempK - 273

  library(lattice)
  ## Beware: the x-axis labels display time using your local timezone.
  Sys.timezone()

  ## Use Sys.setenv(TZ = 'UTC') to produce graphics with the timezone
  ## of the objects provided by meteoForecast.
  xyplot(tempC)

  ## Multiple variables
  vars <- getPoint(c(0, 40), vars = c('swflx', 'temp'), day = testDay)
  xyplot(vars)

  ## Vertical coordinates
  tempK1000 <- getPoint(c(101,6),
                        vars = "Temperature_surface",
                        day = testDay,
                        service ="gfs", vertical = 1000)

  ## Time sequence
  radDays <- getPointDays(c(0, 40),
                          start = testDay - 3,
                          end = testDay + 2)
  
  xyplot(radDays)

  ## Variability between runs
  radRuns <- getPointRuns(c(0, 40),
                          start = testDay - 3,
                          end = testDay + 2)
  xyplot(radRuns, superpose = TRUE)
  
  ## variability around the average
  radAv <- rowMeans(radRuns)
  radVar <- sweep(radRuns, 1, radAv)
  xyplot(radVar, superpose = TRUE)

## End(Not run)

oscarperpinan/meteoForecast documentation built on Nov. 23, 2018, 6:50 a.m.