ucar.grib.grib2
Class Grib2WriteIndex

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

public class Grib2WriteIndex
extends java.lang.Object

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

Author:
Robb Kambic

Nested Class Summary
 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(java.io.File grib, java.io.File gbx, java.lang.String gbxName, ucar.unidata.io.RandomAccessFile raf, boolean makeIndex)
          extend a Grib file index; optionally create an in-memory index.
 GridIndex extendGribIndex(java.io.File grib, java.io.File gbx, java.lang.String gribName, java.lang.String gbxName, boolean makeIndex)
          extend a Grib file index; optionally create an in-memory index.
 boolean extendGribIndex(java.lang.String gbxName, ucar.unidata.io.RandomAccessFile inputRaf, long rafLastModified, java.io.DataOutputStream out)
          extend a Grib file index
static void main(java.lang.String[] args)
          creates a Grib2 index for given Grib2 file.
 boolean rawGridIndex(java.lang.String gbxName, java.util.List<Grib2WriteIndex.RawRecord> recordList, java.util.Map<java.lang.String,GribGDSVariablesIF> gdsMap)
          makes a raw representation of GridIndex
 void setDebug(boolean flag)
           
 void setVerbose(boolean flag)
           
 GridIndex writeGribIndex(java.io.File grib, java.lang.String gbxName, ucar.unidata.io.RandomAccessFile raf, boolean makeIndex)
          extend a Grib file index; optionally create an in-memory index.
 GridIndex writeGribIndex(java.io.File grib, java.lang.String gribName, java.lang.String gbxName, boolean makeIndex)
          create a Grib file index; optionally create an in-memory index.
 boolean writeGribIndex(ucar.unidata.io.RandomAccessFile inputRaf, long rafLastModified, java.io.DataOutputStream out)
          Write a Grib file index.
 
Methods inherited from class java.lang.Object
equals, 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(java.io.File grib,
                                      java.lang.String gribName,
                                      java.lang.String gbxName,
                                      boolean makeIndex)
                               throws java.io.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:
java.io.IOException - on gbx write

writeGribIndex

public final GridIndex writeGribIndex(java.io.File grib,
                                      java.lang.String gbxName,
                                      ucar.unidata.io.RandomAccessFile raf,
                                      boolean makeIndex)
                               throws java.io.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:
java.io.IOException - on gbx write

writeGribIndex

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

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

extendGribIndex

public final GridIndex extendGribIndex(java.io.File grib,
                                       java.io.File gbx,
                                       java.lang.String gribName,
                                       java.lang.String gbxName,
                                       boolean makeIndex)
                                throws java.io.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:
java.io.IOException - on gbx write

extendGribIndex

public final GridIndex extendGribIndex(java.io.File grib,
                                       java.io.File gbx,
                                       java.lang.String gbxName,
                                       ucar.unidata.io.RandomAccessFile raf,
                                       boolean makeIndex)
                                throws java.io.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:
java.io.IOException - on gbx write

extendGribIndex

public final boolean extendGribIndex(java.lang.String gbxName,
                                     ucar.unidata.io.RandomAccessFile inputRaf,
                                     long rafLastModified,
                                     java.io.DataOutputStream out)
                              throws java.io.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:
java.io.IOException - on gbx write

rawGridIndex

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

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

setDebug

public void setDebug(boolean flag)

setVerbose

public void setVerbose(boolean flag)

main

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

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