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

Add functions to open, and close GRIB2 files #276

Closed
edwardhartnett opened this issue Aug 16, 2022 · 5 comments
Closed

Add functions to open, and close GRIB2 files #276

edwardhartnett opened this issue Aug 16, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@edwardhartnett
Copy link
Contributor

Given that this is a GRIB2 library, I would have expected to find a function that opens a GRIB2 file and reads the metadata in the file.

Yet there does not seem to be such a function.

Am I missing something?

@EricEngle-NOAA how do you open a file with the python library?

@edwardhartnett edwardhartnett added the question Further information is requested label Aug 16, 2022
@edwardhartnett edwardhartnett self-assigned this Aug 16, 2022
@edwardhartnett
Copy link
Contributor Author

OK, I see that @EricEngle-NOAA answers my question in his documentation:

GRIB2 file IO is performed directly in Python. The unpacking/packing of GRIB2 integer, coded metadata and data sections is performed
by the g2c library functions via the g2clib Cython wrapper module. The decoding/encoding of GRIB2 metadata is translated into more
descriptive, plain language metadata by looking up the integer code values against the appropriate GRIB2 code tables. These code tables
are a part of the grib2io module.

@edwardhartnett edwardhartnett changed the title How come there are no functions to open GRIB2 files? Add functions to create, open, and close GRIB2 files Aug 16, 2022
@edwardhartnett
Copy link
Contributor Author

We need functions in the library to open, create, and close GRIB2 files.

For example, I need such functions to test >2gb capabilities for #43 and NOAA-EMC/NCEPLIBS-grib_util#294.

However, such functions would be very useful for many other tests as well. And also to users who otherwise have to implement all the file I/O.

@edwardhartnett edwardhartnett added enhancement New feature or request and removed question Further information is requested labels Aug 16, 2022
@EricEngle-NOAA
Copy link
Contributor

FWIW, I agree that the need is there for these functions. I think, why the functionality is not there, is that g2c initially was just a port to C from the parent Fortran-based g2 library using f2c. The g2 library depends on bacio (Byte-Addressable C IO).

@edwardhartnett
Copy link
Contributor Author

Yes, and bacio, when I refactored it, came down to one C function that does file IO in a perfectly ordinary way. ;-)

I am changing hte g2 Fortran library so that it calls the C library, and all functionality will live in the C library. I've already started this with pngpack/jpegpack because they used copies of some old C code in the g2 library. Moving forward, the C library will provide pgppack/jpegpack and the Fortran library just calls the C library.

THese new file functions will get added after I release version 1.7.0, which is happening now. (See #232 ).

@edwardhartnett
Copy link
Contributor Author

This is now working pretty well for opening an existing file. Creating a new file is still not working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants