daily_fips
to a separate folder
within a given directory. The dataframe daily_data
is saved to a
subdirectory of the given directory called "data." This time series dataframe
gives the values for specified weather variables and the number of
weather stations contributing to the average for each day within the
specified year(s). Metadata about the weather stations and
county are saved in a list with four elements in a subdirectory called
"metadata." These elements include station_metadata
(station metadata
for stations contributing to the time series dataframe), radius
(the radius, in km, within which weather stations were pulled from each
county's center), lat_center
, and lon_center
(the latitude
and longitude of the county's geographic center). If the user specifies "csv"
output for the metadata_type
argument, radius
, lat_center
,
and lon_center
are added to the station_metadata
dataframe as
three additional columns.
write_hourly_timeseries(fips, year, coverage = NULL, var = "all", out_directory, data_type = "rds", metadata_type = "rds", average_data = TRUE, station_label = FALSE, keep_map = TRUE, verbose = TRUE)
year
can
be in the range from 1901 to the current year.var = c("wind_speed", "temperature")
pulls data on hourly
wind speed and temperature. The core weather variables
available include "wind_direction"
, "wind_speed"
,
"ceiling_height"
, "visibility_distance"
, "temperature"
,
"temperature_dewpoint"
, "air_pressure"
. Alternatively, you
can specify var = "all" to include additional flag and quality codes.data_type = "rds"
) or .csv files
(data_type = "csv"
) for the time series output. This option
defaults to .rds files.metadata_type = "rds"
) or .csv files
(metadata_type = "csv"
)
for the station and county metadata output. This option defaults to .rds
files, in which case a list of four elements is saved
(station_metadata
, radius
, lat_center
, and
lon_center
). If the user specifies "csv" output, radius
,
lat_center
, and lon_center
are added to the
station_metadata
dataframe as additional columns.data_type
and
metadata_type
, respectively. Maps are saved as .png files.
## Not run:
# write_hourly_timeseries(fips = c("08031", "12086"), year = c(1994, 1995),
# coverage = 0.90, var = c("wind_speed", "temperature"),
# out_directory = "~/timeseries_hourly")
# ## End(Not run)
Run the code above in your browser using DataLab