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

Crash when trying to parse netcdf file for fields #337

Closed
sandorkertesz opened this issue Mar 8, 2024 · 1 comment
Closed

Crash when trying to parse netcdf file for fields #337

sandorkertesz opened this issue Mar 8, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sandorkertesz
Copy link
Collaborator

What happened?

When we get the following data from cds:

import earthkit.data
lc_data = earthkit.data.from_source(
    "cds",
    'satellite-land-cover',
   {
     'year': '2022',
     'version': 'v2.1.1',
     'variable': 'all',
     'format': 'zip',
   }
)

earthkit-data crashes during parsing the fields in the NetCDF file the zip file contains.

File ~/git/earthkit-data/earthkit/data/readers/netcdf.py:169, in get_fields_from_ds(ds, array_backend, field_type, check_only)
    167     v = ds[name]
    168     skip.update(getattr(v, "coordinates", "").split(" "))
--> 169     skip.update(getattr(v, "bounds", "").split(" "))
    170     skip.update(getattr(v, "grid_mapping", "").split(" "))
    172 for name in ds.data_vars:

File /opt/homebrew/Caskroom/miniforge/base/envs/dev_ecc/lib/python3.10/site-packages/xarray/core/common.py:278, in AttrAccessMixin.__getattr__(self, name)
    276         with suppress(KeyError):
    277             return source[name]
--> 278 raise AttributeError(
    279     f"{type(self).__name__!r} object has no attribute {name!r}"
    280 )

AttributeError: 'DataArray' object has no attribute 'split'

What are the steps to reproduce the bug?

See above.

Version

<-0.5.5

Platform (OS and architecture)

all

Relevant log output

No response

Accompanying data

No response

Organisation

ECMWF

@sandorkertesz
Copy link
Collaborator Author

Fixed by #339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant