ucar.nc2.dt.fmrc
Class FmrcDefinition

java.lang.Object
  extended by ucar.nc2.dt.fmrc.FmrcDefinition
All Implemented Interfaces:
FmrcCoordSys

public class FmrcDefinition
extends java.lang.Object
implements FmrcCoordSys

Defines the expected inventory of a Forecast Model Run Collection.

 Data Structures

  List VertTimeCoord
    double[] values

  List TimeCoord
    double[] offsetHour

  List RunSeq
    List Run - runHour dependent TimeCoord
      double hour
      TimeCoord

    List Grid
     String name
     VertTimeCoord - time dependent vertical coordinate
       VertCoord
       TimeCoord (optional)


 Abstractly, the data is a table:
   Run  Grid  TimeCoord  VertCoord
   Run  Grid  TimeCoord  VertCoord
   Run  Grid  TimeCoord  VertCoord
   ...

 We will use the notation ({} means list)
  {Run, Grid, TimeCoord, VertCoord}

 The simplest case would be if all runs have the same grids, which all use the same time coord, and each grid always
  uses the same vert coord :
 (1) {runTime} X {Grid, VertCoord} X TimeCoord      (X means product)

 The usual case is that there are multiple TimeCoords, but a grid always uses the same one:
 (2) {runTime} X {Grid, VertCoord, TimeCoord}

 Since all runTimes are the same, the definition only need be:
 (2d) {Grid, VertCoord, TimeCoord}

 Another case is that different run hours use different TimeCoords. We will call this a RunSeq, and we associate with each
 RunSeq the list of grids that use it:
   Run = runHour, TimeCoord
   RunSeq = {runHour, TimeCoord} X {Grid, VertCoord}

 Different grids use different RunSeqs, so we have a list of RunSeq:
 (3d) {{runHour, TimeCoord} X {Grid, VertCoord}}

 We can recast (2d), when all runHours are the same,  as:
 (2d') {TimeCoord X {Grid, VertCoord}}
 which means that we are grouping grids by unique TimeCoord. (1d) would be the case where there is only one in the list.

 Another case is when the VertCoord depends on the TimeCoord, but all run hours are the same:
 (4d) {TimeCoord X {Grid, VertCoord(TimeCoord)}}

 Which lead us to generalize a VertCoord to a time-dependent one, called VertTimeCoord.

 The most general case is then
   {{runHour, TimeCoord} X {Grid, VertTimeCoord}}

 

Author:
caron

Nested Class Summary
static class FmrcDefinition.Grid
           
 class FmrcDefinition.RunSeq
           
 
Nested classes/interfaces inherited from interface ucar.nc2.dt.fmr.FmrcCoordSys
FmrcCoordSys.TimeCoord, FmrcCoordSys.VertCoord
 
Field Summary
static java.lang.String[] fmrcDefinitionFiles
           
 
Constructor Summary
FmrcDefinition()
           
 
Method Summary
 void addVertCoordsFromCollectionInventory(FmrcInventory fmrc)
          Add just the vertical coord info to the definition
 FmrcCoordSys.TimeCoord findTimeCoordForVariable(java.lang.String searchName, java.util.Date runTime)
           
 FmrcCoordSys.VertCoord findVertCoordForVariable(java.lang.String searchName)
           
 java.util.List<FmrcDefinition.RunSeq> getRunSequences()
           
 java.lang.String getSuffixFilter()
           
 boolean hasVariable(java.lang.String searchName)
           
static void main(java.lang.String[] args)
           
 org.jdom.Document makeDefinitionXML()
          Create an XML document for the entire collection
 void makeFromCollectionInventory(FmrcInventory fmrc)
           
 boolean readDefinitionXML(java.lang.String xmlLocation)
           
 java.lang.String writeDefinitionXML()
           
 void writeDefinitionXML(java.io.OutputStream os)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fmrcDefinitionFiles

public static java.lang.String[] fmrcDefinitionFiles
Constructor Detail

FmrcDefinition

public FmrcDefinition()
Method Detail

getSuffixFilter

public java.lang.String getSuffixFilter()

getRunSequences

public java.util.List<FmrcDefinition.RunSeq> getRunSequences()

hasVariable

public boolean hasVariable(java.lang.String searchName)
Specified by:
hasVariable in interface FmrcCoordSys

findVertCoordForVariable

public FmrcCoordSys.VertCoord findVertCoordForVariable(java.lang.String searchName)
Specified by:
findVertCoordForVariable in interface FmrcCoordSys

findTimeCoordForVariable

public FmrcCoordSys.TimeCoord findTimeCoordForVariable(java.lang.String searchName,
                                                       java.util.Date runTime)
Specified by:
findTimeCoordForVariable in interface FmrcCoordSys

writeDefinitionXML

public java.lang.String writeDefinitionXML()

writeDefinitionXML

public void writeDefinitionXML(java.io.OutputStream os)
                        throws java.io.IOException
Throws:
java.io.IOException

makeDefinitionXML

public org.jdom.Document makeDefinitionXML()
Create an XML document for the entire collection

Returns:
an XML document for the entire collection

readDefinitionXML

public boolean readDefinitionXML(java.lang.String xmlLocation)
                          throws java.io.IOException
Throws:
java.io.IOException

makeFromCollectionInventory

public void makeFromCollectionInventory(FmrcInventory fmrc)

addVertCoordsFromCollectionInventory

public void addVertCoordsFromCollectionInventory(FmrcInventory fmrc)
Add just the vertical coord info to the definition

Parameters:
fmrc - the collection inventory

main

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