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

Update write.configs.FATES.R #3360

Closed
wants to merge 9 commits into from
Closed

Conversation

Hhh-hyc
Copy link
Contributor

@Hhh-hyc Hhh-hyc commented Aug 19, 2024

Description

To update write.configs file in fates model, the goal is divided into three stages:

  1. update machine configuration file to successfully generate template.job
  2. update domain, surface and datm files
  3. update parameters

Motivation and Context

The first PR aims to generate basic template.job to run fates model in pecan workflow. However, the web interface of Bety doesn't work on the local machine. Thus, address of local dataset was used.

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.

Copy link
Member

@mdietze mdietze left a comment

Choose a reason for hiding this comment

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

There's a lot that confuses me in this PR. First, it looks like this code is behind the mainline as it's deleted a lot of other people's changes. Second, it's deleted a ton of the FATES coupler without a clear substitution of an alternative structure for solving the same problem.

@@ -120,9 +120,7 @@ authors:
- given-names: Eric R. Scott
affiliation: University of Arizona
orcid: 'https://orcid.org/0000-0002-7430-7879'
- given-names: Harunobu Ishii
Copy link
Member

Choose a reason for hiding this comment

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

Unclear why you need to remove someone else's contribution

@@ -2,6 +2,8 @@
#
# docker-compose -f docker-compose.yml -f docker-compose.dev.yml

version: '3.2'
Copy link
Member

Choose a reason for hiding this comment

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

does this PR really need to touch docker files?


trait.values$temperate.coniferous <- tc_traits
settings <- '/pecan/models/fates/R/test.fates.xml'
run.id <- 'test_oneyear'
Copy link
Member

Choose a reason for hiding this comment

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

Was this supposed to be an example? You can't have code like this that's outside of function.

write.config.FATES <- function(defaults, trait.values, settings, run.id){

## site information
site <- settings$run$site
site.id <- as.numeric(site$id)
site.id <- site$id # change1: 772 -> SOD1
Copy link
Member

Choose a reason for hiding this comment

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

not following the logic of the change here. Comment is also unclear to a general user

default <- settings$run$inputs$default$path ## reference inputs file structure
site_name <- paste0(site.id %/% 1000000000, "-", site.id %% 1000000000)
site_name <- paste0(site.id, "_c", run.id) ## change3
Copy link
Member

Choose a reason for hiding this comment

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

I'm a bit concerned about the logic change here and on the casedir line. Could you explain what you're intending? Be aware that changes of internal logic can't change the nature of what PEcAn is passing into each function.

# }
# if (!is.null(settings$host$postrun)) {
# hostteardown <- paste(hostteardown, sep="\n", paste(settings$host$postrun, collapse="\n"))
# }
Copy link
Member

Choose a reason for hiding this comment

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

For all these large chunks of code that you've commented out, are these things that are no longer used by CLM-FATES?

for (v in seq_along(pft)) {
var <- names(pft)[v]
#for (v in seq_along(pft)) {
#var <- names(pft)[v]
Copy link
Member

Choose a reason for hiding this comment

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

Similar to previous comment, what's the reason for commenting out the last ~50 lines?

if(var == "Vcmax"){
ncdf4::ncvar_put(nc=fates.param.nc, varid='fates_vcmax25top', start = ipft, count = 1,
vals=pft[v]) ## (umol CO2 m-2 s-1)
}
Copy link
Member

Choose a reason for hiding this comment

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

have all of these variable names changed or are you pursuing a conceptually different approach for mapping PEcAn/BETY parameters to fates parameters?

ncdf4::nc_close(clm.param.nc)
ncdf4::nc_close(fates.param.nc)
#ncdf4::nc_close(clm.param.nc)
#ncdf4::nc_close(fates.param.nc)
Copy link
Member

Choose a reason for hiding this comment

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

got to the end of this and do see where a new alternative way of parameter mapping ended up being implemented

@@ -32,7 +32,6 @@ Imports:
stringr
Suggests:
corrplot,
exactextractr,
Copy link
Member

Choose a reason for hiding this comment

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

Why does this PR require changes to assim.sequential?

@Hhh-hyc
Copy link
Contributor Author

Hhh-hyc commented Aug 20, 2024

Thanks for your detailed comment! @mdietze

This PR is to show the steps in updating write.config file, and currently it's on the first stage to run the basic workflow of fates, where many fates coupler is uncommented for clarity and would be completely updated in the end. One problem is since my docker got stuck to open BETY webpage, temporarily some local address is used and name in the script is changed to run the fates model, just as you mentioned in the above comments. I would be grateful if you could have any idea in helping me solve the issue related to BETY.

As for the deleted contributions, I'm also confused cause I pushed my changes after having pulled the develop branch from upstream pecan. But I will check the version of my repository, and see if there are some problems to be solved.

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

Successfully merging this pull request may close these issues.

2 participants