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 String
MAGIC_START
-
Constructor Summary
Constructors Constructor Description Grib1Index()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Grib1SectionGridDefinition>
getGds()
int
getNRecords()
The number of records in the index.List<Grib1Record>
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
-
-
Method Detail
-
getGds
public List<Grib1SectionGridDefinition> getGds()
-
getRecords
public List<Grib1Record> 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
-
-