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

Dataset creation fails when startStep is interpreted as a string with value and units #115

Open
frazane opened this issue Nov 7, 2024 · 0 comments

Comments

@frazane
Copy link

frazane commented Nov 7, 2024

Problem description

Concerns dataset creation using GRIB sources.

When the step is interpreted as a string with the units attached to the values (e.g. 0m for step 0 in minutes) the dataset creation fails due to a recently added assertion check.

  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/bin/anemoi-datasets", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/__main__.py", line 23, in main
    cli_main(__version__, __doc__, COMMANDS)
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/utils/cli.py", line 153, in cli_main
    cmd.run(args)
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/commands/create.py", line 72, in run
    self.serial_create(args)
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/commands/create.py", line 82, in serial_create
    task("init", options)
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/commands/create.py", line 36, in task
    result = c.run()
             ^^^^^^^
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/create/__init__.py", line 393, in run
    return self._run()
           ^^^^^^^^^^^
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/create/__init__.py", line 483, in _run
    metadata["variables_metadata"] = self.minimal_input.variables_metadata
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/create/input/result.py", line 549, in variables_metadata
    return _fields_metatata(self.variables, self._cube)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/scratch/mch/fzanetta/miniforge3/envs/model-archive-anemoi/lib/python3.12/site-packages/anemoi/datasets/create/input/result.py", line 106, in _fields_metatata
    assert startStep is None or isinstance(startStep, int), (startStep, type(f))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: ('0m', <class 'anemoi.datasets.create.functions.filters.rename.RenamedFieldMapping'>)

Version numbers

0.5.9.dev12+g32a2fa9
eccodes: 2.37.0
earthkit-data: 0.10.9

To Reproduce
Create a dataset using GRIB sources that specify the step units.

URL to sample input data
Provide a URL to a sample input data, or attach a file to that report if it is small enough.

Expected behavior
The hardcoded assertion expects step to be an integer type, however that is not necessarily the case. Strings should also be accepted.

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

1 participant