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

cannot use pangu-gfs-input.py output with newer versions of climetlab #3

Open
djzurawski opened this issue Oct 8, 2023 · 2 comments

Comments

@djzurawski
Copy link

After running a git bisect I found grib files generated with pangu-gfs-input.py cannot be used as an input file to ai-models using climetlab at the commit below.

ecmwf/climetlab@a4db948

@djzurawski djzurawski changed the title pangu-gfs-input.py breaks with newer versions of climetlab cannot use pangu-gfs-input.py output with newer versions of climetlab Oct 8, 2023
@3atshan
Copy link

3atshan commented Jan 10, 2024

Hi any update on this? I am running through the same issue - basically after generating a file with pangu-gfs-input.py, and then run ai-models --file notebooks/gfs.grib panguweather I get the error:

Traceback (most recent call last):
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/bin/ai-models", line 8, in <module>
    sys.exit(main())
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/ai_models/__main__.py", line 297, in main
    _main()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/ai_models/__main__.py", line 270, in _main
    model.run()
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/ai_models_panguweather/model.py", line 43, in run
    fields_pl = self.fields_pl
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/ai_models/model.py", line 105, in fields_pl
    return self.input.fields_pl
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/functools.py", line 981, in __get__
    val = self.func(instance)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/ai_models/inputs/__init__.py", line 150, in fields_pl
    return self.all_fields.sel(levtype="pl")
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/index.py", line 188, in sel
    return self.new_mask_index(self, indices)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/readers/grib/index/__init__.py", line 46, in new_mask_index
    return MaskFieldSet(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/__init__.py", line 25, in __call__
    obj.__init__(*args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/readers/grib/index/__init__.py", line 156, in __init__
    MaskIndex.__init__(self, *args, **kwargs)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/index.py", line 262, in __init__
    self.indices = list(indices)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/index.py", line 185, in <genexpr>
    i for i, element in enumerate(self) if selection.match_element(element)
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/index.py", line 69, in match_element
    return all(v(metadata(k)) for k, v in self.actions.items())
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/index.py", line 69, in <genexpr>
    return all(v(metadata(k)) for k, v in self.actions.items())
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/index.py", line 46, in __call__
    self.lst = [cast(y) for y in self.lst]
  File "/opt/homebrew/Caskroom/miniconda/base/envs/ai-models/lib/python3.10/site-packages/climetlab/core/index.py", line 46, in <listcomp>
    self.lst = [cast(y) for y in self.lst]
ValueError: invalid literal for int() with base 10: 'pl'

For reference I am using Python 3.10 and I am on the latest versions of climetlab and ai-models

@kam3545
Copy link

kam3545 commented Jun 17, 2024

I am also facing same issue

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

No branches or pull requests

3 participants