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

ILAMB task #197

Closed
wants to merge 8 commits into from
Closed

ILAMB task #197

wants to merge 8 commits into from

Conversation

chengzhuzhang
Copy link
Collaborator

@chengzhuzhang chengzhuzhang commented Feb 17, 2022

This PR is to add capability to run ILAMB package for land model bench-marking. Close #133, #134.

Example configuration file:

[default]
input = /lcrc/group/e3sm/ac.forsyth2/E3SM_simulations/20210122.v2_test01.piControl.ne30pg2_EC30to60E2r2-1900_ICG.chrysalis
input_subdir = archive/atm/hist
output = /lcrc/group/e3sm/ac.zhang40/zppy_tests/zppy_ilamb_324_tr1 
case = 20210122.v2_test01.piControl.ne30pg2_EC30to60E2r2-1900_ICG.chrysalis
www = /lcrc/group/e3sm/public_html/diagnostic_output/ac.zhang40/zppy_ilamb
partition = compute
# TODO: will add a configuration template for "BGC" campaign
campaign = "water_cycle"
environment_commands = "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh"

# Regridded monthly time series files in 10 year chunks
[ts]
active = True
years = "1:10:10",
ts_fmt = "cmip"

  # Monthly land time series
  [[ land_monthly ]]
  input_subdir = "archive/lnd/hist"
  input_files = "elm.h0"
  frequency = "monthly"
  mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
  # TODO: add more variables requested by BGC
  vars = "LAISHA,LAISUN"

  [[ atm_monthly_180x360_aave ]]
  input_subdir = "archive/atm/hist"
  input_files = "eam.h0"
  frequency = "monthly"
  mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
  # TODO: add more variables requested by BGC
  vars = "PRECC,PRECL"

[ilamb_run]
active = True
years = "1:10:10",
ts_num_years = 10
short_name = '20210122.v2_test01'
  [[ land_monthly ]]
  • Integrate in e3sm_to_cmip function for additional parameter to generate CMIP-like time-series for land and atmosphere variables, that ilamb_run task required.
  • Integrate in ilamb_run task.
  • TODO: Include equivalent mpi call for supported machines.
  • TODO: Copy files to web servers.
  • TODO: figure out path for ILAMB obs data.

External development for e3sm_to_cmip

ILAMB has some underlying assumptions and are noted here (Thanks to @minxu74, one of the ILAMB developers, to help me understand):

  • The benchmarking practice is recommended applying to historical simulations, i.e. simulation data at least partially over the time period of the source data (year 2000-). ILAMB will match the overlap of the model and obs years, except using "--model_year" to shift year to create overlapping. ILAMB can work with continuous time segments without pre-concantenation.
  • if there is no areacella, ILAMB will use longitude and latitude information to compute areas (CellAreas function in ilamblib.py); if the sftlf variable is missing, 100% land area is assumed. This is an approximate method.
  • the cmip.cfg will be used as base configuration file. This .cfg is specific for CMIP5 and 6 benchmarking. The other file ilamb.cfg is used to run ilamb in a default setting, some metrics are removed in the cmip.cfg as the observational data’s uncertainty is large from feedbacks of users and rubisco team members. But I will defer to BGC to provide a more specific ilamb config to fit the research need.

@forsyth2 forsyth2 added the semver: new feature New feature (will increment minor version) label Mar 3, 2022
@chengzhuzhang
Copy link
Collaborator Author

chengzhuzhang commented Mar 17, 2022

Update Mar 17, 2022:
A prototype is working on Chrysalis. More TODO

@chengzhuzhang chengzhuzhang marked this pull request as ready for review March 25, 2022 16:37
@chengzhuzhang chengzhuzhang requested a review from forsyth2 March 25, 2022 16:39
@chengzhuzhang
Copy link
Collaborator Author

Hey @forsyth2 , this PR is ready for review. The example cfg to test a run can be found here:#197 (comment)
There is a unit test error from CI/CD, but i'm not exactly sure how to fix.
And as we discussed, this PR only covers running Chrysalis, would you please extend this PR or have an enhancement PR to address those machine specific items: path of obs, copy to web servers, and MPI calls...Thank you!

@forsyth2
Copy link
Collaborator

@chengzhuzhang Thanks! I will review and test. I also created #229 to support the other machines.

Copy link
Collaborator

@forsyth2 forsyth2 left a comment

Choose a reason for hiding this comment

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

From what I can tell, the code looks mostly alright -- I just made a few comments.

I will test your configuration file and run the unit/integration tests on Chrysalis once it's back online.

os.path.join(
scriptDir,
"ts_%s_%04d-%04d-%04d.status"
% ("land_monthly", c["year1"], c["year2"], c["ts_num_years"]),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is "land_monthly" always going to be the subsection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I meant to have "land_monthly" the minimum dependency. One can have "atm_monthly" data processed, but not required.

scriptDir,
"ts_%s_%04d-%04d-%04d.status"
% (
"atm_monthly_180x360_aave",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is "atm_monthly_180x360_aave" always going to be the subsection?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

no, same comment as above..

fi

# Point to obsersvation data
# TODO: need to update these data to other supported machines
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: Will be done in #229

echo ${workdir}
echo {{ scriptDir }}

srun --export=ALL -N 1 ilamb-run --config ilamb_run.cfg --model_root $model_root --regions global --model_year ${Y1} 2000
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think you could just put export="ALL" in your submitScript call rather than running srun here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it makes sense! maybe this can be handled in #229 as well?


# Run diagnostics
# Note --export=All is needed to make sure the executable is copied and executed on the nodes.
# TODO: find the mpi run format for different platforms
Copy link
Collaborator

Choose a reason for hiding this comment

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

Note: Will be done in #229.

Comment on lines +76 to +77
echo 'ERROR (2)' > {{ prefix }}.status
exit 2
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since this is the first exit, let's do ERROR (1) and exit 1.

echo ===== COPY FILES TO WEB SERVER =====
echo

# TODO copy _build from $workdir to web server
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is the output copied to the web server in another piece of code somewhere else?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No. The output is still in workdir.

@forsyth2
Copy link
Collaborator

Now that Chrysalis is back up, I ran your configuration file and the unit/integration tests:

This is my version of your configuration file:

[default]
campaign = "water_cycle"
case = 20210122.v2_test01.piControl.ne30pg2_EC30to60E2r2-1900_ICG.chrysalis
environment_commands = "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh"
input = /lcrc/group/e3sm/ac.forsyth2/E3SM_simulations/20210122.v2_test01.piControl.ne30pg2_EC30to60E2r2-1900_ICG.chrysalis
input_subdir = archive/atm/hist
output = /lcrc/group/e3sm/ac.forsyth2/zppy_development/pr_197.example
partition = compute
www = /lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_development/pr_197

# Regridded monthly time series files in 10 year chunks
[ts]
active = True
mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
ts_fmt = "cmip"
years = "1:10:10",

  # Monthly land time series
  [[ land_monthly ]]
  frequency = "monthly"
  input_files = "elm.h0"
  input_subdir = "archive/lnd/hist"
  vars = "LAISHA,LAISUN"

  [[ atm_monthly_180x360_aave ]]
  frequency = "monthly"
  input_files = "eam.h0"
  input_subdir = "archive/atm/hist"
  vars = "PRECC,PRECL"

[ilamb_run]
active = True
short_name = '20210122.v2_test01'
ts_num_years = 10
years = "1:10:10",

  [[ land_monthly ]]

That causes Errors occurred in the run, please consult ./_build/ILAMB01.log for more detailed information.

The unit tests need to be updated as do the expected files for the integration tests. test_complete_run has an error rather than a failure:
FileNotFoundError: [Errno 2] No such file or directory: '/lcrc/group/e3sm/public_html/diagnostic_output/ac.forsyth2/zppy_test_complete_run_www/v2.LR.historical_0201/e3sm_diags/atm_monthly_180x360_aave/model_vs_obs_1850-1853/viewer/viewer/e3sm_logo.png'

@forsyth2
Copy link
Collaborator

@chengzhuzhang Since this branch is off the main repo rather than a fork, I think it should be easy for me to push further changes to it. Would you like me to make the fixes I suggested?

@chengzhuzhang
Copy link
Collaborator Author

@chengzhuzhang Since this branch is off the main repo rather than a fork, I think it should be easy for me to push further changes to it. Would you like me to make the fixes I suggested?

Yes, please! I'm also not familiar with zppy's tests, please go ahead and make the fixes for me. Thank you!

@forsyth2 forsyth2 mentioned this pull request Mar 28, 2022
@forsyth2
Copy link
Collaborator

@chengzhuzhang Do you know why I got Errors occurred in the run, please consult ./_build/ILAMB01.log for more detailed information? Is there something I need to change in the config file? I see a lot of ILAMB.ilamblib.VarNotInModel: VarNotInModel in that log file.

@chengzhuzhang
Copy link
Collaborator Author

chengzhuzhang commented Mar 28, 2022

Those are ilamb error logs tell that some expected variables are not located. The tested configuration only included a minimal sets variables. So 'ILAMB.ilamblib.VarNotInModel: VarNotInModel' is expected. did your run actually create a index.html with some results?

@forsyth2
Copy link
Collaborator

did your run actually create a index.html with some results?

Ah ok. I moved my results to https://web.lcrc.anl.gov/public/e3sm/diagnostic_output/ac.forsyth2/zppy_development/pr_197/_build/. Most of it is missing data except for some leaf-area-index values, which matches the variables given, so I think that works then.

@chengzhuzhang chengzhuzhang changed the title Adding ilamb_run task ILAMB task Mar 29, 2022
@forsyth2
Copy link
Collaborator

forsyth2 commented Apr 6, 2022

Closed with #230.

@forsyth2 forsyth2 closed this Apr 6, 2022
@forsyth2 forsyth2 deleted the e3sm2cmip_ilamb branch May 11, 2022 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver: new feature New feature (will increment minor version)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add task for e3sm_to_cmip
2 participants