ucar.unidata.data.point
Class PointObFactory

java.lang.Object
  extended by ucar.unidata.data.point.PointObFactory

public class PointObFactory
extends Object

Factory for dealing with point observations

Author:
IDV Development Team

Field Summary
static float OA_GRID_DEFAULT
          OA Grid Default value
 
Constructor Summary
PointObFactory()
          Constructor
 
Method Summary
static FieldImpl barnes(FieldImpl pointObs, RealType type, float xSpacing, float ySpacing, int numPasses)
          Perform an object analysis on a set of point obs
static FieldImpl barnes(FieldImpl pointObs, RealType type, float xSpacing, float ySpacing, int numPasses, float gain, float scaleLength, au.gov.bom.aifs.osa.analysis.Barnes.AnalysisParameters params, FieldImpl firstGuessField)
          Perform an object analysis on a set of point obs
static FlatField barnesOneTime(FieldImpl pointObs, RealType type, float xSpacing, float ySpacing, int numPasses)
          Do the analysis on the single time.
static FlatField barnesOneTime(FieldImpl pointObs, RealType type, float xSpacing, float ySpacing, int numPasses, float gain, float scaleLength, au.gov.bom.aifs.osa.analysis.Barnes.AnalysisParameters params)
          Do the analysis on the single time.
static FlatField barnesOneTime(FieldImpl pointObs, RealType type, float xSpacing, float ySpacing, int numPasses, float gain, float scaleLength, au.gov.bom.aifs.osa.analysis.Barnes.AnalysisParameters params, FlatField firstGuess)
          Do the analysis on the single time.
static List binTimes(List times, double binRoundTo, double binWidth)
          Bin the times
static FieldImpl extractParameter(FieldImpl obs, RealType parameter)
          Extract the parameter from some point obs
static FieldImpl extractParameter(FieldImpl obs, String paramName)
          Extract the parameter from some point obs
static double[] getBoundingBox(FieldImpl pointObs)
          Get the bounding box of the given obs
static double[] getBoundingBoxOneTime(FieldImpl pointObs)
          Get the bounding box of the given obs
static List<PointOb> getPointObs(FieldImpl field)
          Get the list of PointOb objects from the given field
static FieldImpl makePointCloud(FieldImpl pointObs, String param)
          Make a point cloud structure from point obs
static PointOb makePointOb(EarthLocation el)
          Make a PointOb from an EarthLocation.
static PointOb makePointOb(EarthLocation el, DateTime dt)
          Make a PointOb from an EarthLocation.
static PointOb makePointOb(EarthLocation el, DateTime dt, Tuple tuple)
          Make a point ob
static FieldImpl makePointObField(PointOb point)
          Returns a point observation as a FieldImpl of type.
static FieldImpl makePointObs(EarthLocation el)
          Make a FieldImpl of PointOb-s from an EarthLocation.
static FieldImpl makePointObs(EarthLocation el, DateTime dt)
          Make a FieldImpl of PointOb-s from an EarthLocation.
static FieldImpl makePointObs(ucar.nc2.ft.FeatureDatasetPoint input, double binRoundTo, double binWidth, ucar.unidata.geoloc.LatLonRect llr, ucar.unidata.util.DateSelection dateSelection, boolean sample)
          Make point obs
static FieldImpl makePointObs(PointOb po)
          Make a FieldImpl from a PointOb.
static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input)
          Make point obs from a PointObsDataset
static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input, double binRoundTo, double binWidth)
          Make point obs
static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input, double binRoundTo, double binWidth, ucar.unidata.geoloc.LatLonRect llr)
          Make point obs
static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input, double binRoundTo, double binWidth, ucar.unidata.geoloc.LatLonRect llr, boolean sample)
          Make point obs
static FieldImpl makePointObsFromField(FieldImpl input)
          Take a field of data and turn it into a field of PointObs.
static FieldImpl makePointObsFromField(FieldImpl input, double binRoundTo, double binWidth)
          Take a field of data and turn it into a field of PointObs.
static FieldImpl makeTimeSequenceOfPointObs(FieldImpl pointObs)
          From a field of point observations, reorder them with time as the outer dimension.
static FieldImpl makeTimeSequenceOfPointObs(FieldImpl pointObs, int lumpMinutes)
          From a field of point observations, reorder them with time as the outer dimension.
static FieldImpl makeTimeSequenceOfPointObs(List pointObs, int lumpMinutes, int componentIndex)
          From a field of point observations, reorder them with time as the outer dimension.
static ucar.nc2.ft.point.writer.CFPointObWriter makeWriter(DataOutputStream dos, TupleType type, int[] skipIndices, int defaultStringLength, String altUnit, int cnt, int[] slengths)
          Make a CFPointObWriter
static FieldImpl mergeData(List datas)
          Merge a List of FieldImpls of point obs into one.
static FieldImpl removeTimeDimension(FieldImpl pointObs)
          Remove the time dimension from a field of point obs, returning just and indexed list of the obs
static FieldImpl subSet(FieldImpl pointObs, ucar.unidata.geoloc.LatLonRect bounds)
          Returns a subset of the field of point observations that lie within the boundaries of the LinearLatLonSet.
static FieldImpl subSet(FieldImpl pointObs, LinearLatLonSet bounds)
          Returns a subset of the field of point observations that lie within the boundaries of the LinearLatLonSet.
static void writeToNetcdf(File file, FieldImpl field)
          Write the PointObs contained in the given field as a netcdf file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OA_GRID_DEFAULT

public static final float OA_GRID_DEFAULT
OA Grid Default value

See Also:
Constant Field Values
Constructor Detail

PointObFactory

public PointObFactory()
Constructor

Method Detail

makePointObField

public static FieldImpl makePointObField(PointOb point)
                                  throws VisADException,
                                         RemoteException
Returns a point observation as a FieldImpl of type. The type is:
  (Time -> ((lat, lon, alt) -> (data)))
 

Parameters:
point - point observation
Returns:
PointOb as a field
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

makePointCloud

public static FieldImpl makePointCloud(FieldImpl pointObs,
                                       String param)
                                throws VisADException,
                                       RemoteException
Make a point cloud structure from point obs

Parameters:
pointObs - the point obs
param - the parameter to extract - null if want all
Returns:
a PointCloud (time->((index)->((Latitude, Longitude, Altitude),param)))
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

makeTimeSequenceOfPointObs

public static FieldImpl makeTimeSequenceOfPointObs(FieldImpl pointObs)
                                            throws VisADException,
                                                   RemoteException
From a field of point observations, reorder them with time as the outer dimension.

Parameters:
pointObs - Field of point observations (index -> pointobs)
Returns:
time sequence of obs (time -> (index -> pointobs))
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

makeTimeSequenceOfPointObs

public static FieldImpl makeTimeSequenceOfPointObs(FieldImpl pointObs,
                                                   int lumpMinutes)
                                            throws VisADException,
                                                   RemoteException
From a field of point observations, reorder them with time as the outer dimension.

Parameters:
pointObs - Field of point observations (index -> pointobs)
lumpMinutes - If greater then 0 is used to lump the times of the point obs together
Returns:
time sequence of obs (time -> (index -> pointobs))
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

makeTimeSequenceOfPointObs

public static FieldImpl makeTimeSequenceOfPointObs(List pointObs,
                                                   int lumpMinutes,
                                                   int componentIndex)
                                            throws VisADException,
                                                   RemoteException
From a field of point observations, reorder them with time as the outer dimension. If componentIndex > -1 then we extract that real value from the observation tuple and use that in the range. We also skip the intermediate index field and only use the first PointOb for each time step

Parameters:
pointObs - Field of point observations (index -> pointobs)
lumpMinutes - If greater then 0 is used to lump the times of the point obs together
componentIndex - If >= 0 then make a T->componentvalue field
Returns:
time sequence of obs (time -> (index -> pointobs))
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

subSet

public static FieldImpl subSet(FieldImpl pointObs,
                               ucar.unidata.geoloc.LatLonRect bounds)
                        throws VisADException,
                               RemoteException
Returns a subset of the field of point observations that lie within the boundaries of the LinearLatLonSet.

Parameters:
pointObs - set of obs.
bounds - LinearLatLonSet bounding box
Returns:
subset within the bounds
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

subSet

public static FieldImpl subSet(FieldImpl pointObs,
                               LinearLatLonSet bounds)
                        throws VisADException,
                               RemoteException
Returns a subset of the field of point observations that lie within the boundaries of the LinearLatLonSet.

Parameters:
pointObs - set of obs.
bounds - LinearLatLonSet bounding box
Returns:
subset within the bounds
Throws:
RemoteException - Java RMI error
VisADException - VisAD Error

getPointObs

public static List<PointOb> getPointObs(FieldImpl field)
                                 throws VisADException,
                                        RemoteException
Get the list of PointOb objects from the given field

Parameters:
field - the field that contains the PointObs
Returns:
List of PointObs
Throws:
RemoteException - on badness
VisADException - on badness

writeToNetcdf

public static void writeToNetcdf(File file,
                                 FieldImpl field)
                          throws VisADException,
                                 RemoteException,
                                 IOException
Write the PointObs contained in the given field as a netcdf file

Parameters:
file - file to write to
field - The field
Throws:
IOException - on badness
RemoteException - on badness
VisADException - on badness

makeWriter

public static ucar.nc2.ft.point.writer.CFPointObWriter makeWriter(DataOutputStream dos,
                                                                  TupleType type,
                                                                  int[] skipIndices,
                                                                  int defaultStringLength,
                                                                  String altUnit,
                                                                  int cnt,
                                                                  int[] slengths)
                                                           throws Exception
Make a CFPointObWriter

Parameters:
dos - the output stream
type - the tupe
skipIndices - which indices to skip
defaultStringLength - the default string length
altUnit - the altitude unit
cnt - the number
slengths - string lengths
Returns:
the writer
Throws:
Exception - problem creating something

makePointObsFromField

public static FieldImpl makePointObsFromField(FieldImpl input)
                                       throws VisADException
Take a field of data and turn it into a field of PointObs. Right now, this assumes a surface data from an ADDE server.

Parameters:
input - FieldImpl of raw VisAD data
Returns:
field of PointObs
Throws:
VisADException - couldn't create the VisAD data

makePointObsFromField

public static FieldImpl makePointObsFromField(FieldImpl input,
                                              double binRoundTo,
                                              double binWidth)
                                       throws VisADException
Take a field of data and turn it into a field of PointObs. Right now, this assumes a surface data from an ADDE server.

Parameters:
input - FieldImpl of raw VisAD data
binRoundTo - time bin round to
binWidth - time bin size
Returns:
The data
Throws:
VisADException - On badness

makePointObs

public static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input)
                              throws Exception
Make point obs from a PointObsDataset

Parameters:
input - pointobs dataset to load
Returns:
FieldImpl of form (index) -> PointOb
Throws:
Exception - problem creating the ob or a cancel

binTimes

public static List binTimes(List times,
                            double binRoundTo,
                            double binWidth)
                     throws VisADException
Bin the times

Parameters:
times - List of times
binRoundTo - round to factor
binWidth - bin size
Returns:
Binned times
Throws:
VisADException - On badness

makePointObs

public static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input,
                                     double binRoundTo,
                                     double binWidth)
                              throws Exception
Make point obs

Parameters:
input - the data set
binRoundTo - bin round to
binWidth - time bin size
Returns:
The field
Throws:
Exception - On badness

makePointObs

public static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input,
                                     double binRoundTo,
                                     double binWidth,
                                     ucar.unidata.geoloc.LatLonRect llr)
                              throws Exception
Make point obs

Parameters:
input - the data set
binRoundTo - bin round to
binWidth - time bin size
llr - bounding box
Returns:
The field
Throws:
Exception - On badness

makePointObs

public static FieldImpl makePointObs(ucar.nc2.dt.PointObsDataset input,
                                     double binRoundTo,
                                     double binWidth,
                                     ucar.unidata.geoloc.LatLonRect llr,
                                     boolean sample)
                              throws Exception
Make point obs

Parameters:
input - the data set
binRoundTo - bin round to
binWidth - time bin size
llr - bounding box
sample - If true then just sample the data, i.e., read the first ob
Returns:
The field
Throws:
Exception - On badness

makePointObs

public static FieldImpl makePointObs(ucar.nc2.ft.FeatureDatasetPoint input,
                                     double binRoundTo,
                                     double binWidth,
                                     ucar.unidata.geoloc.LatLonRect llr,
                                     ucar.unidata.util.DateSelection dateSelection,
                                     boolean sample)
                              throws Exception
Make point obs

Parameters:
input - the data set
binRoundTo - bin round to
binWidth - time bin size
llr - bounding box
dateSelection - the date selection
sample - If true then just sample the data, i.e., read the first ob
Returns:
The field
Throws:
Exception - On badness

mergeData

public static FieldImpl mergeData(List datas)
                           throws VisADException
Merge a List of FieldImpls of point obs into one.

Parameters:
datas - List of FieldImpls of point obs
Returns:
merged FieldImpl
Throws:
VisADException - problem getting the data

makePointOb

public static PointOb makePointOb(EarthLocation el)
                           throws VisADException,
                                  RemoteException
Make a PointOb from an EarthLocation. The time and data are bogus.

Parameters:
el - EarthLocation to use
Returns:
PointOb
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

makePointOb

public static PointOb makePointOb(EarthLocation el,
                                  DateTime dt)
                           throws VisADException,
                                  RemoteException
Make a PointOb from an EarthLocation. The time and data are bogus.

Parameters:
el - EarthLocation to use
dt - DateTime to use
Returns:
PointOb
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

makePointOb

public static PointOb makePointOb(EarthLocation el,
                                  DateTime dt,
                                  Tuple tuple)
                           throws VisADException,
                                  RemoteException
Make a point ob

Parameters:
el - earth location
dt - date time
tuple - data
Returns:
the point ob
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

makePointObs

public static FieldImpl makePointObs(EarthLocation el)
                              throws VisADException,
                                     RemoteException
Make a FieldImpl of PointOb-s from an EarthLocation. The time and data are bogus.

Parameters:
el - EarthLocation to use
Returns:
FieldImpl of index->po
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

makePointObs

public static FieldImpl makePointObs(EarthLocation el,
                                     DateTime dt)
                              throws VisADException,
                                     RemoteException
Make a FieldImpl of PointOb-s from an EarthLocation. The time and data are bogus.

Parameters:
el - EarthLocation to use
dt - DateTime to use
Returns:
FieldImpl of index->po
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

makePointObs

public static FieldImpl makePointObs(PointOb po)
                              throws VisADException,
                                     RemoteException
Make a FieldImpl from a PointOb.

Parameters:
po - The ob
Returns:
FieldImpl of index->po
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

removeTimeDimension

public static FieldImpl removeTimeDimension(FieldImpl pointObs)
                                     throws VisADException,
                                            RemoteException
Remove the time dimension from a field of point obs, returning just and indexed list of the obs

Parameters:
pointObs - time field of obs
Returns:
indexed list of obs
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

barnes

public static FieldImpl barnes(FieldImpl pointObs,
                               RealType type,
                               float xSpacing,
                               float ySpacing,
                               int numPasses)
                        throws VisADException,
                               RemoteException
Perform an object analysis on a set of point obs

Parameters:
pointObs - Observations to analyze
type - RealTypes of parameter
xSpacing - x spacing (degrees)
ySpacing - y spacing (degrees)
numPasses - number of passes
Returns:
Grid of objectively analyzed data
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

barnes

public static FieldImpl barnes(FieldImpl pointObs,
                               RealType type,
                               float xSpacing,
                               float ySpacing,
                               int numPasses,
                               float gain,
                               float scaleLength,
                               au.gov.bom.aifs.osa.analysis.Barnes.AnalysisParameters params,
                               FieldImpl firstGuessField)
                        throws VisADException,
                               RemoteException
Perform an object analysis on a set of point obs

Parameters:
pointObs - Observations to analyze
type - RealTypes of parameter
xSpacing - x spacing (degrees)
ySpacing - y spacing (degrees)
numPasses - number of passes
gain - grid convergence/pass
scaleLength - search radius
params - analysis parameters - used to pass back computed vals
firstGuessField - The data to use for a first guess. May be null.
Returns:
Grid of objectively analyzed data
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

barnesOneTime

public static FlatField barnesOneTime(FieldImpl pointObs,
                                      RealType type,
                                      float xSpacing,
                                      float ySpacing,
                                      int numPasses)
                               throws VisADException,
                                      RemoteException
Do the analysis on the single time. Should be of the structure: (index -> PointOb)

Parameters:
pointObs - Observations to analyze
type - RealTypes of parameter
xSpacing - x spacing (degrees)
ySpacing - y spacing (degrees)
numPasses - number of passes
Returns:
Grid of objectively analyzed data
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

barnesOneTime

public static FlatField barnesOneTime(FieldImpl pointObs,
                                      RealType type,
                                      float xSpacing,
                                      float ySpacing,
                                      int numPasses,
                                      float gain,
                                      float scaleLength,
                                      au.gov.bom.aifs.osa.analysis.Barnes.AnalysisParameters params)
                               throws VisADException,
                                      RemoteException
Do the analysis on the single time. Should be of the structure: (index -> PointOb)

Parameters:
pointObs - Observations to analyze
type - RealTypes of parameter
xSpacing - x spacing (degrees)
ySpacing - y spacing (degrees)
numPasses - number of passes
gain - grid convergence/pass
scaleLength - search radius
params - analysis parameters - used to pass back computed vals
Returns:
Grid of objectively analyzed data
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

barnesOneTime

public static FlatField barnesOneTime(FieldImpl pointObs,
                                      RealType type,
                                      float xSpacing,
                                      float ySpacing,
                                      int numPasses,
                                      float gain,
                                      float scaleLength,
                                      au.gov.bom.aifs.osa.analysis.Barnes.AnalysisParameters params,
                                      FlatField firstGuess)
                               throws VisADException,
                                      RemoteException
Do the analysis on the single time. Should be of the structure: (index -> PointOb)

Parameters:
pointObs - Observations to analyze
type - RealTypes of parameter
xSpacing - x spacing (degrees)
ySpacing - y spacing (degrees)
numPasses - number of passes
gain - grid convergence/pass
scaleLength - search radius
params - analysis parameters - used to pass back computed vals
firstGuess - analysis parameters - used to pass back computed vals
Returns:
Grid of objectively analyzed data
Throws:
RemoteException - Java RMI error
VisADException - problem getting the data

extractParameter

public static FieldImpl extractParameter(FieldImpl obs,
                                         String paramName)
                                  throws VisADException,
                                         RemoteException
Extract the parameter from some point obs

Parameters:
obs - Field of point obs
paramName - name of the parameter to extract
Returns:
new FieldImpl where the data for each Point ob is just the param
Throws:
RemoteException - Java RMI exception
VisADException - problem extracting parameter

extractParameter

public static FieldImpl extractParameter(FieldImpl obs,
                                         RealType parameter)
                                  throws VisADException,
                                         RemoteException
Extract the parameter from some point obs

Parameters:
obs - Field of point obs
parameter - parameter to extract
Returns:
new FieldImpl where the data for each Point ob is just the param
Throws:
RemoteException - Java RMI exception
VisADException - problem extracting parameter

getBoundingBox

public static double[] getBoundingBox(FieldImpl pointObs)
                               throws VisADException,
                                      RemoteException
Get the bounding box of the given obs

Parameters:
pointObs - the obs
Returns:
bbox of the given time field- { minY, minX, maxY, maxX };
Throws:
RemoteException - On badness
VisADException - On badness

getBoundingBoxOneTime

public static double[] getBoundingBoxOneTime(FieldImpl pointObs)
                                      throws VisADException,
                                             RemoteException
Get the bounding box of the given obs

Parameters:
pointObs - the obs
Returns:
bbox of the given time field- { minY, minX, maxY, maxX };
Throws:
RemoteException - On badness
VisADException - On badness