NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdf-java] Problem with CFS GRIB2 files

Hello,

I have a problem using netcdfAll-4.2.jar to parse files like that

http://nomads.ncep.noaa.gov/pub/data/nccf/com/cfs/para/cfs/cfs.20110309/00/monthly_grib_01/flxf.01.2011030900.201103.avrg.grib.06Z.grb2

There is an error if I tring to open it as Netcdf file

java.lang.UnsupportedOperationException
        at ucar.grib.grib2.Grib2Pds.makeForecastTime(Grib2Pds.java:187)
        at ucar.grib.grib2.Grib2Pds$Grib2Pds8.<init>(Grib2Pds.java:1101)
        at ucar.grib.grib2.Grib2Pds.factory(Grib2Pds.java:79)
        at
ucar.grib.grib2.Grib2ProductDefinitionSection.<init>(Grib2ProductDefinitionSection.java:203)
        at ucar.grib.grib2.Grib2Input.scan(Grib2Input.java:204)
        at
ucar.grib.grib2.Grib2WriteIndex.writeGribIndex(Grib2WriteIndex.java:162)
        at
ucar.grib.grib2.Grib2WriteIndex.writeGribIndex(Grib2WriteIndex.java:111)
        at
ucar.nc2.iosp.grib.GribGridServiceProvider.writeIndex(GribGridServiceProvider.java:345)
        at
ucar.nc2.iosp.grib.GribGridServiceProvider.getIndex(GribGridServiceProvider.java:289)
        at
ucar.nc2.iosp.grib.GribGridServiceProvider.open(GribGridServiceProvider.java:118)
        at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1317)
        at ucar.nc2.NetcdfFile.open(NetcdfFile.java:753)
        at ucar.nc2.NetcdfFile.open(NetcdfFile.java:387)
        at ucar.nc2.NetcdfFile.open(NetcdfFile.java:357)
...


same error occures in IDV. I think the reason of it in procedure
makeForecastTime in class grib2.Pds package ucar.grib.grib2 because there
is no timeUnit=3 (Month) in this procedure.

static public int makeForecastTime(long refTime, long foreDate, int
timeUnit) {

    int intv = (int) ((foreDate - refTime) / 1000); // secs

    // common cases
    if (timeUnit == 1)
      return intv / 3600; // hour
    else if (timeUnit == 0)
      return intv / 60; // minute
    else if (timeUnit == 2)
      return intv / 3600 / 24; // day
    else if (timeUnit == 10)
      return intv / 3600 / 3; // 3 hour
    else if (timeUnit == 11)
      return intv / 3600 / 6; // 6 hour
    else if (timeUnit == 12)
      return intv / 3600 / 12; // 12 hour
    else if (timeUnit == 13)
      return intv; // sec

    // otherwise ??

    throw new UnsupportedOperationException();
  }

Best regards,

Igor



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