Package ucar.nc2.internal.dataset
Class CoordSystemBuilder
- java.lang.Object
-
- ucar.nc2.internal.dataset.CoordSystemBuilder
-
- Direct Known Subclasses:
ADASConvention,ATDRadarConvention,AWIPSConvention,CF1Convention,Cosmic1Convention,DefaultConventions,FslWindProfiler,GDVConvention,GIEFConvention,HdfEosModisConvention,HdfEosOmiConvention,IFPSConvention,M3IOConvention,MADISStation,Nimbus,NUWGConvention,Suomi,UnidataObsConvention,WRFConvention,ZebraConvention
public class CoordSystemBuilder extends Object
Super class for implementing Convention-specific parsing of netCDF files. This class processes the "_Coordinate conventions", see https://www.unidata.ucar.edu/software/netcdf-java/current/reference/CoordinateAttributes.html A good strategy is for subclasses to add those attributes, and let this class construct the coordinate systems.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCoordSystemBuilder.Factoryprotected classCoordSystemBuilder.VarProcessClassifications of Variables into axis, systems and transforms
-
Field Summary
Fields Modifier and Type Field Description protected StringconventionNameprotected CoordinatesHelper.Buildercoordsprotected com.google.common.collect.Multimap<String,CoordSystemBuilder.VarProcess>coordVarsForDimensionprotected NetcdfDataset.Builder<?>datasetBuilderprotected booleandebugprotected static org.slf4j.Loggerlogprotected FormatterparseInfoprotected Group.BuilderrootGroupprotected FormatteruserAdviceprotected List<CoordSystemBuilder.VarProcess>varList
-
Constructor Summary
Constructors Modifier Constructor Description protectedCoordSystemBuilder(NetcdfDataset.Builder<?> datasetBuilder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddUserAdvice(String advice)protected voidassignCoordinateSystemsExplicit()Assign explicit CoordinateSystem objects to variables.protected voidassignCoordinateTransforms()Assign CoordinateTransform objects to Variables and Coordinate Systems.protected voidaugmentDataset(CancelTask cancelTask)protected voidbuildCoordinateSystems()static intcountDomainSize(Variable.Builder<?>... axes)protected CoordSystemBuilder.VarProcessfindCoordinateAxis(String name)protected CoordSystemBuilder.VarProcessfindVarProcess(String name, CoordSystemBuilder.VarProcess from)protected AxisTypegetAxisType(VariableDS.Builder vb)Identify what kind of AxisType the named variable is.StringgetConventionUsed()StringgetParseInfo()StringgetUserAdvice()protected voididentifyCoordinateAxes()Everything named in the coordinateAxes or coordinates attribute are Coordinate axes.protected voididentifyCoordinateSystems()Identify coordinate systems, using _Coordinate.Systems attribute.protected voididentifyCoordinateTransforms()Identify coordinate transforms, using _CoordinateTransforms attribute.protected booleanisCoordinateAxisForVariable(CoordinateAxis.Builder<?> axis, CoordSystemBuilder.VarProcess vp)Does this axis "fit" this variable.static booleanisCoordinateVariable(Variable.Builder<?> vb)Calculate if this is a classic coordinate variable: has same name as its first dimension.protected voidmakeCoordinateAxes()Take previously identified Coordinate Axis and Coordinate Variables and make them into a CoordinateAxis.protected voidmakeCoordinateSystems()protected voidmakeCoordinateSystemsImplicit()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 CoordinateTransform.BuildermakeCoordinateTransform(VariableDS.Builder<?> vb)protected voidmakeCoordinateTransforms()Take all previously identified Coordinate Transforms and create a CoordinateTransform object by calling CoordTransBuilder.makeCoordinateTransform().protected VariableDS.BuildermakeCoordinateTransformVariable(CoordinateTransform ct)Create a "dummy" Coordinate Transform Variable based on the given CoordinateTransform.protected voidsetConventionUsed(String convName)
-
-
-
Field Detail
-
log
protected static org.slf4j.Logger log
-
datasetBuilder
protected NetcdfDataset.Builder<?> datasetBuilder
-
rootGroup
protected Group.Builder rootGroup
-
coords
protected CoordinatesHelper.Builder coords
-
varList
protected List<CoordSystemBuilder.VarProcess> varList
-
coordVarsForDimension
protected com.google.common.collect.Multimap<String,CoordSystemBuilder.VarProcess> coordVarsForDimension
-
conventionName
protected String conventionName
-
parseInfo
protected Formatter parseInfo
-
userAdvice
protected Formatter userAdvice
-
debug
protected boolean debug
-
-
Constructor Detail
-
CoordSystemBuilder
protected CoordSystemBuilder(NetcdfDataset.Builder<?> datasetBuilder)
-
-
Method Detail
-
isCoordinateVariable
public static boolean isCoordinateVariable(Variable.Builder<?> vb)
Calculate if this is a classic coordinate variable: has same name as its first dimension. If type char, must be 2D, else must be 1D.- Returns:
- true if a coordinate variable.
-
countDomainSize
public static int countDomainSize(Variable.Builder<?>... axes)
-
isCoordinateAxisForVariable
protected boolean isCoordinateAxisForVariable(CoordinateAxis.Builder<?> axis, CoordSystemBuilder.VarProcess vp)
Does this axis "fit" this variable. True if all of the dimensions in the axis also appear in the variable. If char variable, last dimension is left out.- Parameters:
axis- check if this axis is ok for the given variablevp- the given variable- Returns:
- true if all of the dimensions in the axis also appear in the variable.
-
setConventionUsed
protected void setConventionUsed(String convName)
-
getConventionUsed
public String getConventionUsed()
-
addUserAdvice
protected void addUserAdvice(String advice)
-
getParseInfo
public String getParseInfo()
-
getUserAdvice
public String getUserAdvice()
-
augmentDataset
protected void augmentDataset(CancelTask cancelTask) throws IOException
- Throws:
IOException
-
buildCoordinateSystems
protected void buildCoordinateSystems()
-
identifyCoordinateAxes
protected void identifyCoordinateAxes()
Everything named in the coordinateAxes or coordinates attribute are Coordinate axes.
-
identifyCoordinateSystems
protected void identifyCoordinateSystems()
Identify coordinate systems, using _Coordinate.Systems attribute.
-
identifyCoordinateTransforms
protected void identifyCoordinateTransforms()
Identify coordinate transforms, using _CoordinateTransforms attribute.
-
getAxisType
@Nullable protected AxisType getAxisType(VariableDS.Builder vb)
Identify what kind of AxisType the named variable is. Only called for variables already identified as Coordinate Axes. Default null - subclasses can override.- Parameters:
vb- a variable already identified as a Coordinate Axis- Returns:
- AxisType or null if unknown.
-
makeCoordinateAxes
protected void makeCoordinateAxes()
Take previously identified Coordinate Axis and Coordinate Variables and make them into a CoordinateAxis. Uses the getAxisType() method to figure out the type, if not already set.
-
makeCoordinateSystems
protected void makeCoordinateSystems()
-
assignCoordinateSystemsExplicit
protected void assignCoordinateSystemsExplicit()
Assign explicit CoordinateSystem objects to variables.
-
makeCoordinateSystemsImplicit
protected void makeCoordinateSystemsImplicit()
Make implicit CoordinateSystem objects for variables that dont already have one, by using the variables' list of coordinate axes, and any coordinateVariables for it. Must be at least 2 axes. All of a variable's _Coordinate Variables_ plus any variables listed in a *__CoordinateAxes_* or *_coordinates_* attribute will be made into an *_implicit_* Coordinate System. If there are at least two axes, and the coordinate system uses all of the variable's dimensions, it will be assigned to the data variable.
-
makeCoordinateTransforms
protected void makeCoordinateTransforms()
Take all previously identified Coordinate Transforms and create a CoordinateTransform object by calling CoordTransBuilder.makeCoordinateTransform().
-
makeCoordinateTransform
protected CoordinateTransform.Builder makeCoordinateTransform(VariableDS.Builder<?> vb)
-
assignCoordinateTransforms
protected void assignCoordinateTransforms()
Assign CoordinateTransform objects to Variables and Coordinate Systems.
-
findVarProcess
protected CoordSystemBuilder.VarProcess findVarProcess(String name, CoordSystemBuilder.VarProcess from)
-
findCoordinateAxis
protected CoordSystemBuilder.VarProcess findCoordinateAxis(String name)
-
makeCoordinateTransformVariable
protected VariableDS.Builder makeCoordinateTransformVariable(CoordinateTransform ct)
Create a "dummy" Coordinate Transform Variable based on the given CoordinateTransform. This creates a scalar Variable with dummy data, and adds the Parameters of the CoordinateTransform as attributes.- Parameters:
ct- based on the CoordinateTransform- Returns:
- the Coordinate Transform Variable. You must add it to the dataset.
-
-