Closed tomvothecoder closed 11 months ago
Hey @chengzhuzhang, this PR is ready for review. It was a trivial one-line fix.
Hi Tom, thank you for getting to this so quickly. I was testing this branch (bug/227-missing-bnds) on some new tri-grid datasets, but ran into an environment problem. I fetched the bug/227-missing-bnds branch. And ran following:
cd e3sm_to_cmip conda env create -f conda-env/dev.yml conda activate e3sm_to_cmip_dev pip install .
However it looks like e3sm_to_cmip is still looking for some old source codes, below is what I got:
(e3sm_to_cmip_dev) [ac.zhang40@chrlogin1 e3sm_to_cmip]$ !e3sm_to
e3sm_to_cmip --output-path . --var-list lai --realm lnd --input-path /lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/ --user-metadata /lcrc/group/e3sm/public_html/diagnostics/e3sm_to_cmip_data/user_metadata.json --tables-path /lcrc/group/e3sm/diagnostics/cmip6-cmor-tables/Tables
2023-11-28 00:18:09,692 [INFO]: __main__.py(__init__:142) >> --------------------------------------
2023-11-28 00:18:09,692 [INFO]: __main__.py(__init__:142) >> --------------------------------------
2023-11-28 00:18:09,692_692:INFO:__init__:--------------------------------------
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:143) >> | E3SM to CMIP Configuration
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:143) >> | E3SM to CMIP Configuration
2023-11-28 00:18:09,693_693:INFO:__init__:| E3SM to CMIP Configuration
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:144) >> --------------------------------------
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:144) >> --------------------------------------
2023-11-28 00:18:09,693_693:INFO:__init__:--------------------------------------
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:145) >> * var_list='['lai']'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:145) >> * var_list='['lai']'
2023-11-28 00:18:09,693_693:INFO:__init__: * var_list='['lai']'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:146) >> * input_path='/lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:146) >> * input_path='/lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/'
2023-11-28 00:18:09,693_693:INFO:__init__: * input_path='/lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:147) >> * output_path='.'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:147) >> * output_path='.'
2023-11-28 00:18:09,693_693:INFO:__init__: * output_path='.'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:148) >> * precheck_path='None'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:148) >> * precheck_path='None'
2023-11-28 00:18:09,693_693:INFO:__init__: * precheck_path='None'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:149) >> * freq='mon'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:149) >> * freq='mon'
2023-11-28 00:18:09,693_693:INFO:__init__: * freq='mon'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:150) >> * realm='lnd'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:150) >> * realm='lnd'
2023-11-28 00:18:09,693_693:INFO:__init__: * realm='lnd'
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:151) >> * Writing log output file to: logs/20231128_001809_690069
2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:151) >> * Writing log output file to: logs/20231128_001809_690069
2023-11-28 00:18:09,693_693:INFO:__init__: * Writing log output file to: logs/20231128_001809_690069
The pfull variable handler requires both cdms2 and cdutil
Traceback (most recent call last):
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/bin/e3sm_to_cmip", line 8, in <module>
sys.exit(main())
^^^^^^
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/__main__.py", line 945, in main
app = E3SMtoCMIP(args)
^^^^^^^^^^^^^^^^
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/__main__.py", line 153, in __init__
self.handlers = self._get_handlers()
^^^^^^^^^^^^^^^^^^^^
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/__main__.py", line 208, in _get_handlers
handlers = derive_handlers(
^^^^^^^^^^^^^^^^
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/utils.py", line 178, in derive_handlers
handlers_by_var: Dict[str, List[Dict[str, Any]]] = _get_handlers_by_var()
^^^^^^^^^^^^^^^^^^^^^^
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/utils.py", line 271, in _get_handlers_by_var
handlers_from_modules = _get_handlers_from_modules(LEGACY_HANDLER_DIR_PATH)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/utils.py", line 367, in _get_handlers_from_modules
module = imp.load_source(var, filepath)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/imp.py", line 172, in load_source
module = _load(spec)
^^^^^^^^^^^
File "<frozen importlib._bootstrap>", line 721, in _load
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/vars/pfull.py", line 20, in <module>
raise e
File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/vars/pfull.py", line 16, in <module>
import cdms2
ModuleNotFoundError: No module named 'cdms2'
I tried a second time to install from fresh, get the same error. Any insights? Thank you.
Hi Tom, thank you for getting to this so quickly. I was testing this branch (bug/227-missing-bnds) on some new tri-grid datasets, but ran into an environment problem. I fetched the bug/227-missing-bnds branch. And ran following:
cd e3sm_to_cmip conda env create -f conda-env/dev.yml conda activate e3sm_to_cmip_dev pip install .
However it looks like e3sm_to_cmip is still looking for some old source codes, below is what I got:
(e3sm_to_cmip_dev) [ac.zhang40@chrlogin1 e3sm_to_cmip]$ !e3sm_to e3sm_to_cmip --output-path . --var-list lai --realm lnd --input-path /lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/ --user-metadata /lcrc/group/e3sm/public_html/diagnostics/e3sm_to_cmip_data/user_metadata.json --tables-path /lcrc/group/e3sm/diagnostics/cmip6-cmor-tables/Tables 2023-11-28 00:18:09,692 [INFO]: __main__.py(__init__:142) >> -------------------------------------- 2023-11-28 00:18:09,692 [INFO]: __main__.py(__init__:142) >> -------------------------------------- 2023-11-28 00:18:09,692_692:INFO:__init__:-------------------------------------- 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:143) >> | E3SM to CMIP Configuration 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:143) >> | E3SM to CMIP Configuration 2023-11-28 00:18:09,693_693:INFO:__init__:| E3SM to CMIP Configuration 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:144) >> -------------------------------------- 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:144) >> -------------------------------------- 2023-11-28 00:18:09,693_693:INFO:__init__:-------------------------------------- 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:145) >> * var_list='['lai']' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:145) >> * var_list='['lai']' 2023-11-28 00:18:09,693_693:INFO:__init__: * var_list='['lai']' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:146) >> * input_path='/lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:146) >> * input_path='/lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/' 2023-11-28 00:18:09,693_693:INFO:__init__: * input_path='/lcrc/group/e3sm/ac.zhang40/tests/20231012.v3alpha04_trigrid_bgc.piControl.chrysalis/post/lnd/native/ts/monthly/50yr/' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:147) >> * output_path='.' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:147) >> * output_path='.' 2023-11-28 00:18:09,693_693:INFO:__init__: * output_path='.' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:148) >> * precheck_path='None' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:148) >> * precheck_path='None' 2023-11-28 00:18:09,693_693:INFO:__init__: * precheck_path='None' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:149) >> * freq='mon' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:149) >> * freq='mon' 2023-11-28 00:18:09,693_693:INFO:__init__: * freq='mon' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:150) >> * realm='lnd' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:150) >> * realm='lnd' 2023-11-28 00:18:09,693_693:INFO:__init__: * realm='lnd' 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:151) >> * Writing log output file to: logs/20231128_001809_690069 2023-11-28 00:18:09,693 [INFO]: __main__.py(__init__:151) >> * Writing log output file to: logs/20231128_001809_690069 2023-11-28 00:18:09,693_693:INFO:__init__: * Writing log output file to: logs/20231128_001809_690069 The pfull variable handler requires both cdms2 and cdutil Traceback (most recent call last): File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/bin/e3sm_to_cmip", line 8, in <module> sys.exit(main()) ^^^^^^ File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/__main__.py", line 945, in main app = E3SMtoCMIP(args) ^^^^^^^^^^^^^^^^ File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/__main__.py", line 153, in __init__ self.handlers = self._get_handlers() ^^^^^^^^^^^^^^^^^^^^ File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/__main__.py", line 208, in _get_handlers handlers = derive_handlers( ^^^^^^^^^^^^^^^^ File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/utils.py", line 178, in derive_handlers handlers_by_var: Dict[str, List[Dict[str, Any]]] = _get_handlers_by_var() ^^^^^^^^^^^^^^^^^^^^^^ File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/utils.py", line 271, in _get_handlers_by_var handlers_from_modules = _get_handlers_from_modules(LEGACY_HANDLER_DIR_PATH) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/utils.py", line 367, in _get_handlers_from_modules module = imp.load_source(var, filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/imp.py", line 172, in load_source module = _load(spec) ^^^^^^^^^^^ File "<frozen importlib._bootstrap>", line 721, in _load File "<frozen importlib._bootstrap>", line 690, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 940, in exec_module File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/vars/pfull.py", line 20, in <module> raise e File "/home/ac.zhang40/y/envs/e3sm_to_cmip_dev/lib/python3.11/site-packages/e3sm_to_cmip/cmor_handlers/vars/pfull.py", line 16, in <module> import cdms2 ModuleNotFoundError: No module named 'cdms2'
I tried a second time to install from fresh, get the same error. Any insights? Thank you.
Running python -m pip install .
will generate /build
directory that sometimes doesn't get updated with future calls of the same command even though there are new changes to the code.
I added a Makefile with convenient commands. Can you run make install
in the root of your repository? This will delete all old build files, cache, etc. before installing the branch version of the package into your env.
@tomvothecoder make install
works for me. Thank you. This Makefile addition is very handy for developers. The test ran successfully with native r05 output from tri-grid.
Just one detail, it looks like the double logging messages occurs, same as in e3sm_diags. Not sure what change caused this..
@tomvothecoder
make install
works for me. Thank you. This Makefile addition is very handy for developers. The test ran successfully with native r05 output from tri-grid. Just one detail, it looks like the double logging messages occurs, same as in e3sm_diags. Not sure what change caused this..
Glad to hear it is working. I'll advertise theMakefile
in a future EZ meeting.
I noticed this repeated logging started happening recently. I'll need to investigate why this is happening in separate PRs for each repo.
I think the PR is ready to go. Just one clarification question, for datasets already have lat lon bounds. Does xcdat add_bounds do anything?
xCDAT will ignore adding bounds for an axis if it already exists.
Also we perhaps need to file a separate issue for the doubled logging messages...
https://github.com/E3SM-Project/e3sm_to_cmip/issues/229 https://github.com/E3SM-Project/e3sm_diags/issues/762
Description
This PR updates the
VarHandler._get_mfdataset()
to use xCDAT to open the input datasets and adds bounds for lat and lon if they are missing.Minimum Reproducible Script
Log Output (Success)
Checklist
If applicable: