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

Add example script #174

Merged
merged 11 commits into from
Jan 3, 2023
Merged

Add example script #174

merged 11 commits into from
Jan 3, 2023

Conversation

chengzhuzhang
Copy link
Collaborator

@chengzhuzhang chengzhuzhang commented Dec 2, 2022

Provide an end-to-end example script that is independent from CWL workflows.
This script serves for a few purpose:

  • establish the data and script required by integration tests.
  • provide necessary commands for interfacing with zppy, with the hope that zppy can create and archive intermediate files required as e3sm_to_cmip input.

TO DO:

  • construct unified data directory in coordinate with @tomvothecoder 's refactoring effort. 9b5ed23
  • document input data requirement for running e3sm_to_cmip. e331b55

@codecov
Copy link

codecov bot commented Dec 2, 2022

Codecov Report

Base: 28.98% // Head: 28.98% // No change to project coverage 👍

Coverage data is based on head (04ee5b0) compared to base (e95a74b).
Patch has no changes to coverable lines.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #174   +/-   ##
=======================================
  Coverage   28.98%   28.98%           
=======================================
  Files          93       93           
  Lines        3981     3981           
=======================================
  Hits         1154     1154           
  Misses       2827     2827           

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@tomvothecoder
Copy link
Collaborator

This is much needed because we should test changes/debug directly through e3sm_to_cmip rather than the CWL workflows.

@chengzhuzhang chengzhuzhang marked this pull request as ready for review December 20, 2022 02:00
e3sm_to_cmip -i ${rgr_dir} -o $result_dir -v ${cmip_var_list} -t --tables-path ${e2c_path}/cmor/cmip6-cmor-tables/Tables -u ${metadata_path}

# CMORIZE Sea-ice Monthly variables
# Note the input folder for mpas sea ice files requires:
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@xylar I started to understand the e2c better. would you help review if the following is accurate? Could you let me know the Constants that are required from mpaso_in.

Copy link
Contributor

Choose a reason for hiding this comment

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

At present, the sea-ice handlers never use constants from the mpassi_in namelist (note: they would not use mpaso_in as you suggested above). Presumably, the option was implemented in case they ever would need these constants as MPAS-Ocean does.

e3sm_to_cmip -s --realm SImon --var-list siconc, sitemptop, sisnmass, sitimefrac, siu, siv, sithick, sisnthick, simass --map ${e2c_path}/maps/map_EC30to60E2r2_to_cmip6_180x360_aave.20220301.nc --input-path ${model_data}/v2.mpassi_input/ --output-path ${result_dir} --user-metadata ${metadata_path} --tables-path ${e2c_path}/cmor/cmip6-cmor-tables/Tables


# CMORIZE Ocean Monthly variables
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@xylar Same here, would you also look at this session for MPAS ocean processing input requirement?

Copy link
Contributor

Choose a reason for hiding this comment

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

The only constant needed from mpaso_in is config_density0:

$ cd e3sm_to_cmip/cmor_handlers
$ grep -r "namelist\["
hfsifrazil.py:    config_density0 = float(namelist['config_density0'])
hfsifrazil.py:        float(namelist['config_frazil_heat_of_fusion'])
msftmz.py:    config_density0 = float(namelist['config_density0'])
pbo.py:    config_density0 = float(namelist['config_density0'])
masso.py:    config_density0 = float(namelist['config_density0'])
pso.py:    config_density0 = float(namelist['config_density0'])
masscello.py:    config_density0 = float(namelist['config_density0'])

This is the reference density of the ocean, used to convert from volume to mass.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it looks like hfsifrazil requires both 'config_density0' and 'config_frazil_heat_of_fusion'.

@chengzhuzhang
Copy link
Collaborator Author

@tomvothecoder Hi I think this PR should be ready to go after we get some additional input from Xylar. I think we can either setting up the integration on acme1 or lcrc.

@tomvothecoder
Copy link
Collaborator

Sounds good @chengzhuzhang. Thanks!

@chengzhuzhang
Copy link
Collaborator Author

@xylar Hey Xylar, I updated the comment to provide needed constants from the mpaso namelist file. Please help review and let me know if anything that I missed...Thank you.

Copy link
Contributor

@xylar xylar left a comment

Choose a reason for hiding this comment

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

Looks good. A few small suggestions and answers to your questions.

scripts/example_end-to-end_script.sh Outdated Show resolved Hide resolved
scripts/example_end-to-end_script.sh Outdated Show resolved Hide resolved
scripts/example_end-to-end_script.sh Outdated Show resolved Hide resolved
scripts/example_end-to-end_script.sh Outdated Show resolved Hide resolved
# 4. A region masks file for MOC regions: EC30to60E2r2_mocBasinsAndTransects20210623.nc (Needed for variable msftmz: Ocean Meridional Overturning Mass Streamfunction)
e3sm_to_cmip -s --realm Omon --var-list areacello, fsitherm, hfds, masso, mlotst, sfdsi, sob, soga, sos, sosga, tauuo, tauvo, thetaoga, tob, tos, tosga, volo, wfo, zos, thetaoga, hfsifrazil, masscello, so, thetao, thkcello, uo, vo, volcello, wo zhalfo --map ${e2c_path}/maps/map_EC30to60E2r2_to_cmip6_180x360_aave.20220301.nc --input-path ${model_data}/v2.mpaso_input/ --output-path ${result_dir} --user-metadata ${metadata_path} --tables-path ${e2c_path}/cmor/cmip6-cmor-tables/Tables

exit
Copy link
Contributor

Choose a reason for hiding this comment

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

(not needed)

e3sm_to_cmip -i ${rgr_dir} -o $result_dir -v ${cmip_var_list} -t --tables-path ${e2c_path}/cmor/cmip6-cmor-tables/Tables -u ${metadata_path}

# CMORIZE Sea-ice Monthly variables
# Note the input folder for mpas sea ice files requires:
Copy link
Contributor

Choose a reason for hiding this comment

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

At present, the sea-ice handlers never use constants from the mpassi_in namelist (note: they would not use mpaso_in as you suggested above). Presumably, the option was implemented in case they ever would need these constants as MPAS-Ocean does.

e3sm_to_cmip -s --realm SImon --var-list siconc, sitemptop, sisnmass, sitimefrac, siu, siv, sithick, sisnthick, simass --map ${e2c_path}/maps/map_EC30to60E2r2_to_cmip6_180x360_aave.20220301.nc --input-path ${model_data}/v2.mpassi_input/ --output-path ${result_dir} --user-metadata ${metadata_path} --tables-path ${e2c_path}/cmor/cmip6-cmor-tables/Tables


# CMORIZE Ocean Monthly variables
Copy link
Contributor

Choose a reason for hiding this comment

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

The only constant needed from mpaso_in is config_density0:

$ cd e3sm_to_cmip/cmor_handlers
$ grep -r "namelist\["
hfsifrazil.py:    config_density0 = float(namelist['config_density0'])
hfsifrazil.py:        float(namelist['config_frazil_heat_of_fusion'])
msftmz.py:    config_density0 = float(namelist['config_density0'])
pbo.py:    config_density0 = float(namelist['config_density0'])
masso.py:    config_density0 = float(namelist['config_density0'])
pso.py:    config_density0 = float(namelist['config_density0'])
masscello.py:    config_density0 = float(namelist['config_density0'])

This is the reference density of the ocean, used to convert from volume to mass.

chengzhuzhang and others added 5 commits January 3, 2023 11:39
Co-authored-by: Xylar Asay-Davis <xylarstorm@gmail.com>
Co-authored-by: Xylar Asay-Davis <xylarstorm@gmail.com>
Co-authored-by: Xylar Asay-Davis <xylarstorm@gmail.com>
Co-authored-by: Xylar Asay-Davis <xylarstorm@gmail.com>
@chengzhuzhang chengzhuzhang merged commit 431638f into master Jan 3, 2023
@tomvothecoder
Copy link
Collaborator

tomvothecoder commented Jan 30, 2023

Hey @chengzhuzhang, I just got back to working on #103 and am leveraging this script to generate CMORized data.

I am currently experimenting with the different blocks of code in the example script to generate each set of CMORized data.
In the meantime, can you provide a step-by-step on how to use this script to streamline the process? It would be useful to have in our documentation for future reference. Thanks!

@chengzhuzhang
Copy link
Collaborator Author

Hi @tomvothecoder thanks for resuming work #103, and let me know if there is any difficulty in testing the example script.
I agree it will be helpful to have a step-by-step guide. The limitation of this script right now is that it is designed for testing purpose, it works on a set of prepared directories with required data already staged. And in a real use-case, an extra step is needed to move/create symlinks for needed data with specified time period. I will try to generate that and include in our documentation.

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.

3 participants