ucar.grib.grib2
Class Grib2WriteIndex

java.lang.Object
  extended by ucar.grib.grib2.Grib2WriteIndex

public class Grib2WriteIndex
extends Object

Creates an index for a Grib2 file in a Binary format verses the old text format.

Author:
Robb Kambic

Nested Class Summary
protected  class Grib2WriteIndex.CompareKeyDescend
           
static class Grib2WriteIndex.pdsLogType
           
 class Grib2WriteIndex.RawRecord
          light weight record representation for extendIndex
 
Field Summary
static int indexRafBufferSize
          use to improve performance in Grib file
 
Constructor Summary
Grib2WriteIndex()
           
 
Method Summary
 GridIndex extendGribIndex(File grib, File gbx, String gbxName, RandomAccessFile raf, boolean makeIndex)
          extend a Grib file index; optionally create an in-memory index.
 GridIndex extendGribIndex(File grib, File gbx, String gribName, String gbxName, boolean makeIndex)
          extend a Grib file index; optionally create an in-memory index.
 boolean extendGribIndex(String gbxName, RandomAccessFile inputRaf, long rafLastModified, DataOutputStream out)
          extend a Grib file index
static void main(String[] args)
          creates a Grib2 index for given Grib2 file.
 boolean rawGridIndex(String gbxName, List<Grib2WriteIndex.RawRecord> recordList, Map<String,GribGDSVariablesIF> gdsMap)
          makes a raw representation of GridIndex
 void setCheckPDS(boolean flag)
           
 void setDebug(boolean flag)
           
 void setLogPDS(Grib2WriteIndex.pdsLogType flag)
           
 void setVerbose(boolean flag)
           
 GridIndex writeGribIndex(File grib, String gbxName, RandomAccessFile raf, boolean makeIndex)
          extend a Grib file index; optionally create an in-memory index.
 GridIndex writeGribIndex(File grib, String gribName, String gbxName, boolean makeIndex)
          create a Grib file index; optionally create an in-memory index.
 boolean writeGribIndex(RandomAccessFile inputRaf, long rafLastModified, DataOutputStream out)
          Write a Grib file index.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

indexRafBufferSize

public static int indexRafBufferSize
use to improve performance in Grib file

Constructor Detail

Grib2WriteIndex

public Grib2WriteIndex()
Method Detail

writeGribIndex

public final GridIndex writeGribIndex(File grib,
                                      String gribName,
                                      String gbxName,
                                      boolean makeIndex)
                               throws IOException
create a Grib file index; optionally create an in-memory index.

Parameters:
grib - as a File
gribName - as a String
gbxName - as a String
makeIndex - make an in-memory index if true
Returns:
Index if makeIndex is true, else null
Throws:
IOException - on gbx write

writeGribIndex

public final GridIndex writeGribIndex(File grib,
                                      String gbxName,
                                      RandomAccessFile raf,
                                      boolean makeIndex)
                               throws IOException
extend a Grib file index; optionally create an in-memory index.

Parameters:
grib - as a File
gbxName - as a String
raf - RandomAccessFile
makeIndex - make an in-memory index if true
Returns:
Index if makeIndex is true, else null
Throws:
IOException - on gbx write

writeGribIndex

public final boolean writeGribIndex(RandomAccessFile inputRaf,
                                    long rafLastModified,
                                    DataOutputStream out)
                             throws IOException
Write a Grib file index.

Parameters:
inputRaf - GRIB file raf
rafLastModified - of the raf
out - where to write
Returns:
success boolean
Throws:
IOException - on gbx write

extendGribIndex

public final GridIndex extendGribIndex(File grib,
                                       File gbx,
                                       String gribName,
                                       String gbxName,
                                       boolean makeIndex)
                                throws IOException
extend a Grib file index; optionally create an in-memory index.

Parameters:
grib - as a File
gbx - as a File
gribName - as a String
gbxName - as a String
makeIndex - make an in-memory index if true
Returns:
GridIndex if makeIndex is true, else null
Throws:
IOException - on gbx write

extendGribIndex

public final GridIndex extendGribIndex(File grib,
                                       File gbx,
                                       String gbxName,
                                       RandomAccessFile raf,
                                       boolean makeIndex)
                                throws IOException
extend a Grib file index; optionally create an in-memory index.

Parameters:
grib - as a File
gbx - as a File
gbxName - as a String
raf - RandomAccessFile
makeIndex - make an in-memory index if true
Returns:
GridIndex if makeIndex is true, else null
Throws:
IOException - on gbx write

extendGribIndex

public final boolean extendGribIndex(String gbxName,
                                     RandomAccessFile inputRaf,
                                     long rafLastModified,
                                     DataOutputStream out)
                              throws IOException
extend a Grib file index

Parameters:
gbxName - a GridIndex is used to extend/create a new GridIndex
inputRaf - GRIB file raf
rafLastModified - of the raf
out - where to write
Returns:
Index if makeIndex is true, else null
Throws:
IOException - on gbx write

rawGridIndex

public boolean rawGridIndex(String gbxName,
                            List<Grib2WriteIndex.RawRecord> recordList,
                            Map<String,GribGDSVariablesIF> gdsMap)
                     throws IOException
makes a raw representation of GridIndex

Parameters:
gbxName - String
recordList - List
gdsMap - Map
Throws:
IOException - on oldIndex read

setCheckPDS

public void setCheckPDS(boolean flag)

setLogPDS

public void setLogPDS(Grib2WriteIndex.pdsLogType flag)

setDebug

public void setDebug(boolean flag)

setVerbose

public void setVerbose(boolean flag)

main

public static void main(String[] args)
                 throws IOException
creates a Grib2 index for given Grib2 file.

Parameters:
args - 2 if Grib file and index file name given
Throws:
IOException - on gbx write


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.