-
Notifications
You must be signed in to change notification settings - Fork 4
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
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- 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
- 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
…LWAT2 into feature_read_weather
- 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
calc_SiteClimate()
#205