|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.nc2.dataset.CoordSysBuilder
public class CoordSysBuilder
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);
| Nested Class Summary | |
|---|---|
class |
CoordSysBuilder.VarProcess
Wrap each variable in the dataset with a VarProcess object. |
| Field Summary | |
|---|---|
protected java.lang.String |
conventionName
|
protected boolean |
debug
|
protected java.lang.StringBuffer |
parseInfo
|
static java.lang.String |
resourcesDir
resource path |
protected boolean |
showRejects
|
protected java.lang.StringBuffer |
userAdvice
|
protected java.util.ArrayList |
varList
|
| 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 |
protected void |
assignCoordinateTransforms(NetcdfDataset ncDataset)
Assign CoordinateTransform objects to Coordinate Systems. |
protected void |
assignExplicitCoordinateSystems(NetcdfDataset ncDataset)
Assign explicit CoordinateSystem objects to variables. |
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. |
protected void |
findCoordinateAxes(NetcdfDataset ncDataset)
Identify coordinate axes, set VarProcess.isCoordinateAxis = true. |
protected CoordSysBuilder.VarProcess |
findCoordinateAxis(java.lang.String name)
|
protected void |
findCoordinateSystems(NetcdfDataset ncDataset)
Identify coordinate systems, set VarProcess.isCoordinateSystem = true. |
protected void |
findCoordinateTransforms(NetcdfDataset ncDataset)
Identify coordinate transforms, set VarProcess.isCoordinateTransform = true. |
protected CoordSysBuilder.VarProcess |
findVarProcess(java.lang.String name)
|
protected AxisType |
getAxisType(NetcdfDataset ncDataset,
VariableEnhanced v)
Identify what kind of AxisType the named variable is. |
java.lang.String |
getConventionUsed()
Get the name of the Convention. |
static boolean |
getUseMaximalCoordSys()
Get whether to make records into Structures. |
protected boolean |
hasXY(java.util.List coordAxes)
|
protected boolean |
isCoordinateAxisForVariable(Variable axis,
VariableEnhanced v)
Does this axis "fit" this variable. |
protected void |
makeCoordinateAxes(NetcdfDataset ncDataset)
Take previously identified Coordinate Axis and Coordinate Variables and make them into a CoordinateAxis. |
protected void |
makeCoordinateSystems(NetcdfDataset ncDataset)
Take all previously identified Coordinate Systems and create a CoordinateSystem object. |
protected void |
makeCoordinateSystemsImplicit(NetcdfDataset ncDataset)
Make implicit CoordinateSystem objects for variables that dont already have one, by using the variables' list of coordinate axes, and any coordinateVariables for it. |
protected void |
makeCoordinateSystemsMaximal(NetcdfDataset ncDataset)
If a variable still doesnt have a coordinate system, use hueristics to try to find one that was probably forgotten. |
protected CoordinateTransform |
makeCoordinateTransform(NetcdfDataset ds,
Variable ctv)
|
protected void |
makeCoordinateTransforms(NetcdfDataset ncDataset)
Take all previously identified Coordinate Transforms and create a CoordinateTransform object by calling CoordTransBuilder.makeCoordinateTransform(). |
protected VariableDS |
makeCoordinateTransformVariable(NetcdfDataset ds,
CoordinateTransform ct)
|
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 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static java.lang.String resourcesDir
protected java.lang.String conventionName
protected java.util.ArrayList varList
protected java.lang.StringBuffer parseInfo
protected java.lang.StringBuffer userAdvice
protected boolean debug
protected boolean showRejects
| Constructor Detail |
|---|
public CoordSysBuilder()
| Method Detail |
|---|
public static void registerNcML(java.lang.String conventionName,
java.lang.String ncmlLocation)
conventionName - name of Convention, must be in the "Conventions" global attribute.ncmlLocation - location of NcML file, may be local file or URL.NcMLReader.wrapNcML(ucar.nc2.dataset.NetcdfDataset, java.lang.String, ucar.nc2.util.CancelTask)
public static void registerConvention(java.lang.String conventionName,
java.lang.Class c)
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.
public static void registerConvention(java.lang.String conventionName,
java.lang.String className)
throws java.lang.ClassNotFoundException
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.
java.lang.ClassNotFoundExceptionpublic static void setUseMaximalCoordSys(boolean b)
makeCoordinateSystemsMaximal(ucar.nc2.dataset.NetcdfDataset)public static boolean getUseMaximalCoordSys()
public static void addCoordinateSystems(NetcdfDataset ds,
CancelTask cancelTask)
throws java.io.IOException
ds - the NetcdfDataset to modifycancelTask - allow user to bail out.
java.io.IOExceptionpublic void setConventionUsed(java.lang.String convName)
CoordSysBuilderIF
setConventionUsed in interface CoordSysBuilderIFconvName - the name of the Conventionpublic java.lang.String getConventionUsed()
CoordSysBuilderIF
getConventionUsed in interface CoordSysBuilderIFpublic void addUserAdvice(java.lang.String advice)
CoordSysBuilderIF
addUserAdvice in interface CoordSysBuilderIF
public void augmentDataset(NetcdfDataset ncDataset,
CancelTask cancelTask)
throws java.io.IOException
augmentDataset in interface CoordSysBuilderIFncDataset - modify this datasetcancelTask - give user a chance to bail out
java.io.IOException
protected AxisType getAxisType(NetcdfDataset ncDataset,
VariableEnhanced v)
ncDataset - for this datasetv - a variable alreaddy identified as a Coodinate Axis
public void buildCoordinateSystems(NetcdfDataset ncDataset)
buildCoordinateSystems in interface CoordSysBuilderIFncDataset - modify this datasetprotected void findCoordinateAxes(NetcdfDataset ncDataset)
protected void findCoordinateSystems(NetcdfDataset ncDataset)
protected void findCoordinateTransforms(NetcdfDataset ncDataset)
protected void makeCoordinateAxes(NetcdfDataset ncDataset)
protected void makeCoordinateSystems(NetcdfDataset ncDataset)
protected void assignExplicitCoordinateSystems(NetcdfDataset ncDataset)
protected void makeCoordinateSystemsImplicit(NetcdfDataset ncDataset)
ncDataset - protected void makeCoordinateSystemsMaximal(NetcdfDataset ncDataset)
ncDataset -
protected boolean isCoordinateAxisForVariable(Variable axis,
VariableEnhanced v)
protected boolean hasXY(java.util.List coordAxes)
protected void makeCoordinateTransforms(NetcdfDataset ncDataset)
protected CoordinateTransform makeCoordinateTransform(NetcdfDataset ds,
Variable ctv)
protected void assignCoordinateTransforms(NetcdfDataset ncDataset)
protected CoordSysBuilder.VarProcess findVarProcess(java.lang.String name)
protected CoordSysBuilder.VarProcess findCoordinateAxis(java.lang.String name)
protected VariableDS makeCoordinateTransformVariable(NetcdfDataset ds,
CoordinateTransform ct)
public static VariableDS makeDummyTransformVariable(NetcdfDataset ds,
CoordinateTransform ct)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||