Re: [netcdf-java] Grib2Netcdf

Hi Kevin:

There's a bug using relative paths for the input file, which is now fixed. Can you try out version 4.3.3 of toolsUI-4.3.jar ?

ftp://ftp.unidata.ucar.edu/pub/netcdf-java/v4.3/toolsUI-4.3.jar

Let me know if you see any problems.

Thanks!

On 12/12/2011 12:27 PM, Kevin Manross wrote:

Ahhh!  Very good.  Should have known to try the simple solution first.

When trying this file with your recommendation but using v4.3, I'm getting the following error:

[manross@albion HRRR]$ java -Xmx512m -classpath /mnt/home/manross/Programming/Java/toolsUI-4.3.jar ucar.nc2.dataset.NetcdfDataset -in hrrr_20111212-1200F0000.grib2 -out out_43.nc <http://out_43.nc> -isLargeFile Exception in thread "main" java.io.IOException: java.lang.StringIndexOutOfBoundsException: String index out of range: -1 at ucar.nc2.grib.grib2.Grib2CollectionBuilder.<init>(Grib2CollectionBuilder.java:107) at ucar.nc2.grib.grib2.Grib2CollectionBuilder.createFromSingleFile(Grib2CollectionBuilder.java:64)
at ucar.nc2.grib.GribIndex.makeCollection(GribIndex.java:77)
at ucar.nc2.grib.grib2.Grib2Iosp.open(Grib2Iosp.java:225)
at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1458)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:860)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:497)
at ucar.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:694)
at ucar.nc2.dataset.NetcdfDataset.openFile(NetcdfDataset.java:566)
at ucar.nc2.dataset.NetcdfDataset.main(NetcdfDataset.java:1678)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1937)
at thredds.inventory.CollectionSpecParser.<init>(CollectionSpecParser.java:93) at thredds.inventory.DatasetCollectionMFiles.<init>(DatasetCollectionMFiles.java:112) at thredds.inventory.DatasetCollectionMFiles.open(DatasetCollectionMFiles.java:85) at ucar.nc2.grib.grib2.Grib2CollectionBuilder.<init>(Grib2CollectionBuilder.java:99)
... 9 more


-kevin.


On Mon, Dec 12, 2011 at 12:57 PM, John Caron <caron@xxxxxxxxxxxxxxxx <mailto:caron@xxxxxxxxxxxxxxxx>> wrote:

    Hi Kevin:

    1) in general, use

    java -Xmx512m -classpath netdfAll-<version>.jar ucar.nc2.dataset.NetcdfDataset 
-in<fileIn>  -out<fileOut>  [-isLargeFile]

    see:

    
http://www.unidata.ucar.edu/software/netcdf-java/reference/Cookbook.html#writeClasssic

2) it appears you are exceeding the 2G limit, so be sure to use -isLargeFile flag

    3) check to see if the variables are correct, since the tables may
    need updating. Let me know if you see any problems



    John

    On 12/12/2011 10:44 AM, Kevin Manross wrote:

    Greetings!

    I have been using the utility ucar.nc2.iosp.grib.Grib2Netcdf in
    toolsUI-4.1 successfully to convert High Resolution Rapid Refresh
    (HRRR) GRIB2 files to netcdf-3.

    When trying to use this utility in toolsUI-4.2, I am unable to
    write out the file:

    [manross@albion HRRR]$ java -Xmx512m -classpath
    /mnt/home/manross/Programming/Java/toolsUI-4.2.jar
    ucar.nc2.iosp.grib.Grib2Netcdf hrrr_20111212-1200F0000.grib2
    out_42.nc <http://out_42.nc>
    Mon Dec 12 17:20:44 GMT 2011 ... Start of Grib2Netcdf
    read grib file=hrrr_20111212-1200F0000.grib2 write to netCDF
    file=out_42.nc <http://out_42.nc>
    Dec 12, 2011 5:20:44 PM ucar.nc2.iosp.grid.GridVariable makeVariable
    WARNING: Duplicate record for hrrr_20111212-1200F0000.grib2
     GribGridRecord{param=Total_precipitation, levelType1=1,
    levelValue1=0.0, forecastTime=0, pdsOffset=369269359}
     GribGridRecord{param=Total_precipitation, levelType1=1,
    levelValue1=0.0, forecastTime=0, pdsOffset=369268399}
    Dec 12, 2011 5:20:44 PM ucar.nc2.iosp.grid.GridVariable makeVariable
    WARNING: Duplicate record for hrrr_20111212-1200F0000.grib2
     GribGridRecord{param=Water_equivalent_of_accumulated_snow_depth,
    levelType1=1, levelValue1=0.0, forecastTime=0, pdsOffset=369270079}
     GribGridRecord{param=Water_equivalent_of_accumulated_snow_depth,
    levelType1=1, levelValue1=0.0, forecastTime=0, pdsOffset=369269119}
    Dec 12, 2011 5:20:44 PM ucar.nc2.iosp.grid.GridVariable makeVariable
    WARNING: Duplicate record for hrrr_20111212-1200F0000.grib2
     GribGridRecord{param=Convective_precipitation, levelType1=1,
    levelValue1=0.0, forecastTime=0, pdsOffset=369269599}
     GribGridRecord{param=Convective_precipitation, levelType1=1,
    levelValue1=0.0, forecastTime=0, pdsOffset=369268639}
    Dec 12, 2011 5:20:44 PM ucar.nc2.iosp.grid.GridVariable makeVariable
    WARNING: Duplicate record for hrrr_20111212-1200F0000.grib2
     GribGridRecord{param=Large_scale_precipitation_non-convective,
    levelType1=1, levelValue1=0.0, forecastTime=0, pdsOffset=369269839}
     GribGridRecord{param=Large_scale_precipitation_non-convective,
    levelType1=1, levelValue1=0.0, forecastTime=0, pdsOffset=369268879}
    Exception in thread "main" java.lang.IllegalArgumentException:
    Variable starting pos=2164328984 <tel:2164328984> may not exceed
    2147483647 <tel:2147483647>
    at ucar.nc2.iosp.netcdf3.N3header.writeHeader(N3header.java:671)
    at ucar.nc2.iosp.netcdf3.N3header.create(N3header.java:602)
    at ucar.nc2.iosp.netcdf3.N3iosp.create(N3iosp.java:641)
    at ucar.nc2.NetcdfFileWriteable.create(NetcdfFileWriteable.java:605)
    at ucar.nc2.FileWriter.writeToFile(FileWriter.java:225)
    at ucar.nc2.FileWriter.writeToFile(FileWriter.java:96)
    at ucar.nc2.iosp.grib.Grib2Netcdf.main(Grib2Netcdf.java:125)


    Unfortunately, I can't even find the Grib2Netcdf utility in
    toolsUI-4.3.

    Is this utility no longer available or supported?  Is there
    anything like it in 4.3?  If not, is there a chance that I could
    get this fixed in v4.2?

    I'd be happy to supply the GRIB2 file if people want to test this.

    Many thanks!!

    -kevin.


-- +-----------------------------------------------------+
    Kevin L. Manross           |  ** New Address **
    CIMMS Research Associate   |     120 David L. Boren Bvd
    NSSL : WRDD : SWAT         |     Rm 3923
    <kevin.manross@xxxxxxxx>  
<https://hedwig.nssl.noaa.gov/frame.html?&security=false&lang=en>    |405.325.6385  
<tel:405.325.6385>
    www.cimms.ou.edu/~kmanross  <http://www.cimms.ou.edu/%7Ekmanross>  |
    "My opinions are my own and not representative of
    CIMMS, NSSL, NOAA or any affiliates"
    +-----------------------------------------------------+



    _______________________________________________
    netcdf-java mailing list
    netcdf-java@xxxxxxxxxxxxxxxx  <mailto:netcdf-java@xxxxxxxxxxxxxxxx>
For list information or to unsubscribe, visit:http://www.unidata.ucar.edu/mailing_lists/


    _______________________________________________
    netcdf-java mailing list
    netcdf-java@xxxxxxxxxxxxxxxx <mailto:netcdf-java@xxxxxxxxxxxxxxxx>
    For list information or to unsubscribe, visit:
    http://www.unidata.ucar.edu/mailing_lists/




_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/

  • 2011 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: