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

Enhance Bufr data support including multi-category messages #1396

Open
wants to merge 3 commits into
base: maint-5.x
Choose a base branch
from

Conversation

Yaqiang
Copy link
Contributor

@Yaqiang Yaqiang commented Nov 27, 2024

Enhance Bufr data support including multi-category messages in a sigle data file, so that prepbufr data file is supported. Also CMA bufr tables were added for reading CMA released bufr data files.

Description of Changes

_ Add CMA bufr tables (table B and D) as resource tables for reading the bufr data files released from CMA.

_ prepbufr data file may containes multiple category messages such as ADPUPA, ADPSFC, etc. BufrIosp2 only support single category messages before. So BufrIosp2 and related classes (BufrIospBuilder, EmbeddedTable, TableA, ...) was revised to support more root variables (not just 'obs').

_ 'reallyRead' function in ucar.nc2.Variable class has problem when a Structure variable read result is ArrayObject with ArraySequence as elements, so it was revised to solve the issue.

  • 'extractMemberArrayFromIteration' in ucar.ma2.ArraySequence class was revised for SEQUENCE data type case.

I test them using MeteoInfoLab (version 3.9.7) bufr reading scripts with netcdf library behand.
prepbufr_adpsfc
prepbufr_satwnd

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"

…le data file, so that prepbufr was supported. Also CMA bufr tables were added.
@lesserwhirls lesserwhirls self-assigned this Dec 5, 2024
@lesserwhirls lesserwhirls self-requested a review December 5, 2024 23:54
@lesserwhirls lesserwhirls added the iosp: bufr bufr file format label Dec 5, 2024
@lesserwhirls
Copy link
Collaborator

Greetings @Yaqiang!

Thank you for this contribution! There are two issues at play with the github checks. This first is minor, in that there are some issues detected with the code style. These can be seen by running ./gradlew spotlessCheck, and in most cases can be fixed by running ./gradlew spotlessApply.

The second is there are failing tests. It looks like there is a test failing due to an error trying to reach a remote server (unrelated to your pull requests). I ran our full testsuite against your PR and did find some failures related to the changes, however. For example, when trying to read a sequence from the attached .bufr file using the old API (NetcdfFile.open):

try (NetcdfFile nc = NetcdfFile.open("ecmwf-wmo16-hasOptionalSection.bufr")) {
    Variable var = nc.findVariable("obs.seq1");
    Array data = var.read();
}

we get the following error:

java.lang.NullPointerException
	at ucar.nc2.iosp.bufr.BufrIosp2.findRootSequence(BufrIosp2.java:227)
	at ucar.nc2.iosp.bufr.BufrIosp2.readData(BufrIosp2.java:210)
	at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:2122)
	at ucar.nc2.Variable.reallyRead(Variable.java:854)
	at ucar.nc2.Variable._read(Variable.java:736)
	at ucar.nc2.Variable.read(Variable.java:614)
	at ucar.nc2.Variable.reallyRead(Variable.java:795)
	at ucar.nc2.Variable._read(Variable.java:736)
	at ucar.nc2.Variable.read(Variable.java:614)

I'm going to open a PR here shortly to disable the failing tests when running on GitHub (we've seen connectivity issues with this server before when running on GitHub), so that should help clear up the GitHub checks.

lesserwhirls added a commit to lesserwhirls/netcdf-java that referenced this pull request Dec 11, 2024
GitHub appears to have intermittent access issues when running a dap2 test against iridl.ldeo.columbia.edu (see Unidata#1396 (comment)). Disable this specific test for pull requests, but still run locally and on jenkins. Also, they have upgraded their server to support https, so we will use that in the test.
@lesserwhirls lesserwhirls mentioned this pull request Dec 11, 2024
5 tasks
@lesserwhirls lesserwhirls added the enhancement New feature or request label Dec 11, 2024
@Yaqiang
Copy link
Contributor Author

Yaqiang commented Dec 13, 2024

@lesserwhirls Thanks for you review and helpful information on this PR! I mentioned that the check is failling but unfortunatelly I am very busy in these days to response quickly. Can you comment me how to do in next step? Also you mentioned the file "ecmwf-wmo16-hasOptionalSection.bufr" which I didn't find here. Otherwise I will debug the problem on this file.

@lesserwhirls
Copy link
Collaborator

Ah, yes, I forgot to attach the file! Here it is:

ecmwf-wmo16-hasOptionalSection.bufr.zip

These would be my suggestion for the next steps:

  1. rebase or merge in the changes I've made to the maint-5.x branch into your develop branch, which will allow the unit tests to further test your changes. I suspect the unit tests will pass once you've picked up the changes to the maint-5.x branch.
  2. once you have those changes, you can run ./gradlew spotlessApply to fix the codestyle check and commit those changes.
  3. at that point, the bufr file above can be used to debug the issue uncovered by the larger test suite.

Thank you again!

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

Successfully merging this pull request may close these issues.

2 participants