question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Message arrays using non-supported projection are returned as 1-d array

See original GitHub issue

Hi,

I’m working on a python tool that deals with grib and netcdf inputs. Those inputs are defined on a regular grid that lives in the Lambert Azimuthal Equal Area projection. We want to use xarray with both the netcdf and cfgrib engines. We are well aware that the LAEA projection is not supported by eccodes (and therefore cfgrib), but we can reconstruct the coordinates by hand when we import our grib files in our scripts. I just have an issue regarding the dimension of the field that cfgrib returns when the projection is not supported. At the moment, xarray with cfgrib will return the following:

ECCODES ERROR   :  unable to get radius as double (Key/value not found)
ECCODES ERROR   :  Lambert Azimuthal Equal Area only supported for spherical earth.
ECCODES ERROR   :  unable to create iterator
ecCodes provides no latitudes/longitudes for gridType='lambert_azimuthal_equal_area'
>>> print(ds)
<xarray.Dataset>
Dimensions:     (step: 17, values: 4180000)
Coordinates:
    time        datetime64[ns] ...
  * step        (step) timedelta64[ns] 08:00:00 09:00:00 ... 1 days 00:00:00
    surface     int64 ...
    valid_time  (step) datetime64[ns] ...
Dimensions without coordinates: values
Data variables:
    tp          (step, values) float32 ...
Attributes:
    GRIB_edition:            2
    GRIB_centre:             ecmf
    GRIB_centreDescription:  European Centre for Medium-Range Weather Forecasts
    GRIB_subCentre:          0
    Conventions:             CF-1.7
    institution:             European Centre for Medium-Range Weather Forecasts
    history:                 2020-01-27T15:11:36 GRIB to CDM+CF via cfgrib-0....

We can see here that cfgrib returns an xarray dataset with dimension: (step: 17, values: 4180000) But, as we deal here with a regular grid, I would rather expect something like: (step: 17, y: 2200 x: 2000) With the current approach, the user has to figure out what is the leading dimension of the coordinates. Also, it is not straightforward to resize an array in xarray. This means it requires an extra processing step to redefine the dimensions, which can break the dask parallelisation (for instance, calling ds[‘tp’].value.resize(2200, 1900) will trigger the dask.compute() function).

Would it be possible to have cfgrib returning the correct dimensions, even if we can’t reconstruct the coordinates values with eccodes? For instance, using the grid type gridDefinitionTemplateNumber together with the keys numberOfPointsAlongXAxis and numberOfPointsAlongYAxis.

I’m using the following version: eccodes 2.14.0 cfgrib 0.9.7.1

Best, Corentin


Computer Scientist Development Section ECMWF

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
corentincartoncommented, Feb 4, 2020

@alexamici here is a file you can use for your tests: https://drive.google.com/open?id=1Ud-j-HLJH_GdEQ2efGjo_ITnBtPL3Ufi

This projection will not be supported by eccodes any time soon.

0reactions
shahramncommented, Nov 3, 2021

The Geoiterator (Point Iterator) for Lambert azimuthal equal area projection on an ellipsoid has been implemented in ecCodes and will be released in the next version (v2.24.0, Winter 2021)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't canonicalize query: BadValue Unsupported projection ...
I am new to MongoDB and trying to execute a query. I have a company collection and company IDs array.
Read more >
Looping through arrays in PL/pgSQL | YugabyteDB Docs
The PL/pgSQL FOREACH loop brings dedicated syntax for looping over the contents of an array. Overview. Note: See array_lower(), array_upper(), ...
Read more >
ARRAY - Vertica
Vertica-managed tables support native arrays but not inlined arrays. In other words, arrays stored in Vertica must be one-dimensional arrays of primitive types....
Read more >
Mongoose v6.8.1: API docs
Returns an array of model names created on this instance of Mongoose. Note: Does not include names of models created using connection.model() ....
Read more >
Principal component analysis of raw data - MATLAB pca
You cannot use the 'Rows','pairwise' option because the covariance matrix is not positive semidefinite and pca returns an error message. Find the angle...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found