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

Development for v6.1.0 #245

Merged
merged 36 commits into from
Jul 15, 2024
Merged

Development for v6.1.0 #245

merged 36 commits into from
Jul 15, 2024

Conversation

dschlaep
Copy link
Member

No description provided.

@dschlaep dschlaep marked this pull request as draft January 23, 2024 16:02
dschlaep and others added 27 commits February 15, 2024 12:41
…up capabilities currently and to prepare for potential domain integration later
…ion from SOILWAT2 to rSOILWAT2 (namely the spinup functionality)
- More details about DayMet: noleap calendar; no wind data
- Code examples illustrate now lack of wind data and obtaining atmospheric CO2 values
* renamed rSW_Model to rSW_Domain
* added new file M_swSpinup.R to handle new spinup variables
* incorporated new spinup variable with the existing years variables in the new domain file
* Something is still causing errors in terms of when files are read or not
- update to commit 3d349b9f7bf8db981df8b13f551f17210746e5e0 on branch release/devel_v8.0.0
** now includes merged feature_nc_output
** submodule pcg changed remote origin
- Package-level updates:
* NEWS
* Submodule SOILWAT2 now at commit 6467716e415b42a13170d2b14452019b46f099fe (includes a few minor bug fixes)
* SOILWAT2 test example input files
* rSOILWAT2 test objects
* rSOILWAT2 tests for spinup functionality
* Vignette with spinup demonstration
* Export and document new methods to interact with spinup functionality: set_swSpinup(), get_sw_Spinup(), swSpinup_SpinupActive(), swSpinup_SpinupDuration(), swSpinup_SpinupMode(), swSpinup_SpinupScope(), swSpinup_SpinupSeed()

- Class upgrade functionality
* sw_upgrade() now adds (i) new slot "spinup" for objects of class "swInputData" and (ii) adds additional input files for objects of class "swFiles"

- Class "swSpinup"
* Added missing generic method "swSpinup_SpinupActive<-"
* Added missing spinup methods: get_swSpinup(), set_swSpinup(), swSpinup_SpinupActive()
* Validity tests now agree with C implementation
* Renamed spinup code file from R/M_swSpinup.R to R/B_swSpinup.R -- package building/installation requires that "swSpinup" is available before "swInputData" is processed

- Class "swInputData"
* Added new slot "spinup"
* Implemented upgrade functionality for new slot "spinup" in sw_upgrade() method of "swInputData"
* Implemented "spinup"-methods for class "swInputData"

Updates to interface to C code of SOILWAT2 (v8.0.0-devel)

- New "spinup" functionality
* `sw_start()` now calls `SW_CTL_run_spinup()` to run the spinup

- New struct "SW_Domain"
* SW_R_lib gains new global "SoilWatDomain" (rSOILWAT2 does not represent a domain to the R user -- it is fixed internally at size 1 reproducing previous behavior)
* New call to `SW_DOM_soilProfile()` (see SOILWAT2's `main()`) by functions that set up SOILWAT2 inputs, i.e., `sw_start()` and `onGetInputDataFromFiles()`
* rSW2_readAllWeatherFromDisk() gains argument "sw_template" which hold default rSOILWAT2 inputs that serve as template (now required by `setupSOILWAT2()`)
* New `onSet_SW_DOM()` and `onGet_SW_DOM()` to pass values via memory between rSOILWAT2 and SOILWAT2 structures/classes
** Note that `onSet_SW_DOM()` currently hard-codes a domain size of 1
* New `rSW_CTL_setup_domain()` (equivalent to SOILWAT2's `SW_CTL_setup_domain()`): obtain inputs for "files" and "domain" (from disk or via memory); construct and set up the domain

- Order of obtaining inputs ("files" and new "domain" are now called earlier by `SW_CTL_setup_domain()` and not longer later by `SW_CTL_obtain_inputs()` as previously):
* `setupSOILWAT2()` now sets up the domain and thus obtains inputs (from disk or via memory): new arguments "from_files" and "InputData" -- only `onGetInputDataFromFiles()` is reading inputs from disk, all other functionality passes inputs via memory (from the R user to the SOILWAT2 C code)
* Move call to `onSet_SW_F()` from `rSW_CTL_obtain_inputs()` to `rSW_CTL_setup_domain()` -- matching SOILWAT2's new `SW_CTL_setup_domain()`

- (De)allocating memory (new dedicated functions for finer control):
* De-allocation of SOILWAT2 memory now requires a separate call to `SW_DOM_deconstruct()`
* `onSet_MKV()` gains call to new `allocateMKV()`
* `onSet_SW_VES()` gains calls to `SW_VES_construct()` and new `SW_VES_alloc_outptrs()` as well as `SW_VegEstab_alloc_outptrs()`
* `sw_start()` gains call to `SW_CTL_alloc_outptrs()`
- `cInF` of sw_consts() again contains the correct (newly increased number of) input file names
--> this should be fixing "undefined behavior" in `SET_STRING_ELT(cnames, i, mkChar(cInF[i]));`
--> this should be fixing "segfault" in `.Call(C_sw_consts)`
- tests and example code was failing when external data sources were offline or changed their delivery format
- now failures are captured correctly
- compare_weather() now creates boxplots of correlation of each variables with precipitation (in addition to the already implemented mean and standard variation of each variable)
- compare_weather() now creates a new figure that shows the long-term (across years) daily, weekly, and monthly means of each variable (plus a time series of annual values)
- compare_weather() accepts weather sets from different years; thus, the new added plot that compares time-series across years (commit ab6cd73) failed if years differed
-> now create time-series comparisons only if comparable data are available

- also fix test expectations: now five (instead of four) figures are produced
- update to commit 36cb14ec060b841f0be3679387f0168ae27d6ffd
- includes "Fix sw_fail_on_error() for rSOILWAT2"
* SOILWAT2 updated to v8.0.0-devel which now includes a simulation domain; however, this has no impact on rSOILWAT2.
* New spin-up functionality (@niteflyunicorns, @dschlaep). A user-requested sequence of (random) years is simulated (without output) before the actual simulation run to provide better starting values (e.g., soil moisture, soil temperature).
Copy link

codecov bot commented May 20, 2024

Codecov Report

Attention: Patch coverage is 62.44541% with 258 lines in your changes missing coverage. Please review.

Project coverage is 58.95%. Comparing base (233217a) to head (14b88c4).

Files Patch % Lines
R/swWeatherGenerator.R 0.00% 143 Missing ⚠️
src/rSW_Domain.c 69.75% 49 Missing ⚠️
src/rSW_VegEstab.c 48.93% 24 Missing ⚠️
R/sw_WeatherExtract.R 0.00% 12 Missing ⚠️
src/SW_R_lib.c 86.51% 12 Missing ⚠️
R/B_swFiles.R 79.16% 5 Missing ⚠️
src/rSW_SoilWater.c 60.00% 4 Missing ⚠️
src/rSW_Markov.c 66.66% 2 Missing ⚠️
src/rSW_Weather.c 90.00% 2 Missing ⚠️
R/A_swGenericMethods.R 93.33% 1 Missing ⚠️
... and 4 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #245      +/-   ##
==========================================
+ Coverage   58.93%   58.95%   +0.02%     
==========================================
  Files          43       44       +1     
  Lines        8593     8863     +270     
==========================================
+ Hits         5064     5225     +161     
- Misses       3529     3638     +109     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

dschlaep added 3 commits May 31, 2024 11:30
- update SOILWAT2 to commit 8670d8767123a129976a1861178b104e10784bbe
** feature_format: formatted code, include header directives, and adjusted macros
** feature_compile_lib: improved compilation as library
- declare C11 as system requirement because
* R v4.3.0 now requires C11 or later to satisfy "R_ext/Complex.h:77:5: warning: anonymous structs are a C11 extension"
* C11 is apparently required to find externed SOILWAT2 variables in flat namespace

Update 'makevars'
- removed "-I.." because SOILWAT2 files no longer include rSOILWAT2 header files
- removed "sw_sources" because SOILWAT2 now automatically includes correct source files
- Use fmin/fmax instead of macros min/max (now MIN/MAX) when used with types float or double
- Renamed swprintf to sw_printf
N1ckP3rsl3y and others added 3 commits July 10, 2024 09:52
- SOILWAT2 has two new structs - SW_OUT_DOM & SW_OUT_RUN
	* SW_OUT_DOM - Holds output information that is constant between simulation runs
	* SW_OUT_RUN - Holds output information that will change during simulation runs
- SOILWAT2 removed SW_OUTPUT_POINTERS
- SOILWAT2 functions `SW_CTL_setup_model()` & `SW_OUT_construct()` gain new parameter
	* Parameter determines if SW_OUT_RUN should be zeroed out

- Remove instances of SW_OUTPUT_POINTERS
- Rename SW_ALL to SW_RUN and `SoilWatAll` to `SoilWatRun`
- Update call to `SW_CTL_setup_model()` to provide the flag input
- Update `inst/extdata/example1/Input/outsetup.in` to turn on the ESTABL with a sumtype of AVG
… example inputs

- SOILWAT2 example inputs: ESTABL output method is now "AVG" by default (and no longer "OFF")
- however, rSOILWAT2 turns off ESTABL output for its own "example1"
@dschlaep dschlaep requested a review from N1ckP3rsl3y July 11, 2024 20:54
- update NEWS
- update SOILWAT2 submodule to v8.0.0
@dschlaep dschlaep marked this pull request as ready for review July 15, 2024 16:27
@dschlaep dschlaep merged commit f008e89 into main Jul 15, 2024
16 checks passed
@dschlaep dschlaep deleted the release/devel_v6.1.0 branch July 15, 2024 16:39
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.

3 participants