# 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)
# }
Run the code above in your browser using DataLab