Package ucar.nc2.grib.grib1
Class Grib1Index
- java.lang.Object
-
- ucar.nc2.grib.GribIndex
-
- ucar.nc2.grib.grib1.Grib1Index
-
public class Grib1Index extends GribIndex
Read and Write Grib1 index (gbx9). Hides Grib1IndexProto sample use:Grib1Index index = new Grib1Index(); if (!index.readIndex(path)) index.makeIndex(path); for (Grib1SectionGridDefinition gds : index.getGds()) { if (gdsSet.get(gds.calcCRC()) == null) gdsSet.put(gds.calcCRC(), gds); } for (Grib1Record gr : index.getRecords()) { gr.setFile(fileno); Grib1Pds pds = gr.getPDSsection().getPDS(); int discipline = gr.getDiscipline(); int id = gr.cdmVariableHash(); Grib1ParameterBean bean = pdsSet.get(id); if (bean == null) { bean = new Grib1ParameterBean(gr); pdsSet.put(id, bean); params.add(bean); } bean.addRecord(gr); }- Since:
- 9/5/11
-
-
Field Summary
Fields Modifier and Type Field Description static StringMAGIC_START
-
Constructor Summary
Constructors Constructor Description Grib1Index()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Grib1SectionGridDefinition>getGds()intgetNRecords()The number of records in the index.List<Grib1Record>getRecords()booleanmakeIndex(String filename, ucar.unidata.io.RandomAccessFile dataRaf)Make the gbx9 index file.booleanreadIndex(String filename, long gribLastModified)booleanreadIndex(String filename, long gribLastModified, thredds.inventory.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
-
-
Method Detail
-
getGds
public List<Grib1SectionGridDefinition> getGds()
-
getRecords
public List<Grib1Record> getRecords()
-
getNRecords
public int getNRecords()
Description copied from class:GribIndexThe number of records in the index.- Specified by:
getNRecordsin 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, thredds.inventory.CollectionUpdateType force)
Description copied from class:GribIndexRead the gbx9 index file.
-
makeIndex
public boolean makeIndex(String filename, ucar.unidata.io.RandomAccessFile dataRaf) throws IOException
Description copied from class:GribIndexMake the gbx9 index file.- Specified by:
makeIndexin 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
-
-