# NOT RUN {
# Station Name Search ------------------------------------------------------
# Return all open stations with 'island' in the name (pattern match search)
# Note this example uses all the defaults
island_st = cf_find_station("island")
island_st
# Region Search ------------------------------------------------------------
# Return all the closed stations from Queenstown (using partial matching)
queenstown.st = cf_find_station("queen", search = "region", status = "closed")
queenstown.st
# Long/Lat Search ----------------------------------------------------------
# Return all open stations within a 10km radius of the Beehive in Wellington
# From Wikipedia: latitude 41.2784 S, longitude 174.7767 E
beehive.st = cf_find_station(lat = -41.2784, long = 174.7767, rad = 10,
search = "latlong")
beehive.st
# Network ID Search --------------------------------------------------------
# Return all stations that share A42 in their network ID
A42.st = cf_find_station("A42", search = "network", status = "all")
A42.st
# Using Datatypes in the Search --------------------------------------------
# Is the Reefton EWS station open and does it collect daily rain and/or wind
# data?
# First, create the daily rain and wind datatypes
daily.dt = cf_datatype(c(2, 3), c(1, 1), list(4, 1), c(1, NA))
daily.dt
# Then combine into the search. This will only return stations where at least
# one datatype is available.
cf_find_station("reefton EWS", datatype = daily.dt) # Yes
# OR Query Search ----------------------------------------------------------
# Return all stations sharing A42 in their network ID *or* all the open
# stations within 10km of the Beehive in Wellington (note this is not
# currently available as a single query in CliFlo).
cf_find_station("A42", search = "network", status = "all") +
cf_find_station(lat = -41.2784, long = 174.7767, rad = 10,
search = "latlong")
# Note these are all ordered by open stations, then again by their end dates
# }
Run the code above in your browser using DataLab