Description Usage Arguments Details Value CfData Subclasses See Also Examples
Query the National Climate Database via CliFlo based on the clifro user and selected datatypes, stations and dates.
1 2 3 4 5 6 7 8 9 10 11 |
user |
a |
datatype |
a |
station |
a |
start_date |
a character, Date or POSIXt object indicating the start
date. If a character string is supplied the date format
should be in the form |
end_date |
same as |
date_format |
a character string matching one of |
tz |
the timezone for which the start and end dates refer to. Conversion
to Pacific/Auckland time is done automatically through the
|
output_tz |
the timezone of the output. This can be one of either "local", "UTC", or "NZST". |
quiet |
logical. When |
The cf_query
function is used to combine the clifro user
(cfUser
), along with the desired datatypes
(cfDatatype
) and stations (cfStation
). The query
is 'built up' using these objects, along with the necessary dates. The
function then uses all these data to query the National Climate Database via
the CliFlo web portal and returns one of the many cfData
objects if one dataframe is returned, or a cfDataList
object if
there is more than one dataframe returned from CliFlo. If a cfDataList
is returned, each element in the list is a subclass of the cfData
class, see the 'cfData Subclasses' section.
a cfData
or cfDataList
object.
There are 8 cfData
subclasses that are returned from cf_query
depending on the datatype requested. Each of these subclasses have default
plot
methods for usability and efficiency in exploring and plotting
clifro data.
The following table summarises these subclasses and how they are created, see also the examples on how to automatically create some of these subclasses.
Subclass | CliFlo Datatype |
cfWind | Any 'Wind' data |
cfRain | Any 'Precipitation' data |
cfScreen Obs | 'Temperature and Humidity' data measured in a standard screen |
cfTemp | Maximum and minimum 'Temperature and Humidity' data |
cfEarthTemp | 'Temperature and Humidity' data at a given depth |
cfSunshine | Any 'Sunshine & Radiation' data |
cfPressure | Any 'Pressure' data |
cfOther | Any other CliFlo 'Daily and Hourly Observations' |
cf_user
, cf_datatype
and
cf_station
for creating the objects needed for a query. See
plot,cfDataList,missing-method
for general information on
default plotting of cfData
and cfDataList
objects, and the
links within.
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 | ## Not run:
# Retrieve daily rain data from Reefton Ews
daily.rain = cf_query(cf_user("public"), cf_datatype(3, 1, 1),
cf_station(), "2012-01-01 00")
daily.rain
# returns a cfData object as there is only one datatype
class(daily.rain) # 'cfRain' object - inherits 'cfData'
# Look up the help page for cfRain plot methods
?plot.cfRain
# Retrieve daily rain and wind data from Reefton Ews
daily.dts = cf_query(cf_user("public"),
cf_datatype(c(2, 3), c(1, 1), list(4, 1), c(1, NA)),
cf_station(), "2012-01-01 00", "2013-01-01 00")
daily.dts
# returns a cfDataList object as there is more than one datatype. Each
# element of the cfDataList is an object inheriting from the cfData class.
class(daily.dts) # cfDataList
class(daily.dts[1]) # cfRain
class(daily.dts[2]) # cfWind
# Create a cfSunshine object (inherits cfData)
# Retrieve daily global radiation data at Reefton Ews
rad.data = cf_query(cf_user(), cf_datatype(5,2,1), cf_station(),
"2012-01-01 00")
rad.data
# The cf_query function automatically creates the appropriate cfData subclass
class(rad.data)
# The advantage of having these subclasses is that it makes plotting very easy
plot(rad.data)
plot(daily.rain)
plot(daily.rain, include_runoff = FALSE)
plot(daily.dts)
plot(daily.dts, 2)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.