Open dylanbeaudette opened 2 years ago
I think this would be useful, though for jNSMR we would need to have SCAN/SNOTEL/CDEC data aggregated to a monthly timestep. I think we probably could customize a single function so generic ~daily data in long format can be put into the jNSM "batch CSV" format.
Sketching out one of these convenience functions:
Arguments to this function might include:
x
(a data.frame in "long" format, containing observations of precipitation and/or temperature that need to have at least information on month+year for independent records)site.id
(site identifier column name)date
(date column name; column containing character or POSIX time used to extract year and month)data_type
(data type column name; character column containing "temperature" or "precipitation"), FUN
(optional custom function, defaults to mean()
for data_type="temperature"
and sum()
for data_type="precipitation"
)...
passed to FUN)I think this function could be written such that it could deal with a wide range of time intervals converted to monthly. Range from very fine scale measurements on e.g. 10 minute intervals, to daily, to weekly, to one per month for one or more years should be possible.
Would be nice to have some convivence functions for converting the output from e.g.
fetchSCAN()
into the format used in batch mode. Mostly preservation of IDs, long → wide format, etc..