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

cmor tool improvements #205

Open
wants to merge 27 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
944eb07
fix datetime array built from files targeted
ilaflott Oct 11, 2024
c69b307
refactor filename loop/routines in cmor_mixer a little bit. slightly …
ilaflott Oct 16, 2024
d6fce9c
angling to modularize the success check in test_cmor_run_subtool. in …
ilaflott Oct 18, 2024
0926ccd
new test cases, another test text file
ilaflott Oct 18, 2024
797417a
adjust pylint calls to be a little more kind on the max number of arg…
ilaflott Oct 18, 2024
52b6729
updates to variable names and some print statements. argument names,…
ilaflott Oct 18, 2024
ebebae9
fix readme to display content as markdown correctly.
ilaflott Oct 21, 2024
5cfdcd3
tweak readme to display markdown correctly. cmor mixer refactorings i…
ilaflott Oct 21, 2024
e9b73d7
Merge branch 'main' into 204-improve-fre-cmor-run-functionality
ilaflott Oct 22, 2024
933dd6b
more detailed doc strings iwth argument descriptions
ilaflott Oct 22, 2024
55f6137
more detailed doc strings iwth argument descriptions
ilaflott Oct 22, 2024
b2c3d89
adjust click-based call to _cmor_run_subtool entrypoint function. kee…
ilaflott Oct 22, 2024
e00e90c
adjust cli test calls, in particular the full_outputdir. put comment …
ilaflott Oct 22, 2024
242f13a
make case2 checks as detailed. clean up best i can (nfs mount error w…
ilaflott Oct 22, 2024
9bde9cd
some whitespace changes. different way of opening files so they close…
ilaflott Oct 22, 2024
4478d51
pylint feedback
ilaflott Oct 22, 2024
6c75e95
if i write the doc other people will maybe run it and then maybe they…
ilaflott Oct 22, 2024
0eb9d7a
la little more doc into the fre/cmor/README.md. working example call …
ilaflott Oct 23, 2024
75e9054
markdown treatment of command examples/output/surrounding discussion …
ilaflott Oct 23, 2024
78148ff
indentation of commands changed slightly
ilaflott Oct 23, 2024
644b431
language tweak
ilaflott Oct 23, 2024
5c6d3c7
whitespace/indentation
ilaflott Oct 23, 2024
c0a4098
whitespace/indentation
ilaflott Oct 23, 2024
0c04d79
cleanup from self review feedback
ilaflott Oct 23, 2024
78997f6
cleanup self-feedback
ilaflott Oct 23, 2024
6ae3507
remove oldoldold details
ilaflott Oct 23, 2024
f190f50
some last clean up and pylint feedback
ilaflott Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/create_test_conda_env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ jobs:
python --version
$CONDA/envs/fre-cli/bin/python --version
# run pylint
pylint -ry --ignored-modules netCDF4 fre/ || echo "pylint returned non-zero exit code. preventing workflow from dying with this echo."
# run pylint, ignored modules avoid warnings arising from code internal to those modules
pylint --max-args 6 -ry --ignored-modules netCDF4,cmor fre/ || echo "pylint returned non-zero exit code. preventing workflow from dying with this echo."
ilaflott marked this conversation as resolved.
Show resolved Hide resolved
- name: Install Sphinx and Build Documentation
run: |
Expand Down
164 changes: 88 additions & 76 deletions fre/cmor/README.md
Original file line number Diff line number Diff line change
@@ -1,83 +1,95 @@
old usage notes at the top of `cmor_mixer.py`
old usage notes at the top of `cmor_mixer.py`, re-rigged for markdown and CMIP7.

new readme instructions iwll replace these.
ilaflott marked this conversation as resolved.
Show resolved Hide resolved


```
# Before start this script in common way run these 2 command in terminal where you are going to execute this script:
# module load python/3.9
# conda activate cmor
> module load python/3.9
> conda activate cmor
ilaflott marked this conversation as resolved.
Show resolved Hide resolved

# another possible runs without any preparation in terminal:
# /home/san/anaconda/envs/cmor_dev/bin/python
# /app/spack/v0.15/linux-rhel7-x86_64/gcc-4.8.5/python/3.7.7-d6cyi6ophaei6arnmzya2kn6yumye2yl/bin/python
> /home/san/anaconda/envs/cmor_dev/bin/python
> /app/spack/v0.15/linux-rhel7-x86_64/gcc-4.8.5/python/3.7.7-d6cyi6ophaei6arnmzya2kn6yumye2yl/bin/python


# How to run it (simple examples):
# ~/fms_yaml_tools/CMOR_3/cmor_mixer.py
# -d /archive/oar.gfdl.cmip6/CM4/warsaw_201710_om4_v1.0.1/CM4_1pctCO2_C/gfdl.ncrc4-intel16-prod-openmp/pp/atmos/ts/monthly/5yr
# -l /home/san/CMOR_3/GFDL-CM4_1pctCO2_C_CMOR-Amon.lst
# -r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_Amon.json
# -p /home/san/CMOR/cmor/Test/CMOR_input_CM4_1pctCO2_C.json

# ~/fms_yaml_tools/cmor_mixer.py
# -d /archive/Fabien.Paulot/ESM4/H2/ESM4_amip_D1_soilC_adj/gfdl.ncrc3-intel16-prod-openmp/pp/land/ts/monthly/5yr
# -l /home/san/CMOR_3/GFDL-ESM4_amip_CMOR-landCML.lst
# -r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_Lmon.json
# -p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_amip.json

# ~/fms_yaml_tools/cmor_mixer.py
# -d /archive/oar.gfdl.cmip6/CM4/warsaw_201710_om4_v1.0.1/CM4_historical/gfdl.ncrc4-intel16-prod-openmp/pp/atmos/ts/monthly/5yr
# -l /home/san/CMOR_3/GFDL-CM4_historical_CMOR-Amon.lst
# -r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/Atmos_Monthly.json
# -p /home/san/CMOR/cmor/Test/CMOR_input_CM4_historical.json

# ~/fms_yaml_tools/cmor_mixer.py
# -d /archive/oar.gfdl.cmip6/ESM4/DECK/ESM4_historical_D1/gfdl.ncrc4-intel16-prod-openmp/pp/atmos_cmip/ts/daily/5yr
# -l /home/san/CMOR_3/GFDL-ESM4_CMOR-day_historical.lst
# -r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_day.json
# -p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_historical.json
# -o /net2/san

# ~/fms_yaml_tools/cmor_mixer.py
# -d /archive/oar.gfdl.cmip6/ESM4/DECK/ESM4_historical_D1/gfdl.ncrc4-intel16-prod-openmp/pp/atmos/ts/6hr/5yr
# -l /home/san/CMOR_3/GFDL-ESM4_CMOR-6hr.lst
# -r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_6hrPlev.json
# -p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_historical.json

# ~/fms_yaml_tools/cmor_mixer.py
# -d /archive/oar.gfdl.cmip6/ESM4/DECK/ESM4_historical_D1/gfdl.ncrc4-intel16-prod-openmp/pp/atmos_cmip/ts/3hr/5yr
# -l /home/san/CMOR_3/GFDL_ESM4_historical_CMOR-3hr.lst
# -r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_3hr.json
# -p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_historical.json
# -o /net2/san

# Additional tables containing in /home/san/CMIP6_work/cmor/cmip6-cmor-tables/Tables:
# CMIP6_CV.json
# CMIP6_formula_terms.json
# CMIP6_grids.json
# CMIP6_coordinate.json

# Detailed description of program is placed at
# https://docs.google.com/document/d/1HPetcUyrVXDwCBIyWheZ_2JzOz7ZHi1y3vmIlcErYeA/edit?pli=1

# Keep in mind rule for input ../cmor/cmip6-cmor-tables/Tables/*.json:
# output variables can not contain "_" in out_name, though name (and standard_name) itself can have it; example:
# "alb_sfc": {
# "frequency": "mon",
# "modeling_realm": "atmos",
# "standard_name": "alb_sfc",
# "units": "percent",
# "cell_methods": "area: time: mean",
# "long_name": "surface albedo",
# "comment": "",
# "dimensions": "longitude latitude time",
# "out_name": "albsfc",
# "type": "real",
# "positive": "",
# "valid_min": "",
# "valid_max": "",
# "ok_min_mean_abs": "",
# "ok_max_mean_abs": ""
# }

# Problems with standard CMOR library:
# - monthly variable "enth_conv_col" produces error - CMOR expects 4 dimensions but it has only 3;
# - variable /archive/oar.gfdl.cmip6/CM4/warsaw_201710_om4_v1.0.1/CM4_historical/gfdl.ncrc4-intel16-prod-openmp/pp/atmos_cmip/ts/3hr/5yr/atmos_cmip.1965010100-1969123123.clt.nc
# is not readable.
> cmor_mixer.py
-d /archive/oar.gfdl.cmip6/CM4/warsaw_201710_om4_v1.0.1/CM4_1pctCO2_C/gfdl.ncrc4-intel16-prod-openmp/pp/atmos/ts/monthly/5yr
-l /home/san/CMOR_3/GFDL-CM4_1pctCO2_C_CMOR-Amon.lst
-r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_Amon.json
-p /home/san/CMOR/cmor/Test/CMOR_input_CM4_1pctCO2_C.json

> cmor_mixer.py
-d /archive/Fabien.Paulot/ESM4/H2/ESM4_amip_D1_soilC_adj/gfdl.ncrc3-intel16-prod-openmp/pp/land/ts/monthly/5yr
-l /home/san/CMOR_3/GFDL-ESM4_amip_CMOR-landCML.lst
-r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_Lmon.json
-p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_amip.json

> cmor_mixer.py
-d /archive/oar.gfdl.cmip6/CM4/warsaw_201710_om4_v1.0.1/CM4_historical/gfdl.ncrc4-intel16-prod-openmp/pp/atmos/ts/monthly/5yr
-l /home/san/CMOR_3/GFDL-CM4_historical_CMOR-Amon.lst
-r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/Atmos_Monthly.json
-p /home/san/CMOR/cmor/Test/CMOR_input_CM4_historical.json

> cmor_mixer.py
-d /archive/oar.gfdl.cmip6/ESM4/DECK/ESM4_historical_D1/gfdl.ncrc4-intel16-prod-openmp/pp/atmos_cmip/ts/daily/5yr
-l /home/san/CMOR_3/GFDL-ESM4_CMOR-day_historical.lst
-r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_day.json
-p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_historical.json
-o /net2/san

> cmor_mixer.py
-d /archive/oar.gfdl.cmip6/ESM4/DECK/ESM4_historical_D1/gfdl.ncrc4-intel16-prod-openmp/pp/atmos/ts/6hr/5yr
-l /home/san/CMOR_3/GFDL-ESM4_CMOR-6hr.lst
-r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_6hrPlev.json
-p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_historical.json

> cmor_mixer.py
-d /archive/oar.gfdl.cmip6/ESM4/DECK/ESM4_historical_D1/gfdl.ncrc4-intel16-prod-openmp/pp/atmos_cmip/ts/3hr/5yr
-l /home/san/CMOR_3/GFDL_ESM4_historical_CMOR-3hr.lst
-r /home/san/CMOR/cmor/cmip6-cmor-tables/Tables/CMIP6_3hr.json
-p /home/san/CMOR/cmor/Test/CMOR_input_ESM4_historical.json
-o /net2/san

# Find additional tables:
> ls cmip6-cmor-tables/Tables
...
CMIP6_CV.json
CMIP6_formula_terms.json
CMIP6_grids.json
CMIP6_coordinate.json
...
```

Detailed description of program is placed at https://docs.google.com/document/d/1HPetcUyrVXDwCBIyWheZ_2JzOz7ZHi1y3vmIlcErYeA/edit?pli=1
ilaflott marked this conversation as resolved.
Show resolved Hide resolved


#-- Problems with standard CMOR library OLD
- monthly variable `enth_conv_col` produces error - CMOR expects 4 dimensions but it has only 3;
- variable `/archive/oar.gfdl.cmip6/CM4/warsaw_201710_om4_v1.0.1/CM4_historical/gfdl.ncrc4-intel16-prod-openmp/pp/atmos_cmip/ts/3hr/5yr/atmos_cmip.1965010100-1969123123.clt.nc`
is not readable.


#-- Rule for table input
For files in, `../cmor/cmip6-cmor-tables/Tables/*.json`, output variables can not contain `_` in `out_name`, though `name`/`standard_name` can. For example...
```
"alb_sfc": {
"frequency": "mon",
"modeling_realm": "atmos",
"standard_name": "alb_sfc",
"units": "percent",
"cell_methods": "area: time: mean",
"long_name": "surface albedo",
"comment": "",
"dimensions": "longitude latitude time",
"out_name": "albsfc",
"type": "real",
"positive": "",
"valid_min": "",
"valid_max": "",
"ok_min_mean_abs": "",
"ok_max_mean_abs": ""
}
```

Loading