Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature climate predictors #211

Closed
wants to merge 73 commits into from

Conversation

dschlaep
Copy link
Member

Nicholas Persley and others added 30 commits June 30, 2022 10:58
- Created mentioned function to mirror allocation actions on SOILWAT side
- Renamed old `onSet_SW_WTH_read()` to `onSet_SW_WTH_setup()`
- `SOILWAT2` no longer deals with weather data one year at time, instead it gained `allHist` that contains weather data from all years
-> there is no longer a need to copy weather data for one year at a time from `rSOILWAT2` to `SOILWAT2` data structures
- clarify that this function deals with the weather "setup" (and not weather data)
- `has_weather` is no longer used
- add debug statements for `onSet_SW_WTH_read()` equivalent to the other calls
- `onGet_WTH_DATA_YEAR()` is called by `onGet_WTH_DATA()`
- clarify that function is the mirror of `onGet_WTH_DATA()` and copies (not reads) weather data to `SOILWAT2`
- new functions including `allocateAllWeather()`, `imputeMissingWeather()`, and `scaleAllWeather()`
- updated functionality of `readAllWeather()`
…WAT2

- previously, the code called `readAllWeather()` which reads weather values from disk; however, this was incorrect behavior
- `onSet_WTH_DATA()` (previously, `onSet_SW_WTH_read()`) has now equivalent functionality to `SW_WTH_read()`with the difference that SOILWAT2 `allHist` is filled with values that are copied from `rSOILWAT2` list of `swWeatherData` instead of being read from files on disk.
- previous ones contained missing values for weather variables (because `onSet_WTH_DATA()` wasn't working correctly - now fixed)
- Expectation that input weather is identical to output weather was previously checked only if weather generator is turned off
-> now, this expectation is checked even if the weather generator is turned on (but restricted to days that were not generated)
- check expectation that example data are indeed behaving as they were defined to do (see script data-raw/prepare_testInput_objects.R)

-> checks for example2 are currently failing because no weather is missing
--> this is because recent commit 2c64be5 applies the weather generator during obtaining weather data

- see issue #203 "Reconsider test examples 1-5" (example3 and example4 are identical to example1)
- SW_Weather.generateWeatherMethod replaces SW_Weather.use_weathergenerator
- `generateMissingWeather()` previously named `imputeMissingWeather()`

- rename rSOILWAT2 C function from `rSW2_passAllWeather()` to `rSW2_setAllWeather()` to clarify that it sets SOILWAT2 content
- previous commits caused that example2 weather data contained incorrectly no missing values (see failing new tests in commit db1578f)
- now rSOILWAT2 can fix its example data sets since SOILWAT2 handles missing weather data more carefully (see commit 238811c)

-> script "data-raw/prepare_testInput_objects.R" is much improved
* it defines test cases (example data) explicitly up-front
* it creates a complete and more user-friendly backup of all data that may be changed (backup folder is excluded from git and Rbuild)
* binary files are only updated if they differ from previous version (based on `waldo::compare()`)
* it correctly creates weather example data with missing values - despite weather generator

-> updated script
* "Ex2_weather.rds" is fixed (it contains again missing values -- and passes all tests)
* update default input files from SOILWAT2 -> "weathsetup" gains one line of explanation for LOCF+0
* "sw_exampleData" is fixed (i.e., it (again) does not contain Markov weather generator paramaters)
- `dbW_generateWeather()` previously was running a SOILWAT2 simulation run to generate weather data
- this is no longer required because weather data are completely prepared prior to a simulation run

- updated code accesses new rSOILWAT2 C function `rSW2_processAllWeather()` to provides an interface to process all weather data

- `dbW_generateWeather()` gains argument "digits" (with new default 4) to properly specify rounding (previously it was implicit with 2 as default value from `dbW_dataframe_to_weatherData()`

- new helper functions
* `dbW_weatherData_round()` round weather data
* `rSW2_processAllWeather()` C level interface to process all weather data
- only code style changes
dschlaep and others added 25 commits September 19, 2022 18:30
- if downloading weather data from DayMet failed, then the available years covered 1980 to 2010 instead of the expected 1980 to 2019
-> adjust if needed
- In SOILWAT, `calcSiteClimate()` takes in a Bool for "isNorthHem" and the intermediate C function `rSW2_calc_SiteClimate()` was sending in the latitude so it needed to be translated.
- Outputs are now more correct for when called from the southern hemisphere
- calculate average daily air temperature "Tmean" only if actually utilized, i.e., if C4 variables are requested "do_C4vars"
- several differences in output
-> awaiting documented explanation

- new version is about 20x faster than the old one
…hanges

- rSOILWAT2 expects that package version differences smaller than "minor" level are not relevant for simulation objects
--> don't update test objects if they change by the version only at the "patch" level
…riables"

- update SOILWAT2 to commit 679226f03acfb8993b09fca3659ea2e141cce3a2 (2022-Oct-05) "Isolate "allWeather" functionality from global variables"
- updated "weathsetup.in"
…m global variables"

- `start()`, `onGetInputDataFromFiles()`, and `rSW2_processAllWeather()` are now calling `SW_WTH_finalize_all_weather()`

- deprecated "FirstYear_Historical" (but kept in rSOILWAT2 for easier backwards compatbility)

- `onGet_WTH_DATA()` and `onGet_WTH_DATA_YEAR()` now use new `SW_Weather.startYear` to index weather data

- `onSet_WTH_DATA()` now sets `SW_Weather.startYear` and mirrors other changes in `SW_WTH_read()` to accommodate code changes

- `rSW2_setAllWeather()` no longer generates missing values and applies monthly scaling parameters (see changes to `readAllWeather()` and new `SW_WTH_finalize_all_weather()`
- Accommodated R code to no longer look for old SOILWAT2 variable "yr" within SW_WEATHER
- Added input to `deallocateAllWeather()` and `allocateAllWeather()` which previously did not take in any variables
- Updated data to take changes into account
- remove log file
- add expression to ".gitignore" for automatic exclusion
- mistakenly added by commit b5fb65a
- Appended to documentation showing the difference between old and new versions of climate calculation:
	* Explanation as to why values are different between the different versions
…y/rSOILWAT2 into feature_climate_predictors
- Added a section explaining why MAT_C and Cheatgrass are different compared to the old versions of rSOILWAT2
This was referenced Dec 2, 2022
@dschlaep dschlaep closed this in 16bb911 Dec 6, 2022
@dschlaep dschlaep deleted the feature_climate_predictors branch July 27, 2023 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants