Skip to content

Expose Grib2JpegDecoder - #1591

Open
archmoj wants to merge 1 commit into
Unidata:maint-5.xfrom
archmoj:patch-1
Open

Expose Grib2JpegDecoder#1591
archmoj wants to merge 1 commit into
Unidata:maint-5.xfrom
archmoj:patch-1

Conversation

@archmoj

@archmoj archmoj commented Aug 11, 2026

Copy link
Copy Markdown

Description of Changes

  • Change Grib2JpegDecoder constructor to public access modifier

Exposing Grib2JpegDecoder constructor could help applications to extract data section in JPEG-2000 format directly.
Also according to this documentation (https://docs.unidata.ucar.edu/netcdf-java/4.6/javadocAll/index.html?ucar/nc2/grib/grib2/Grib2JpegDecoder.html) it is expected to be a public method.
Please let me know if I'm missing something.
Thank you.

PR Checklist

  • Link to any issues that the PR addresses
  • Add labels
  • Open as a draft PR
    until ready for review
  • Make sure GitHub tests pass
  • Mark PR as "Ready for Review"

@archmoj
archmoj requested a review from lesserwhirls as a code owner August 11, 2026 14:46
@CLAassistant

CLAassistant commented Aug 11, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@lesserwhirls

Copy link
Copy Markdown
Member

Greetings @archmoj! Thank you for your suggestion. I am open to the idea of opening up access to this class, with the understanding that it isn't part of the actual netCDF-Java public API, and it isn't subject to the same guarantees implied with semantic versioning (the javadocAll javadocs are really meant for netCDF-Java developers, not application developers). That said, if a developer needs to call this, I'm guessing it is likely because a specific GRIB Grid Definition Section isn't supported (and thus netCDF-Java bails early), and I would much rather get that supported so that data can actually be read through the public API.

Can you tell me a little more about the specific use case you have for wanting to use this directly?

@archmoj

archmoj commented Aug 13, 2026

Copy link
Copy Markdown
Author

Hi @lesserwhirls,
Thanks for the review and all your great contributions!
I'm working on this App where I handled various GRIB2 sections. But for the data section when it is encoded in JPEG-2000 format I need to use an external library.
For the moment I imported ucar.jpeg.jj2000.j2k.decoder.Grib2JpegDecoder and used its Grib2JpegDecoder here:
https://github.com/archmoj/grib2_solarchvision/blob/29325e31a2cd7ac20d15232de9526435544c6294/app/src/main/java/grib2_solarchvision/App.java#L9501-L9507

          String[] argv = new String[4];
          argv[0] = "-rate";
          argv[1] = nf(this.NumberOfBitsUsedForEachPackedValue, 0); // number of bits per pixel
          argv[2] = "-verbose";
          argv[3] = "off";

          Grib2JpegDecoder g2j = new Grib2JpegDecoder(argv);

But it would be nice to replace it with this adaptation of jj2000.j2k.decoder.Decoder, in order to read input from memory.

Also it would simplify providing the dependencies here:
https://github.com/archmoj/grib2_solarchvision/blob/29325e31a2cd7ac20d15232de9526435544c6294/app/build.gradle#L32-L34
by removing the need to provide ibs/grib-4.3.jar.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants