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

Fix CRU vpd (when vapr wasn't requested) #73

Merged
merged 4 commits into from
Jan 8, 2025
Merged

Fix CRU vpd (when vapr wasn't requested) #73

merged 4 commits into from
Jan 8, 2025

Conversation

fabern
Copy link
Member

@fabern fabern commented Dec 20, 2024

This PR fixes a number of things:

  • CRU vpd, when vapr was not requested
  • WATCH_WFDEI and WFDE5 bias-correction of VPD when calling ingest(), it was however fine for ingest_bysite()

Further this includes streamlining of code:

  • homogenize treatment of VPD between CRU, WATCH_WFDEI and WFDE5
  • homogenize code between ingest() and ingest_bysite() to work towards the long-term aim to make ingest() a simple wrapper (reduce this large code duplication that lead to the 2nd bug)

…g column 'vapr'

This fixes VPD for CRU, when vapr was not requested.
This commit moves computation of vpd with calc_vpd() inside of ingest_globalfields() for CRU, watch_wfdei, and wfde5. This results in consistent code between these 3 sources and also irrespective of the user calling ingest() or ingest_bysite(). Hence, this reduces code replication.
Furthermore, calc_vpd() is now re-computed (in ingest() or ingest_bysite()) only in cases when there is bias correction of `vapr` with WorldClim data. This code is still repeated across ingest() and ingest_bysite().
All three cases now compute 'vapr' in Pa within 'ingest_globalfields()'. Previously for CRU there was a variable 'vap' in hPa.
The bug resulted in not using bias-corrected vapr for VPD in watch_wfdei and wfde5 when calling ingest(). It was however bias-corrected when using ingest_bysite().
@fabern fabern marked this pull request as ready for review December 21, 2024 13:05
@fabern fabern self-assigned this Dec 21, 2024
@fabern fabern merged commit adc1bad into master Jan 8, 2025
4 of 5 checks passed
@fabern fabern deleted the fix-cru-vpd branch January 8, 2025 07:43
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.

1 participant