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 calculations in model2netcdf.ED2() on E files #3129

Merged
merged 29 commits into from
Mar 13, 2023
Merged

Conversation

Aariq
Copy link
Collaborator

@Aariq Aariq commented Mar 6, 2023

Description

This is a near total re-write of the read_E_files() function that extracts data from monthly .h5 files output by ED2. The re-write simplifies code by extracting variables with the same dimensions into data frames and joining them before doing any calculations or unit conversions. This simplifies the logic greatly (IMO).

It also removes DDBH (cm/plant/yr) as one of the variables extracted from the -E- files, since I'm no longer sure it even makes sense to summarize across cohorts.

The time dimensions were getting calculated incorrectly for monthly -E- file data as well (#3069), and that is now fixed in this PR.

Motivation and Context

Previously, the conversions were operating on the false assumption that variables like NPP and transpiration were coming out of ED2 in per-area units (EDmodel/ED2#384). Also, there was previously no weighting by patch area when summing across cohorts and patches. See more in #3126

Review Time Estimate

  • Immediately
  • Within one week
  • When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • My name is in the list of CITATION.cff
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@Aariq Aariq linked an issue Mar 6, 2023 that may be closed by this pull request
@Aariq Aariq marked this pull request as ready for review March 6, 2023 20:24
@Aariq Aariq requested review from mdietze and dlebauer March 6, 2023 20:59
@dlebauer dlebauer enabled auto-merge March 8, 2023 18:51
@dlebauer dlebauer added this pull request to the merge queue Mar 8, 2023
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Mar 8, 2023
@Aariq
Copy link
Collaborator Author

Aariq commented Mar 9, 2023

Just installed this on Welsch and getting this warning for every variable, so something's not right still:

With 'AGB_PFT': [1] "ncvar_put: warning: you asked to write 10 values, but the passed data array has 24 entries!" 
With 'BSEEDS': [1] "ncvar_put: warning: you asked to write 10 values, but the passed data array has 24 entries!" 

Going back to a draft for now.

@Aariq Aariq marked this pull request as draft March 9, 2023 18:49
@dlebauer dlebauer marked this pull request as ready for review March 9, 2023 18:54
@Aariq Aariq marked this pull request as draft March 9, 2023 21:23
@Aariq
Copy link
Collaborator Author

Aariq commented Mar 10, 2023

Whooops, I guess read_E_files() has to read only one year at a time for it to be compatible with put_E_values()

@Aariq Aariq marked this pull request as ready for review March 10, 2023 16:14
@Aariq Aariq requested a review from dlebauer March 12, 2023 23:51
@dlebauer dlebauer added this pull request to the merge queue Mar 13, 2023
Merged via the queue into develop with commit 9ced5a0 Mar 13, 2023
@infotroph infotroph deleted the model2netcdf-fix branch May 10, 2024 18:38
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.

model2netcdf.ED2() calculations for -E- files are incorrect
2 participants