-
Notifications
You must be signed in to change notification settings - Fork 307
PEPRMT: new parameters, met integration #3938
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
Open
abbylewis
wants to merge
26
commits into
PecanProject:develop
Choose a base branch
from
abbylewis:peprmt_met
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
36a14e1
A little more documentation and figure edits
abbylewis e25e2d5
Add CH4 parameter names
abbylewis 3ae21d0
hls file path
abbylewis 866ed61
update param names
abbylewis eb52add
Merge branch 'PecanProject:develop' into peprmt_met
abbylewis cfc8b2b
Merge branch 'PecanProject:develop' into peprmt_met
abbylewis f6921c7
Merge branch 'peprmt_met' of https://github.com/abbylewis/pecan into …
abbylewis a747319
clean met to model to only be TA and PAR
abbylewis 85adacb
ignore demo outputs
abbylewis 09e896e
starting met tutorial
abbylewis f2be546
adding met to settings
abbylewis d77d77b
add some processed met files. ignore the raw era 5
abbylewis 696a87e
new PEPRMT params
abbylewis 5f9be36
fix template
abbylewis 93da92b
pass params better
abbylewis d2c6e1b
pass data to PEPRMT..
abbylewis f4783e8
clean up repo
abbylewis a86b9b5
met set up for demo
abbylewis 9c004dd
all set with new data sources
abbylewis 2a812d8
updates to make the original demo work again
abbylewis fe8c240
contributing!
abbylewis 623ea22
remove extra saved pfts
abbylewis 0da63f9
remove ref to my fork
abbylewis c782eae
remove soil from xml
abbylewis 4af28b8
Merge branch 'PecanProject:develop' into peprmt_met
abbylewis 30a9f7e
Merge branch 'develop' into peprmt_met
infotroph File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -66,14 +66,20 @@ write.config.PEPRMT <- function(defaults, trait.values, settings, run.id) { | |||||
| ) | ||||||
| } | ||||||
| } | ||||||
| GPP_names <- c("GPP_a0", "GPP_a1", "GPP_Ha", "GPP_Hd") | ||||||
| Reco_names <- c("Reco_Ea_som", "Reco_kM_som", | ||||||
| "Reco_Ea_labile", "Reco_kM_labile") | ||||||
| CH4_names <- paste("CH4", 1:8, sep = "_") # TODO get meaningful names from Patty | ||||||
| missing_traitnames <- setdiff(c(GPP_names, Reco_names, CH4_names), trait_names) | ||||||
|
|
||||||
| params <- c("wetland_type", "a0", "a1", "Ha", "Hd", "T_opt_GPP", "Ea_SOM", | ||||||
| "kM_SOM", "Ea_labile", "kM_labile", "Ea_SOM_CH4", "kM_SOM_CH4", | ||||||
| "Ea_labile_CH4", "kM_labile_CH4", "Ea_oxi_CH4", "kM_oxi_CH4", | ||||||
| "kI_SO4", "kI_NO3", "k_plant_oxi") | ||||||
| provided_traitnames <- intersect(params, trait_names) | ||||||
| if (!"wetland_type" %in% provided_traitnames) { | ||||||
| trait_values["wetland_type"] <- 2 | ||||||
| provided_traitnames <- c(provided_traitnames, "wetland_type") | ||||||
| } | ||||||
| missing_traitnames <- setdiff(params, trait_names) | ||||||
| if (length(missing_traitnames) > 0) { | ||||||
| PEcAn.logger::logger.error( | ||||||
| "Parameters missing from trait.values", | ||||||
| PEcAn.logger::logger.warn( | ||||||
| "Parameters missing from trait.values. Will use default", | ||||||
| sQuote(missing_traitnames) | ||||||
| ) | ||||||
| } | ||||||
|
|
@@ -94,15 +100,29 @@ write.config.PEPRMT <- function(defaults, trait.values, settings, run.id) { | |||||
|
|
||||||
| jobsh <- gsub("@BINARY@", settings$model$binary, jobsh) | ||||||
| jobsh <- gsub("@DELETE_RAW@", as.logical(settings$model$delete.raw %||% FALSE), jobsh) | ||||||
|
|
||||||
| param_str <- paste0( | ||||||
| "list(", | ||||||
| paste( | ||||||
| paste0(provided_traitnames, " = ", trait_values[provided_traitnames]), | ||||||
| collapse = ", " | ||||||
| ), | ||||||
| ")" | ||||||
| ) | ||||||
|
|
||||||
| jobsh <- gsub("@PARAMS@", param_str, jobsh, fixed = TRUE) | ||||||
|
|
||||||
| jobsh <- gsub("@GPP_THETA@", paste(trait_values[GPP_names], collapse = ", "), jobsh) | ||||||
| jobsh <- gsub("@RECO_THETA@", paste(trait_values[Reco_names], collapse = ", "), jobsh) | ||||||
| jobsh <- gsub("@CH4_THETA@", paste(trait_values[CH4_names], collapse = ", "), jobsh) | ||||||
|
|
||||||
|
|
||||||
| # yes, this will be replaced with real params once demo is working | ||||||
| run_data <- PEPRMT::example_data |> | ||||||
| dplyr::filter(.data$site == settings$run$site$id) | ||||||
| # MET | ||||||
| met_path <- settings$run$inputs$met$path | ||||||
| met <- utils::read.table(met_path, header = T) | ||||||
| met_vars <- colnames(met)[!colnames(met) %in% c("Year", "DOY_disc")] | ||||||
|
|
||||||
| peprmt_specific_input_path <- settings$run$inputs$PEPRMT$path | ||||||
|
|
||||||
| run_data <- read.csv(peprmt_specific_input_path) |> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| dplyr::select(-any_of(met_vars)) |> | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| dplyr::right_join(met) |> | ||||||
| dplyr::mutate(site = settings$run$site$id) | ||||||
|
|
||||||
| utils::write.csv(run_data, file.path(rundir, "run_data.csv"), row.names = FALSE) | ||||||
| writeLines(jobsh, con = file.path(rundir, "job.sh")) | ||||||
|
|
||||||
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| input_demo_out | ||
| out | ||
| output | ||
| .Rapp.history |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
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?