NOAA-EMC / NCEPLIBS-nemsio

The NCEPLIBS-nemsio library and utilities perform I/O for the NCEP models using NOAA Environmental Modeling System (NEMS) format.
Other
3 stars 4 forks source link

Variable 'jcap' uninitialized in utils/nemsio_read #42

Open GeorgeGayno-NOAA opened 3 years ago

GeorgeGayno-NOAA commented 3 years ago

NCO opened a BugZilla report about the nemsio_read utility. Variable jcap is declared but never defined. Then it is printed to standard output at line 76. I suspect the utility author meant to return jcap from the call to nemsio_getfilehead at line 74.

http://www2.spa.ncep.noaa.gov/bugzilla/show_bug.cgi?id=1002

edwardhartnett commented 3 years ago

Can we get a test to demonstrate this?

kgerheiser commented 3 years ago

A quick cmd+f of nemsio_read doesn't show any variable named jcap? Is this in a different version of the library?

GeorgeGayno-NOAA commented 3 years ago

Running a test is very straightforward. All you need is a nemsio file. On Hera, I use nemsio files in the chgres_cube regression tests:

To run the utility, do nemsio_read $nemsio_file and pipe to a log file. My tests show 'jcap' is '0'.

GeorgeGayno-NOAA commented 3 years ago

A quick cmd+f of nemsio_read doesn't show any variable named jcap? Is this in a different version of the library?

Check the nemsio_read.f90 in the ./utils directory.

edwardhartnett commented 3 years ago

When I say "test" I always mean automated test. Please automate a test for this bug before submitting a fix.

Put the nemsio file on the ftp site and fetch it for the test. Write a shell script to run the test and have it launch with make test.

Ask for help for any part you need help with...

GeorgeGayno-NOAA commented 3 years ago

Running a test is very straightforward. All you need is a nemsio file. On Hera, I use nemsio files in the chgres_cube regression tests:

  • /scratch1/NCEPDEV/da/George.Gayno/noscrub/reg_tests/chgres_cube/input_data/gfs.nemsio

To run the utility, do nemsio_read $nemsio_file and pipe to a log file. My tests show 'jcap' is '0'.

Intel must set uninitialized variables to '0' by default.

kgerheiser commented 3 years ago

Yep, that's an uninitialized variable.

Compiling the libraries -check all once in a while could catch things like this.

GeorgeGayno-NOAA commented 3 years ago

A better test file is: /scratch1/NCEPDEV/da/George.Gayno/noscrub/chgres_tutorial/nemsio/gfnanl.gdas.2017071700

It is from an older version of the spectral GFS and has a more complete header.

edwardhartnett commented 3 years ago

Bumping this to the next release...