DrylandEcology / rSFSW2

rSFSW2: A R package to create soil water balance simulation experiment
GNU General Public License v3.0
8 stars 7 forks source link

Update extract_daily_weather_from_livneh to reflect latest release of daily dataset #325

Open CaitlinA opened 6 years ago

CaitlinA commented 6 years ago

The Livneh data was updated recently and now includes daily data from 1915 - 2015: ftp://livnehpublicstorage.colorado.edu/public/Livneh.2016.Dataset/.

Citation: https://www.nature.com/articles/sdata201542

The data is structured very similarly to the old dataset. Only a few lines of code would need to be change to incorporate the new dataset into rSFSW2.

I suggest we eliminate the functionality from rSFSW2 from extracting from Livneh 2013 and replace it with updated functionality for Livneh 2016.

@dschlaep What do you think?

dschlaep commented 6 years ago

Sounds great to update to have coverage of recent years.

Are the values of the years covered by both versions identical?

CaitlinA commented 6 years ago

I've had a chance to compare the two datasets, and they are quite different, particularly regarding daily precipitation estimates. I will proceed with a version flag.

Do you think that their should be option in the descriptions.R file to set the version, or should it be behind the scenes within the functionality.

dschlaep commented 6 years ago

I personally would add it to SFSW2_project_descriptions.R for transparency and explicitness of simulation project documentation by the meta.rds object

CaitlinA commented 6 years ago

I put my initial code up on GitHub, opened a PR, and put you as a reviewer. My code is not complete, nor has it been tested, but I would like to get your comments on approach.

I added a version argument and subsequent if().... statements to the extract_daily_weather_from_livneh function.

From a user's point of view they either pick from "GriddedDailyWeatherFromLivneh2013_NorthAmerica" or "GriddedDailyWeatherFromLivneh2016_NorthAmerica" in the descriptions.R file.

Also, could your provide some context on the dw_Livneh2013_NorthAmerica function. It is never called in rSFSW2 code. Should I replicate this functionality for Livneh2016?

dschlaep commented 6 years ago

A new function dw_Livneh2016_NorthAmerica is necessary; all the functions dw_* are called by the function dw_determine_sources:

temp <- try(ftemp(dw_source, dw_names, exinfo, site_dat, sim_time,
      path = path_dw_source[[dw_avail_sources2[k]]],
      MoreArgs = MoreArgs[[dw_avail_sources2[k]]]), silent = TRUE)