Coder Social home page Coder Social logo

Comments (4)

pp-mo avatar pp-mo commented on September 2, 2024

Thanks for this.
Unfortunately, we are just about to release a "v0.17" ...
... and I don't think we have time to investigate/fix this just yet so it won't make it in 😞
Hope that will be ok. We can always do a another release soon (it isn't hard).

Meanwhile...

this is a bug in gribapi, but that seems to have been end-of-lifed a while ago

Actually iris-grib is using ecCodes + that is what we test against here (CI).
They retained the name 'gribapi' as an optional alias for the package, and we are still using that.
(perhaps we should not).

from iris-grib.

adair-kovac avatar adair-kovac commented on September 2, 2024

Thanks for clarifying about the ecCodes, I'm new to grib and it's been kind of confusing. Updating the package name at some point would probably help people desperately googling for answers in the future.

From our perspective, having this data missing is acceptable––in most cases the variable being absent would mean the same thing as the zero array, I think, and the commonly-used variables aren't affected. So we don't need an urgent fix, although I do wonder whether this was the real problem behind some of the issues reported in the past that gave the "'codedValues' not defined in section 7" error message where the bug reporter just kind of wandered off mumbling that maybe the data was corrupt.

from iris-grib.

greenlaw avatar greenlaw commented on September 2, 2024

Are there any plans to address this in an upcoming release? We are seeing this issue in a number of files containing all-zero messages.

from iris-grib.

mpkay avatar mpkay commented on September 2, 2024

Hi -

This issue is biting us as well. Am attaching a sample GRIB2 message that can be read "correctly" by ecCodes (and wgrib2, FWIW) to return an ndarray of correct size and populated with all zeros as expected. From what we've seen (and haven't confirmed) is that NCEP's g2clib has an optimization for constant fields to leave the values section (7) empty.

Here's a simple example program to confirm the behavior:

import eccodes as ec

filename = "/tmp/empty_section7.grib2"

with open(filename, "rb") as fp:
    msg = ec.codes_grib_new_from_file(fp)
    ny = ec.codes_get(msg, 'Nj')
    nx = ec.codes_get(msg, 'Ni')
    data = ec.codes_get_values(msg).reshape((ny, nx))
    ec.codes_release(msg)
    print(type(data))
    print(data.shape)
    print(data.min(), data.max())

This yields:
<class 'numpy.ndarray'> (721, 1440) 0.0 0.0

Here's a data file (zipped for upload) that demonstrates one of the messages in question.
empty_section7.zip

from iris-grib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.