Skip to content

PEPRMT: new parameters, met integration#3938

Open
abbylewis wants to merge 26 commits into
PecanProject:developfrom
abbylewis:peprmt_met
Open

PEPRMT: new parameters, met integration#3938
abbylewis wants to merge 26 commits into
PecanProject:developfrom
abbylewis:peprmt_met

Conversation

@abbylewis
Copy link
Copy Markdown
Contributor

Description

Fairly substantial changes to PEcAn.PEPRMT to incorporate meteorological inputs, update parameter specification, and transition away from using example data:

  • Updated met2model.PEPRMT to focus on only meteorological inputs (previously had placeholders for salinity, nitrate, etc)
  • Updated model2netcdf.PEPRMT to handle years when data do not start on Jan 1
  • Updated write.configs.PEPRMT to accommodate new parameter formulation in PEPRMT.Tidal, as well as to add met inputs. This is a bit involved because the dates differ across sites
  • Set up data processing to generate site_info.csv and site-specific driver files from the files Patty Oikawa has sent
  • Updated input_demo.qmd to handle new parameter names and run met2model.PEPRMT
  • Some tweaks to documentation and plotting in the original demo
    @infotroph

Review Time Estimate

  • Immediately
  • Within one week
  • [ x] When possible

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [x ] 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
  • [x ] I agree that PEcAn Project may distribute my contribution under any or all of
    • the same license as the existing code,
    • and/or the BSD 3-clause license.
  • I have updated the CHANGELOG.md.
  • I have updated the documentation accordingly.
  • [x ] I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • [x ] All new and existing tests passed.

Copy link
Copy Markdown
Member

@infotroph infotroph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this and for your patience with the wait for reviews.

  • Code: Looks great! I left one optional suggestion about a line that confused me but appears to work as intended anyway.
  • Demos: Ran both with no problem ✅
  • Files: Is it necessary to include all three of raw-data/site-data-raw, raw-data/site-data-formatted, and data/PEPRMT_specific_inputs? They're small enough it's OK to commit them all if needed, but big enough to be worth being sure.

Comment on lines +28 to +31
if(nchar(in.prefix)>0 &
!substr(in.prefix, nchar(in.prefix), nchar(in.prefix)) %in% c(".", "_")) {
in.prefix = paste0(in.prefix,".")
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Am I reading right that this is testing whether in.prefix already ends in . or _?
Would this be more readable?

Suggested change
if(nchar(in.prefix)>0 &
!substr(in.prefix, nchar(in.prefix), nchar(in.prefix)) %in% c(".", "_")) {
in.prefix = paste0(in.prefix,".")
}
if (nchar(in.prefix) > 0 && !any(endsWith(in.prefix, c(".", "_")))) {
in.prefix <- paste0(in.prefix, ".")
}

Copy link
Copy Markdown
Member

@infotroph infotroph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple more to quiet the CI messages. You'll also need to remove PEPRMT from the Imports: section of DESCRIPTION since it's no longer called anywhere R's package checks can see it. I suggest moving it to a new Enhances: line.


peprmt_specific_input_path <- settings$run$inputs$PEPRMT$path

run_data <- read.csv(peprmt_specific_input_path) |>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
run_data <- read.csv(peprmt_specific_input_path) |>
run_data <- utils::read.csv(peprmt_specific_input_path) |>

peprmt_specific_input_path <- settings$run$inputs$PEPRMT$path

run_data <- read.csv(peprmt_specific_input_path) |>
dplyr::select(-any_of(met_vars)) |>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
dplyr::select(-any_of(met_vars)) |>
dplyr::select(-dplyr::any_of(met_vars)) |>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants