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 class
CoordSystemBuilder.Factory
protected class
CoordSystemBuilder.VarProcess
Classifications of Variables into axis, systems and transforms
-
Field Summary
Fields Modifier and Type Field Description protected String
conventionName
protected CoordinatesHelper.Builder
coords
protected com.google.common.collect.Multimap<String,CoordSystemBuilder.VarProcess>
coordVarsForDimension
protected NetcdfDataset.Builder<?>
datasetBuilder
protected boolean
debug
protected static org.slf4j.Logger
log
protected Formatter
parseInfo
protected Group.Builder
rootGroup
protected Formatter
userAdvice
protected List<CoordSystemBuilder.VarProcess>
varList
-
Constructor Summary
Constructors Modifier Constructor Description protected
CoordSystemBuilder(NetcdfDataset.Builder<?> datasetBuilder)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addUserAdvice(String advice)
protected void
assignCoordinateSystemsExplicit()
Assign explicit CoordinateSystem objects to variables.protected void
assignCoordinateTransforms()
Assign CoordinateTransform objects to Variables and Coordinate Systems.protected void
augmentDataset(CancelTask cancelTask)
protected void
buildCoordinateSystems()
static int
countDomainSize(Variable.Builder<?>... axes)
protected CoordSystemBuilder.VarProcess
findCoordinateAxis(String name)
protected CoordSystemBuilder.VarProcess
findVarProcess(String name, CoordSystemBuilder.VarProcess from)
protected AxisType
getAxisType(VariableDS.Builder vb)
Identify what kind of AxisType the named variable is.String
getConventionUsed()
String
getParseInfo()
String
getUserAdvice()
protected void
identifyCoordinateAxes()
Everything named in the coordinateAxes or coordinates attribute are Coordinate axes.protected void
identifyCoordinateSystems()
Identify coordinate systems, using _Coordinate.Systems attribute.protected void
identifyCoordinateTransforms()
Identify coordinate transforms, using _CoordinateTransforms attribute.protected boolean
isCoordinateAxisForVariable(CoordinateAxis.Builder<?> axis, CoordSystemBuilder.VarProcess vp)
Does this axis "fit" this variable.static boolean
isCoordinateVariable(Variable.Builder<?> vb)
Calculate if this is a classic coordinate variable: has same name as its first dimension.protected void
makeCoordinateAxes()
Take previously identified Coordinate Axis and Coordinate Variables and make them into a CoordinateAxis.protected void
makeCoordinateSystems()
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.protected CoordinateTransform.Builder
makeCoordinateTransform(VariableDS.Builder<?> vb)
protected void
makeCoordinateTransforms()
Take all previously identified Coordinate Transforms and create a CoordinateTransform object by calling CoordTransBuilder.makeCoordinateTransform().protected VariableDS.Builder
makeCoordinateTransformVariable(CoordinateTransform ct)
Create a "dummy" Coordinate Transform Variable based on the given CoordinateTransform.protected void
setConventionUsed(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.
-
-