ucar.nc2.dataset
Class CoordSysBuilder

java.lang.Object
  extended by ucar.nc2.dataset.CoordSysBuilder
All Implemented Interfaces:
CoordSysBuilderIF

public class CoordSysBuilder
extends java.lang.Object
implements CoordSysBuilderIF

Abstract class for implementing Convention-specific parsing of netCDF files. You can use an NcML file alone (use registerNcML()) if file uses a convention attribute. If not, you must implement a class that implements isMine() to identify your files, and call wrapNcML in the augmentDataset method (see eg ATDRadarConvention class).

Subclasses Info:

    // identify which variables are coordinate axes
    // default: 1) coordinate variables 2) variables with _coordinateAxisType attribute 3) variables listed
    // in a coordinates attribute on another variable.
    findCoordinateAxes( ncDataset);

    // identify which variables are used to describe coordinate system
    findCoordinateSystems( ncDataset);
    // identify which variables are used to describe coordinate transforms
    findCoordinateTransforms( ncDataset);
    // turn Variables into CoordinateAxis objects
    makeCoordinateAxes( ncDataset);
    // make Coordinate Systems for all Coordinate Systems Variables
    makeCoordinateSystems( ncDataset);

    // Assign explicit CoordinateSystem objects to variables
    assignExplicitCoordinateSystems( ncDataset);
    makeCoordinateSystemsImplicit( ncDataset);
    if (useMaximalCoordSys)
      makeCoordinateSystemsMaximal( ncDataset);

    makeCoordinateTransforms( ncDataset);
    assignCoordinateTransforms( ncDataset);
 

Version:
$Revision:51 $ $Date:2006-07-12 17:13:13Z $
Author:
caron

Nested Class Summary
 class CoordSysBuilder.VarProcess
          Wrap each variable in the dataset with a VarProcess object.
 
Field Summary
static java.lang.String resourcesDir
          resource path
 
Constructor Summary
CoordSysBuilder()
           
 
Method Summary
static void addCoordinateSystems(NetcdfDataset ds, CancelTask cancelTask)
          Add Coordinate information to a NetcdfDataset using a registered Convention parsing class.
 void addUserAdvice(java.lang.String advice)
          Give advice for a user trying to figure out why things arent working
 void augmentDataset(NetcdfDataset ncDataset, CancelTask cancelTask)
          This is where subclasses make changes to the dataset, like adding new variables, attribuites, etc.
 void buildCoordinateSystems(NetcdfDataset ncDataset)
          Heres where the work is to identify coordinate axes and coordinate systems.
static boolean getUseMaximalCoordSys()
          Get whether to make records into Structures.
static VariableDS makeDummyTransformVariable(NetcdfDataset ds, CoordinateTransform ct)
          Deprecated. use CoordTransBuilder.makeDummyTransformVariable
static void registerConvention(java.lang.String conventionName, java.lang.Class c)
          Register a class that implements a Convention.
static void registerConvention(java.lang.String conventionName, java.lang.String className)
          Register a class that implements a Convention.
static void registerNcML(java.lang.String conventionName, java.lang.String ncmlLocation)
          Register an NcML file that implements a Convention by wrappping the dataset in the NcML.
 void setConventionUsed(java.lang.String convName)
          Pass in the name of the Convention used to locate this CoordSysBuilderIF.
static void setUseMaximalCoordSys(boolean b)
          If true, assign implicit CoordinateSystem objects to variables that dont have one yet.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

resourcesDir

public static java.lang.String resourcesDir
resource path

Constructor Detail

CoordSysBuilder

public CoordSysBuilder()
Method Detail

registerNcML

public static void registerNcML(java.lang.String conventionName,
                                java.lang.String ncmlLocation)
Register an NcML file that implements a Convention by wrappping the dataset in the NcML. It is then processed by CoordSysBuilder, using the _Coordinate attributes.

Parameters:
conventionName - name of Convention, must be in the "Conventions" global attribute.
ncmlLocation - location of NcML file, may be local file or URL.
See Also:
NcMLReader.wrapNcML(ucar.nc2.dataset.NetcdfDataset, java.lang.String, ucar.nc2.util.CancelTask)

registerConvention

public static void registerConvention(java.lang.String conventionName,
                                      java.lang.Class c)
Register a class that implements a Convention.

Parameters:
conventionName - name of Convention. This name will be used to look in the "Conventions" global attribute. Otherwise, you must implement the isMine() static method.
c - implementation of CoordSysBuilderIF that parses those kinds of netcdf files.

registerConvention

public static void registerConvention(java.lang.String conventionName,
                                      java.lang.String className)
                               throws java.lang.ClassNotFoundException
Register a class that implements a Convention.

Parameters:
conventionName - name of Convention. This name will be used to look in the "Conventions" global attribute. Otherwise, you must implement the isMine() static method.
className - name of class that implements CoordSysBuilderIF.
Throws:
java.lang.ClassNotFoundException

setUseMaximalCoordSys

public static void setUseMaximalCoordSys(boolean b)
If true, assign implicit CoordinateSystem objects to variables that dont have one yet. Default value is false.

See Also:
makeCoordinateSystemsMaximal(ucar.nc2.dataset.NetcdfDataset)

getUseMaximalCoordSys

public static boolean getUseMaximalCoordSys()
Get whether to make records into Structures.


addCoordinateSystems

public static void addCoordinateSystems(NetcdfDataset ds,
                                        CancelTask cancelTask)
                                 throws java.io.IOException
Add Coordinate information to a NetcdfDataset using a registered Convention parsing class.

Parameters:
ds - the NetcdfDataset to modify
cancelTask - allow user to bail out.
Throws:
java.io.IOException

setConventionUsed

public void setConventionUsed(java.lang.String convName)
Description copied from interface: CoordSysBuilderIF
Pass in the name of the Convention used to locate this CoordSysBuilderIF.

Specified by:
setConventionUsed in interface CoordSysBuilderIF
Parameters:
convName - the name of the Convention

addUserAdvice

public void addUserAdvice(java.lang.String advice)
Description copied from interface: CoordSysBuilderIF
Give advice for a user trying to figure out why things arent working

Specified by:
addUserAdvice in interface CoordSysBuilderIF

augmentDataset

public void augmentDataset(NetcdfDataset ncDataset,
                           CancelTask cancelTask)
                    throws java.io.IOException
This is where subclasses make changes to the dataset, like adding new variables, attribuites, etc.

Specified by:
augmentDataset in interface CoordSysBuilderIF
Parameters:
ncDataset - modify this dataset
cancelTask - give user a chance to bail out
Throws:
java.io.IOException

buildCoordinateSystems

public void buildCoordinateSystems(NetcdfDataset ncDataset)
Heres where the work is to identify coordinate axes and coordinate systems.

Specified by:
buildCoordinateSystems in interface CoordSysBuilderIF
Parameters:
ncDataset - modify this dataset

makeDummyTransformVariable

public static VariableDS makeDummyTransformVariable(NetcdfDataset ds,
                                                    CoordinateTransform ct)
Deprecated. use CoordTransBuilder.makeDummyTransformVariable