NOAA-GFDL / MDTF-diagnostics

Analysis framework and collection of process-oriented diagnostics for weather and climate simulations
https://mdtf-diagnostics.readthedocs.io/en/main/
Other
56 stars 95 forks source link

Catalog Builder Tool -'src' not found #562

Closed nishsilva closed 2 months ago

nishsilva commented 2 months ago

I am trying to use the catalog builder tool in the MDTF framework to generate a data catalog for a 4th generation POD. When I run the tool following the instructions it returns aModuleNotFoundErrorindicating that 'src' module is not available.

I confirmed that the directory have the expected structure to call 'src'.

Could someone take a look into this?

Thanks, Nish

> (_MDTF_base) netige@crhtc53:/glade/work/netige/mdtf_Apr24_2/mdtf/MDTF-diagnostics/tools/catalog_builder> python3 catalog_builder.py --config zos_builder_config.yml
> Traceback (most recent call last):
>   File "/glade/work/netige/mdtf_Apr24_2/mdtf/MDTF-diagnostics/tools/catalog_builder/catalog_builder.py", line 25, in <module>
>     from src.util import json_utils, basic
> ModuleNotFoundError: No module named 'src' 
wrongkindofdoctor commented 2 months ago

@nishsilva The import issue should be fixed. Please merge the main branch updates into your fork and try the catalog builder again.

nishsilva commented 2 months ago

@wrongkindofdoctor I updated the fork and tried the catalog builder after pulling the updates. But the issue still exists for me.


> (_MDTF_base) netige@crhtc53:/glade/work/netige/mdtf_Apr24_2/mdtf/MDTF-diagnostics/tools/catalog_builder> python3 catalog_builder.py --config /glade/work/netige/mdtf_Apr24_2/data_catalogs/zos_builder_config.yml 
> Traceback (most recent call last):
>   File "/glade/work/netige/mdtf_Apr24_2/mdtf/MDTF-diagnostics/tools/catalog_builder/catalog_builder.py", line 34, in <module>
>     from src import util
> ModuleNotFoundError: No module named 'src'
wrongkindofdoctor commented 2 months ago

@nishsilva As a workaround, try commenting out the import line, and the following code block (lines 127--137):

        try:
            json_config = util.json_utils.read_json(gfdl_fieldlist, log=_log)
        except IOError:
            print("Unable to open file", gfdl_fieldlist)
            sys.exit(1)
        gfdl_info = util.basic.NameSpace.fromDict(json_config)

        if hasattr(gfdl_info.variables, variable_id):
            var_metadata = gfdl_info.variables.get(variable_id)
        else:
            raise KeyError(f'{variable_id} not found in {gfdl_fieldlist}')

Only the GFDL builder needs the util modules, so you should be okay if you are creating a CMIP or CESM dataset.

nishsilva commented 2 months ago

@wrongkindofdoctor Thank you for this, Jess. This worked out! Closing the issue.