From: Arlindo da S. <da...@al...> - 2008-02-03 03:02:24
|
On Feb 2, 2008 7:21 PM, Jennifer Adams <jm...@co...> wrote: > > > Arlindo -- > There is a bug in seekgb.c of the g2clib that causes it to fail to detect > the end of a grib2 record if sizeof(g2int) != 4 (i.e. on 64-bit systems). > I guess we should put the patch in the subblib src files we are > redistributing (on your site and COLA's). This bug causes gribmap to fail to > find any records -- pretty bad. > OK, I'll patch it and check it in. Fell free to to checkout the supplib sources and commit but fixes like this one. BTW, we autoconfiscated grib2c for easier integration in the supplibs; other users of the library may appreciate this as well. We should contribute this, along with your bug fix, to the 'upstream' maintainers. Are you in contact with them? Another important point. I need a small grib-2 file to add to the test suite. Right now I have model.grb, model.nc and model.hdf - all the same file, just in different formats. (I test binary files by writing them out with 'fwrite' and then reading them back.) This allows me to apply the same test code to all of them. Ideally, one should have a similar model.grb2 file. Wes attempted to convert the existing model.grb to grb 2 but wasn't able to because model.grb does not conform to NCEP's tables, or some other obscure grib reason. > The code path for hdf in sdfopen is new. I will look at it and see what's > going wrong. > It would be good to have model_nc.ctl and model_hdf.ctl so I can test the ctl interface for netcdf/hdf as well. If you contribute those 2 ctls I can add the additional tests. > Where is model.hdf? > When you checkout the sources look under pytests/data, all test data is there. > b) When using "set gxout fvwrite" to write binary files the missing value > is not being written correctly, in either little-endian or big-endian mode. > Is this a bug or a feature (I haven't verified whether v1.9 does the > same)? > > Can you be more specific about what 'not being written correctly' means? > Can you give me a script segment that shows what it is doing wrong? Undef > handling in v2 is entirely different than 1.9 -- it won't help to look > back. > The undef value is 1E+20 for the opened file (model.nc). I then use fwrite to write all vars, levels, times, to disk. When I read it back a different value is used for UNDEF: 2.2616e+06. Here is how to reproduce the error outside the testing framework. From the Unix command line: - check out grads sources and go to the testing directory: % cd grads/pytests - Convince yourself that undef of input file is 1e+20 % ncdump data/model.nc - Now convert model.nc to binary using 'fwrite' % mkdir output % ./lats4d -i model/model.nc -o output/stream -format stream -be -v (or write a simple script to do just that; choose a variable with undefs, like "ua"). - use stream.ctl to read file output/stream.bin that you just created. You can either open this file in GrADS or use lats4d again for a quick summary: % ./lats4d -i stream.ctl -format stats ... Name Lev Min Max MEAN STDV RMS --------- ---- ----------- ----------- ----------- ----------- ----------- ua 1000 -12.9719 2.2616e+06 1.1868e+06 1.1296e+06 1.6383e+06 ua 850 -22.5107 2.2616e+06 3.0661e+05 7.7434e+05 8.3272e+05 ua 700 -19.0453 2.2616e+06 1.4750e+05 5.5850e+05 5.7757e+05 ua 500 -26.0697 2.2616e+06 2055.4200 6.8046e+04 6.8067e+04 ua 300 -30.2449 73.7551 12.3418 16.0524 20.2466 ua 200 -18.9862 81.0138 14.3248 16.6574 21.9678 ua 100 -19.2900 53.7100 11.3787 12.8745 17.1807 --------- ---- ----------- ----------- ----------- ----------- ----------- + ua 7 -30.2449 2.2616e+06 2.3472e+05 3.6177e+05 7.2858e+05 The maximum value is what was mistakenly written for UNDEF. Incidentally, this problem does not happens with model.grb: % ./lats4d -i model/model.ctl -o output/stream -format stream -be -v % ./lats4d -i stream.ctl -format stats ... Name Lev Min Max MEAN STDV RMS --------- ---- ----------- ----------- ----------- ----------- ----------- ua 1000 -12.9719 20.0281 -0.5000 6.5431 6.5601 ua 850 -22.5107 29.7393 1.6346 8.3796 8.5361 ua 700 -19.0453 33.9547 3.8051 9.2721 10.0211 ua 500 -26.0697 50.9303 6.8472 11.9436 13.7655 ua 300 -30.2449 73.7551 12.3418 16.0524 20.2466 ua 200 -18.9862 81.0138 14.3248 16.6574 21.9678 ua 100 -19.2900 53.7100 11.3787 12.8745 17.1807 --------- ---- ----------- ----------- ----------- ----------- ----------- + ua 7 -30.2449 81.0138 7.1189 11.9898 15.0878 The test that is failing writes each input file to disk, and reads it back checking each variable/level/time. Let me know if you have any questions. Arlindo -- Arlindo da Silva da...@al... |