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

Improper section 1 offset in getgb2rp2 ('7777' issue) #666

Closed
AlexanderRichert-NOAA opened this issue May 9, 2024 · 7 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@AlexanderRichert-NOAA
Copy link
Contributor

In the course of attempting to modify tocgrib2 to support >2GB files, it appears that the getgb2rp2() subroutine inserts extra spacing at the end of Section 1, which then pushes back the rest of the file by 4 elements. lencur then reaches leng before the whole message has been read. This manifested itself as wgrib2 complaining about missing 7777 the first time it encounters a message where it's missing.

@edwardhartnett
Copy link
Contributor

Do you have a test for this?

@edwardhartnett
Copy link
Contributor

OK, this test now passes, and I modified it a bit to make it more sensitive.

One thing did surprise me. The namelist file contains one parameter which is not found in the data file. This is in the test as a special if-statement.

Was this intended?

Thanks Alex for this excellent test.

@edwardhartnett edwardhartnett self-assigned this May 23, 2024
@edwardhartnett edwardhartnett added the bug Something isn't working label May 23, 2024
@AlexanderRichert-NOAA
Copy link
Contributor Author

Which parameter was that?

@edwardhartnett
Copy link
Contributor

Record 314.

        if (iret .eq. 99) then
           print *, ' test_getgb2p_2: error request not found, nrec', nrec
           write(6, '(A, I0, A, 100(1x, I0))') ' PDT 4. ', PDTN, '  = ', (PDT(j2), j2 = 1, getpdtlen(PDTN))
           ! We expect this one won't be found.
           if (nrec .ne. 314) then
              stop 515
           endif
        endif

The output for that record:

Start new record no. =  314
DESC =  PRES     80 m above ground                                              
WMOHEAD = YPAK98 KWBB
GRIB2 DISCIPLINE =  -1
Section 1 =  -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999
PDT 4. 0  =  3 0 2 0 134 0 0 1 10 103 0 80 255 0 0
*** calling getgb2p2()
*** iret          99
 test_getgb2p_2: error request not found, nrec         314

@AlexanderRichert-NOAA
Copy link
Contributor Author

That's funny, I thought I'd removed that entry. Anyway, yes, that was a mismatch in the files we got from the developers, where that field didn't make it into the grib2 file.

@edwardhartnett
Copy link
Contributor

OK, great, let's leave it there as a test of what happens when a parameter is not found.

Thanks for the excellent test, it really helped!

@edwardhartnett
Copy link
Contributor

Hsin-Mu Lin - NOAA Affiliate
Wed, May 29, 1:51 PM (12 hours ago)
to Alexander, Hui-Ya, Hang, Jacob, Matthew, me, Yali

Hi, Alex

Thanks for the information.
I have put the env module in my script and run it successfully for the new tocgrib2.

The result is expected

  • note: 1 missing variable " PRES 80 m above ground" is due to the missing output in UPP. This issue has been updated when workflow updates the UPP control file.

Sincerely,

Lin

So that explains the missing parameter.

I kept the file with the missing parameter and use it to test failure, and I have another version of the namelist without the missing parameter, which tests success.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants