-
Notifications
You must be signed in to change notification settings - Fork 2
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
Bugfix435: calculated relative humidity #436
Merged
dschlaep
merged 12 commits into
master
from
bugfix435ForV800_calculatedRelativeHumidity
Nov 26, 2024
Merged
Bugfix435: calculated relative humidity #436
dschlaep
merged 12 commits into
master
from
bugfix435ForV800_calculatedRelativeHumidity
Nov 26, 2024
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
- check that relative humidity is calculated from vp, tmax, and tmin -> test is now correctly failing (i.e., indicating the presence of bug #345): ``` [ RUN ] WeatherFixtureTest.WeatherInputDayMet tests/gtests/test_SW_Weather.cc:1033: Failure The difference between SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[0] and expectedResult is 72.577207808923504, which exceeds tol6, where SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[0] evaluates to 0.73310310918104549, expectedResult evaluates to 73.310310918104548, and tol6 evaluates to 9.9999999999999995e-07. tests/gtests/test_SW_Weather.cc:1042: Failure The difference between SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[midJanDay] and expectedResult is 73.035512241813024, which exceeds tol6, where SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[midJanDay] evaluates to 0.73773244688700024, expectedResult evaluates to 73.773244688700018, and tol6 evaluates to 9.9999999999999995e-07. [ FAILED ] WeatherFixtureTest.WeatherInputDayMet (1 ms) ```
- check that relative humidity is calculated from specific humidity, tmax, and tmin -> test is correctly failing (i.e., indicating the presence of bug #345): ``` [ RUN ] WeatherFixtureTest.WeatherInputMACAtype2 tests/gtests/test_SW_Weather.cc:1322: Failure The difference between SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[0] and 100. * e / es is 20.125763304504432, which exceeds tol6, where SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[0] evaluates to 100, 100. * e / es evaluates to 79.874236695495568, and tol6 evaluates to 9.9999999999999995e-07. tests/gtests/test_SW_Weather.cc:1333: Failure The difference between SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[midJanDay] and 100. * e / es is 21.22859263656683, which exceeds tol6, where SW_Run.Weather.allHist[yearIndex]->r_humidity_daily[midJanDay] evaluates to 100, 100. * e / es evaluates to 78.77140736343317, and tol6 evaluates to 9.9999999999999995e-07. [ FAILED ] WeatherFixtureTest.WeatherInputMACAtype2 (8 ms) ```
- each attribute of structs SW_WEATHER_NOW, SW_WEATHER_HIST, and SW_SKY are now documented with units - clarify internal units of specific humidity (mass of water vapor in unit mass of moist air) [g kg-1] - add comment that specify the correct units in read_weather_hist() - checkAllWeather() now warns if relative humidity is within 0-1
- fix #435 * read_weather_hist() now uses relativeHumidity1() to calculate relative humidity from vapor pressure -- fixing first part of bug #435 * read_weather_hist() now uses relativeHumidity2() to calculate relative humidity from specific humidity inputs -- 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) --> the new tests introduced in recent commits (b04a09e05bd7f74487e179b86b0de42310970af9, 6457893f749e9bf775a18521d80cfdc7153e9d07) are now passing - new functions * relativeHumidity1() calculates relative humidity from vapor pressure and temperature by estimating saturated vapor pressure * relativeHumidity2() calculates relative humidity from specific humidity and temperature with a pressure correction from elevation * actualVaporPressure4()calculates vapor pressure from specific humidity with a pressure correction from elevation - other changes * readAllWeather() and read_weather_hist() gain argument "elevation" which is used for the pressure correction when calculating relative humidity from specific humidity inputs * update unit tests to reflect changes
- test now checks for all weather variables: tests "WeatherDefaultValues" and "WeatherSomeMissingValuesDays" - renamed tests for consistency * test "WeatherInputGridMET" was previously "WeatherInputDailyGridMet" * test "WaterBalanceWithGridMET" was previously "WaterBalanceWithGRIDMET" * test "WeatherInputDaymet" was previously "WeatherInputDayMet" * test "WeatherInputMACAtype1" was previously "WeatherInputMACA" * test "WaterBalanceWithMACAtype1" was previously" WaterBalanceWithMACA" - renamed "maca" example input data to "maca-type1" for consistency - tests with weather data types ("WeatherInput*" and "WaterBalanceWith*" with * in {"GridMET", "MACAtype1", "MACAtype2" and "Daymet"}) now * set every value of dailyInputIndices and dailyInputFlags to clarify which inputs are available and which are not available * new checks that no weather value is missing (except for Daymet which does not provide inputs for wind speed) * updated checks for relative humidity - new test "WaterBalanceWithMACAtype2"
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #436 +/- ##
==========================================
+ Coverage 73.00% 73.22% +0.22%
==========================================
Files 20 20
Lines 6005 6025 +20
==========================================
+ Hits 4384 4412 +28
+ Misses 1621 1613 -8 ☔ View full report in Codecov by Sentry. |
- close #437 "Incorrect count of LOCF in generateMissingWeather()" - the number of days on which LOCF was applied is now correctly counting only the days when there was a missing value that was replaced by a non-missing value - previously, any day with a missing value was counted -- even if it was not replaced by a non-missing value - for instance, inputs without solar radiation or without vapor pressure previously caused that every day was counted towards the maximum permissible number of LOCFs - note: initial values for LOCF changed from 0 to "missing" -- this matters only for days at the beginning of the time period that have missing values before a later day with a first non-missing value
N1ckP3rsl3y
approved these changes
Nov 26, 2024
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.
Fix the calculation of relative humidity (close #435). Previously, relative humidity was incorrectly calculated if based on vapor pressure or specific 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"
(last observation carried forward; close #437). Previously, any day with a missing weather value was counted.