Package ucar.nc2.grib.grib2
Class Grib2Index
- java.lang.Object
-
- ucar.nc2.grib.GribIndex
-
- ucar.nc2.grib.grib2.Grib2Index
-
public class Grib2Index extends GribIndex
Read and Write Grib2 index (gbx9). Hides GribIndexProto sample use:GribIndex index = new GribIndex(); if (!index.readIndex(path)) index.makeIndex(path); for (Grib2SectionGridDefinition gds : index.getGds()) { if (gdsSet.get(gds.calcCRC()) == null) gdsSet.put(gds.calcCRC(), gds); } for (Grib2Record gr : index.getRecords()) { gr.setFile(fileno); Grib2Pds pds = gr.getPDSsection().getPDS(); int discipline = gr.getDiscipline(); int id = gr.cdmVariableHash(); Grib2ParameterBean bean = pdsSet.get(id); if (bean == null) { bean = new Grib2ParameterBean(gr); pdsSet.put(id, bean); params.add(bean); } bean.addRecord(gr); }
- Since:
- 4/1/11
-
-
Field Summary
Fields Modifier and Type Field Description static String
MAGIC_START
static int
ScanModeMissing
-
Constructor Summary
Constructors Constructor Description Grib2Index()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Grib2SectionGridDefinition>
getGds()
int
getNRecords()
The number of records in the index.List<Grib2Record>
getRecords()
boolean
makeIndex(String filename, RandomAccessFile dataRaf)
Make the gbx9 index file.boolean
readIndex(String filename, long gribLastModified)
boolean
readIndex(String filename, long gribLastModified, CollectionUpdateType force)
Read the gbx9 index file.-
Methods inherited from class ucar.nc2.grib.GribIndex
getChangeChecker, open, readOrCreateIndexFromSingleFile
-
-
-
-
Field Detail
-
MAGIC_START
public static final String MAGIC_START
- See Also:
- Constant Field Values
-
ScanModeMissing
public static final int ScanModeMissing
- See Also:
- Constant Field Values
-
-
Method Detail
-
getGds
public List<Grib2SectionGridDefinition> getGds()
-
getRecords
public List<Grib2Record> getRecords()
-
getNRecords
public int getNRecords()
Description copied from class:GribIndex
The number of records in the index.- Specified by:
getNRecords
in classGribIndex
- Returns:
- The number of records in the index.
-
readIndex
public boolean readIndex(String filename, long gribLastModified)
-
readIndex
public boolean readIndex(String filename, long gribLastModified, CollectionUpdateType force)
Description copied from class:GribIndex
Read the gbx9 index file.
-
makeIndex
public boolean makeIndex(String filename, RandomAccessFile dataRaf) throws IOException
Description copied from class:GribIndex
Make the gbx9 index file.- Specified by:
makeIndex
in classGribIndex
- Parameters:
filename
- location of the data filedataRaf
- already opened data raf (leave open); if null, makeIndex opens and closes)- Returns:
- true
- Throws:
IOException
- on io error
-
-