Class PointObFactory

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

public class PointObFactory extends Object
Factory for dealing with point observations
Author:
IDV Development Team
  • Field Details

    • OA_GRID_DEFAULT

      public static final float OA_GRID_DEFAULT
      OA Grid Default value
      See Also:
  • Constructor Details

    • PointObFactory

      public PointObFactory()
      Constructor
  • Method Details

    • 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.dt.point.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, DataChoice dataChoice, double binRoundTo, double binWidth, ucar.unidata.geoloc.LatLonRect llr, 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
    • makePointObs

      public static FieldImpl makePointObs(ucar.nc2.ft.FeatureDatasetPoint input, double binRoundTo, double binWidth, ucar.unidata.geoloc.LatLonRect llr, 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
    • makePointObsWRF

      public static FieldImpl makePointObsWRF(ucar.nc2.ft.FeatureDatasetPoint input, double binRoundTo, double binWidth, ucar.unidata.geoloc.LatLonRect llr, DateSelection dateSelection, boolean sample) throws Exception
      _more_
      Parameters:
      input - _more_
      binRoundTo - _more_
      binWidth - _more_
      llr - _more_
      dateSelection - _more_
      sample - _more_
      Returns:
      _more_
      Throws:
      Exception - _more_
    • 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
    • heatIndex

      public static double heatIndex(double T, double RH)
      Create heatIndex from temperature and relative humidity.
      Parameters:
      T - temperature (F)
      RH - wind direction (%)
    • windChill

      public static double windChill(double speed, double T)
      WC = 35.74 + 0.6215 * (T - 273.15) - 35.75 * (WS)**0.16 + 0.4275 * ( T - 273.15) * (WS)**0.16
      Parameters:
      speed - wind speed (mph)
      T - temperature(F)
    • relativeHumidity

      public static double relativeHumidity(double T, double TD)
      100*(EXP((17.625*TD)/(243.04+TD))/EXP((17.625*T)/(243.04+T)))
      Parameters:
      T - temperature (Celsius)
      TD - dewPoint(Celsius)