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

RuntimeError: error while translating coordinate: 'latitude' on cf2cdm.translate_coords #41

Closed
alexamici opened this Issue Dec 27, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@alexamici
Copy link
Collaborator

alexamici commented Dec 27, 2018

GRIB files that produce a non-dimension coordinate (for example rotated_ll) crash when attemping to cf2cdm.translate_coords:

>>> cf2cdm.translate_coords(rotated_ll_data, coord_model=cf2cdm.CDS)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
~/devel/MPY/cfgrib/cf2cdm/cfcoords.py in translate_coords(data, coord_model, errors, coord_translators)
    172         try:
--> 173             data = translator(cf_name, data, coord_model=coord_model)
    174         except:

~/devel/MPY/cfgrib/cf2cdm/cfcoords.py in coord_translator(default_out_name, default_units, default_direction, is_cf_type, cf_type, data, coord_model)
     79         data.coords[out_name].attrs['units'] = units
---> 80     data = translate_direction(data, out_name, stored_direction)
     81     return data

~/devel/MPY/cfgrib/cf2cdm/cfcoords.py in translate_direction(data, out_name, stored_direction)
     49     values = data.coords[out_name].values
---> 50     if values[-1] > values[0] and stored_direction == 'decreasing':
     51         data = data.isel({out_name: slice(None, None, -1)})

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

During handling of the above exception, another exception occurred:

RuntimeError                              Traceback (most recent call last)
<ipython-input-25-f05da76a7f8c> in <module>
----> 1 cosmo = cf2cdm.translate_coords(cosmo, coord_model=cf2cdm.CDS)

~/devel/MPY/cfgrib/cf2cdm/cfcoords.py in translate_coords(data, coord_model, errors, coord_translators)
    174         except:
    175             if errors != 'ignore':
--> 176                 raise RuntimeError("error while translating coordinate: %r" % cf_name)
    177     return data
    178 

RuntimeError: error while translating coordinate: 'latitude'

@alexamici alexamici added the bug label Dec 27, 2018

@alexamici alexamici self-assigned this Dec 27, 2018

alexamici added a commit that referenced this issue Dec 27, 2018

alexamici added a commit that referenced this issue Dec 27, 2018

@alexamici alexamici closed this in 20e0d1b Dec 27, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.