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.2.0 #248

Merged
merged 15 commits into from
Nov 27, 2024
Merged

Development for v6.2.0 #248

merged 15 commits into from
Nov 27, 2024

Conversation

dschlaep
Copy link
Member

  • Updating to SOILWAT2 v8.0.1
  • Several fixes to handling of weather data
  • The inputs of daily specific humidity changed units ("%" to "g kg-1") and name ("specHavg_pct" to "specHavg_gPERkg")

- rhub was overhauled with v2 (https://blog.r-hub.io/2024/04/11/rhub2/)
- https://builder.r-hub.io is flagged with a "potential security risk"
--> potential alternative is to use the "rhub" R package (https://cran.r-project.org/package=rhub)
- objects with all missing values are now passed through (instead of causing a cryptic error)
- tests now check dbW_fixWeather() for "normal" use and for the case with all missing values
* Fix the calculation of relative humidity
* Fix the count of days on which a missing weather value was replaced by a non-missing value from the preceding day for the method "LOCF"
See DrylandEcology/SOILWAT2#435

1) Updates to rSW2_set_weather_hist() are reflecting the changes in SOILWAT2's read_weather_hist()
* rSW2_set_weather_hist() now uses relativeHumidity1() to calculate relative humidity from vapor pressure -- fixing first part of SOILWAT2 bug #435
* rSW2_set_weather_hist() gained argument "elevation" and now uses relativeHumidity2() to calculate relative humidity from specific humidity inputs and elevation -- fixing second part of bug #435
** the conversion from specific to relative humidity is not exact, the code snaps estimated values within 100-150% to 100% relative humidity (with a warning)

Consequently,
* rSW2_setAllWeather() gained argument "elevation" which is passed to rSW2_set_weather_hist()

* onSet_WTH_DATA() calls rSW2_setAllWeather(): thus, functions that call onSet_WTH_DATA() are now required to previously set "elevation". These are
** rSW_CTL_obtain_inputs() calls onSet_WTH_DATA(): now, obtaining weather data occurs after obtaining "site" data that includes elevation
** rSW2_processAllWeather() calls onSet_WTH_DATA(): now, copies "elevation" from inputData argument to global object that is utilized by onSet_WTH_DATA()
*** dbW_generateWeather() calls rSW2_processAllWeather(): gained argument "elevation"
**** dbW_imputeWeather() calls dbW_generateWeather(): gained argument "elevation"

* rSW2_calc_SiteClimate() calls rSW2_setAllWeather(): gained argument "elevation"
** calc_SiteClimate() calls rSW2_calc_SiteClimate(): gained argument "elevation"

2) SOILWAT2's SW_WTH_read() now passes elevation as argument to readAllWeather(): thus, functions that call SW_WTH_read() are now required to previously set "elevation". These are
* rSW2_readAllWeatherFromDisk() calls SW_WTH_read(): gained argument "elevation"
** getWeatherData_folders() calls rSW2_readAllWeatherFromDisk(): gained argument "elevation"
*** dbW_addWeatherData() calls getWeatherData_folders(): gained argument "elevation"
**** dbW_addFromFolders() calls dbW_addWeatherData(): argument "MetaData" gained new column "elevation"

3) Update "extdata/example1" from SOILWAT2, i.e., "data_weather_maca" was renamed to "data_weather_maca-type1", "data_weather_maca-type2" is a new dataset
* update tests "Weather data sources" to handle new and renamed weather data sources
- update package data: only difference is the updated name of the weather data column for specific humidity
- update test data: only difference is the updated name of the weather data column for specific humidity

- rename specific humidity: weather_dataColumns() and weather_dataAggFun()
* dbW_weatherData_to_monthly() and dbW_dataframe_aggregate() are now more careful with weather data column names

- functionality to upgrade old weather data:
* new weather_renamedDataColumns() identifies renaming of weather data columns
* new upgrade_weatherColumns() applies renaming of weather data columns
* upgrade_weatherDF() now calls upgrade_weatherColumns() -- satisfying sw_upgrade(), upgrade_swWeatherData(), and upgrade_weatherHistory()

- updated functionality to test validity:
* validObject() method for class "swWeatherData" now checks for expected column names in the "data" slot
* new validObject_weatherHistory() to check for validity of a weatherHistory object
* validObject() method for class "swInputData" now checks for a valid weatherHistory object -- previously weatherHistory was skipped
- documentation now includes the changes to classes "swWeather" and "swWeatherData" with v6.0.0
@dschlaep dschlaep mentioned this pull request Nov 26, 2024
@dschlaep dschlaep changed the title Release/devel v6.2.0 Development for v6.2.0 Nov 26, 2024
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

Attention: Patch coverage is 88.05970% with 8 lines in your changes missing coverage. Please review.

Project coverage is 59.26%. Comparing base (f008e89) to head (ea29136).
Report is 16 commits behind head on main.

Files with missing lines Patch % Lines
R/sw_dbW_WeatherDatabase.R 55.55% 4 Missing ⚠️
src/rSW_Weather.c 70.00% 3 Missing ⚠️
R/D_swWeatherData.R 96.29% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #248      +/-   ##
==========================================
+ Coverage   58.95%   59.26%   +0.31%     
==========================================
  Files          44       44              
  Lines        8863     8899      +36     
==========================================
+ Hits         5225     5274      +49     
+ Misses       3638     3625      -13     

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

@dschlaep dschlaep requested a review from N1ckP3rsl3y November 26, 2024 21:36
@dschlaep dschlaep merged commit e705676 into main Nov 27, 2024
16 checks passed
@dschlaep dschlaep deleted the release/devel_v6.2.0 branch November 27, 2024 17:12
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.

2 participants