ucar.bufr
Class Index

java.lang.Object
  extended by ucar.bufr.Index

public final class Index
extends java.lang.Object

An "in memory" index for Bufr files. May be constructed by scanning the file with BufrInput, or by reading a "Bufr File Index" that was created by BufrIndexer. This has all the information in it needed to construct a netcdf object. see IndexFormat.txt .

Author:
rkambic

Nested Class Summary
 class Index.BufrObs
          class to represent each observation in the index.
static class Index.coordinate
          class to represent a coordinate of a point (station) in the index.
static class Index.parameter
          class to represent a Parameter in the index.
 
Field Summary
static java.lang.String current_index_version
          used to check versions of already created indexes.
 
Constructor Summary
Index()
          Constructor for creating an Index from the Bufr file.
 
Method Summary
 void addGlobalAttribute(java.lang.String name, java.lang.String value)
          adds a GlobalAttribute to the index.
 void addObservation(java.lang.String name, java.lang.String ISOdate, int dim, float latitude, float longitude, int altitude, long DDSoffset, long obsOffset, int bitPos, int bitBuf)
          adds a Observation to the index.
 void addParameter(java.lang.String key, int dimension, boolean isNumeric, java.lang.String name, java.lang.String units)
          adds a Parameter to the index.
 void finish()
          Sort the index information for quick access.
 Index.BufrObs getBufrObs(java.lang.String name, java.lang.String ISOdate, int dim, long DDSoffset, long obsOffset, int bitPos, int bitBuf)
           
 java.util.HashMap getCoordinates()
          coordinates of the locations.
 java.util.HashMap getGlobalAttributes()
          GlobalAttributes of index.
 java.util.ArrayList getLocations()
          locations in this dataset.
 int getNumberObs()
          numberObs in this dataset.
 java.util.HashMap getObservations()
          observations of index, one ArrayList for each location.
 java.util.HashMap getObsLocations()
          locations in this observation time.
 java.util.ArrayList getObsTimes()
          observation times in this dataset.
 java.util.ArrayList getParameters()
          Parameters of index.
static void main(java.lang.String[] args)
          main.
 boolean open(java.lang.String reference)
          open Bufr Index file for scanning.
 boolean open(java.lang.String reference, java.io.InputStream ios)
          open Bufr Index file for scanning.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

current_index_version

public static final java.lang.String current_index_version
used to check versions of already created indexes.

See Also:
Constant Field Values
Constructor Detail

Index

public Index()
Constructor for creating an Index from the Bufr file. Use the addXXX() methods.

Method Detail

open

public final boolean open(java.lang.String reference)
                   throws java.io.IOException
open Bufr Index file for scanning.

Parameters:
reference - URL or local filename of Bufr Index file
Returns:
false if does not match current version; you should regenerate it in that case.
Throws:
java.io.IOException

open

public final boolean open(java.lang.String reference,
                          java.io.InputStream ios)
                   throws java.io.IOException
open Bufr Index file for scanning.

Parameters:
reference - URL or local filename of Bufr Index file
ios - input stream
Returns:
false if does not match current version; you should regenerate it in that case.
Throws:
java.io.IOException

finish

public final void finish()
Sort the index information for quick access.


getGlobalAttributes

public final java.util.HashMap getGlobalAttributes()
GlobalAttributes of index.

Returns:
HashMap of type GlobalAttributes.

getNumberObs

public final int getNumberObs()
numberObs in this dataset.

Returns:
numberObs of locations.

getLocations

public final java.util.ArrayList getLocations()
locations in this dataset.

Returns:
ArrayList of locations.

getObservations

public final java.util.HashMap getObservations()
observations of index, one ArrayList for each location.

Returns:
HashMap of type Observation.

getObsTimes

public final java.util.ArrayList getObsTimes()
observation times in this dataset.

Returns:
ArrayList of observation times.

getObsLocations

public final java.util.HashMap getObsLocations()
locations in this observation time.

Returns:
HashMap of type location Observation.

getCoordinates

public final java.util.HashMap getCoordinates()
coordinates of the locations.

Returns:
HashMap of type coordinate.

getParameters

public final java.util.ArrayList getParameters()
Parameters of index.

Returns:
ArrayList of type Parameters.

addObservation

public final void addObservation(java.lang.String name,
                                 java.lang.String ISOdate,
                                 int dim,
                                 float latitude,
                                 float longitude,
                                 int altitude,
                                 long DDSoffset,
                                 long obsOffset,
                                 int bitPos,
                                 int bitBuf)
adds a Observation to the index.

Parameters:
name -
ISOdate -
dim -
latitude -
longitude -
altitude -
DDSoffset -
obsOffset -
bitPos -
bitBuf -

addGlobalAttribute

public final void addGlobalAttribute(java.lang.String name,
                                     java.lang.String value)
adds a GlobalAttribute to the index.

Parameters:
name - GlobalAttribute
value - String

getBufrObs

public Index.BufrObs getBufrObs(java.lang.String name,
                                java.lang.String ISOdate,
                                int dim,
                                long DDSoffset,
                                long obsOffset,
                                int bitPos,
                                int bitBuf)

addParameter

public final void addParameter(java.lang.String key,
                               int dimension,
                               boolean isNumeric,
                               java.lang.String name,
                               java.lang.String units)
adds a Parameter to the index.

Parameters:
key -
dimension -
isNumeric -
name -
units -

main

public static void main(java.lang.String[] args)
                 throws java.io.IOException
main.

Parameters:
args - empty
Throws:
java.io.IOException