Package ucar.nc2.dataset
Class CoordinateSystem
- java.lang.Object
-
- ucar.nc2.dataset.CoordinateSystem
-
@Immutable public class CoordinateSystem extends Object
Specifies the coordinates of a Variable's values, this is a legacy class, use GridCoordinateSystem for new code.Mathematically it is a vector function F from index space to Sn: F(i,j,k,...) -> (S1, S2, ...Sn) where i,j,k are integers, and S is the set of reals (R) or Strings.
The components of F are just its coordinate axes:F = (A1, A2, ...An) A1(i,j,k,...) -> S1 A2(i,j,k,...) -> S2 An(i,j,k,...) -> Sn
Concretely, a CoordinateSystem is a set of coordinate axes, and an optional set of coordinate transforms. The domain rank of F is the number of dimensions it is a function of. The range rank is the number of coordinate axes.An important class of CoordinateSystems are georeferencing Coordinate Systems, that locate a Variable's values in space and time. A CoordinateSystem that has a Lat and Lon axis, or a GeoX and GeoY axis and a Projection CoordinateTransform will have isGeoReferencing() true. A CoordinateSystem that has a Height, Pressure, or GeoZ axis will have hasVerticalAxis() true.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CoordinateSystem.Builder<T extends CoordinateSystem.Builder<T>>
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CoordinateSystem.Builder<?>
builder()
Get a Builder of CoordinateSystemboolean
containsAxis(String axisFullName)
Do we have the named axis?boolean
equals(Object o)
CoordinateAxis
findAxis(AxisType type)
Find the CoordinateAxis that has the given AxisType.CoordinateAxis
findAxis(AxisType... axisType)
Find CoordinateAxis of one of the given types, in the order given.List<CoordinateAxis>
getCoordinateAxes()
Get the List of CoordinateAxesCollection<Dimension>
getDomain()
Get the Collection of Dimensions used by any of the CoordinateAxes.String
getName()
Get the name of the Coordinate SystemProjection
getProjection()
Get the Projection for this coordinate system.int
hashCode()
static boolean
isComplete(Collection<Dimension> variableDomain, Collection<Dimension> csysDomain)
True if all variableDomain dimensions are contained in csysDomain, or have length < 2.boolean
isComplete(Variable v)
Check if this Coordinate System is complete for v, ie if all v's dimensions are used by the Coordinate System.boolean
isCoordinateSystemFor(Variable v)
Check if this Coordinate System can be used for the given variable, by checking if each CoordinateAxis can be used for the Variable.boolean
isGeoReferencing()
True if isGeoXY or isLatLonboolean
isGeoXY()
True if it has X and Y CoordinateAxis, and a Projectionboolean
isImplicit()
Implicit Coordinate System are constructed based on which Coordinate Variables exist for the Dimensions of the Variable.boolean
isLatLon()
True if it has Lat and Lon CoordinateAxisstatic String
makeName(List<CoordinateAxis> axes)
Create standard name from list of axes.CoordinateSystem.Builder<?>
toBuilder()
Convert to a mutable Builder.String
toString()
-
-
-
Method Detail
-
makeName
public static String makeName(List<CoordinateAxis> axes)
Create standard name from list of axes. Sort the axes first- Parameters:
axes
- list of CoordinateAxis- Returns:
- CoordinateSystem name, created from axes names
-
getCoordinateAxes
public List<CoordinateAxis> getCoordinateAxes()
Get the List of CoordinateAxes
-
getName
public String getName()
Get the name of the Coordinate System
-
getDomain
public Collection<Dimension> getDomain()
Get the Collection of Dimensions used by any of the CoordinateAxes.
-
findAxis
@Nullable public CoordinateAxis findAxis(AxisType type)
Find the CoordinateAxis that has the given AxisType. If more than one, return the one with lesser rank.- Parameters:
type
- look for this axisType- Returns:
- CoordinateAxis of the given AxisType, else null.
-
findAxis
@Nullable public CoordinateAxis findAxis(AxisType... axisType)
Find CoordinateAxis of one of the given types, in the order given.
-
getProjection
@Nullable public Projection getProjection()
Get the Projection for this coordinate system.
-
isGeoXY
public boolean isGeoXY()
True if it has X and Y CoordinateAxis, and a Projection
-
isLatLon
public boolean isLatLon()
True if it has Lat and Lon CoordinateAxis
-
isGeoReferencing
public boolean isGeoReferencing()
True if isGeoXY or isLatLon
-
isComplete
public boolean isComplete(Variable v)
Check if this Coordinate System is complete for v, ie if all v's dimensions are used by the Coordinate System. Exclude dimensions with length < 2.
-
isComplete
public static boolean isComplete(Collection<Dimension> variableDomain, Collection<Dimension> csysDomain)
True if all variableDomain dimensions are contained in csysDomain, or have length < 2.
-
isCoordinateSystemFor
public boolean isCoordinateSystemFor(Variable v)
Check if this Coordinate System can be used for the given variable, by checking if each CoordinateAxis can be used for the Variable. A CoordinateAxis can only be used if the CoordinateAxis' set of Dimensions is a subset of the Variable's set of Dimensions.
-
isImplicit
public boolean isImplicit()
Implicit Coordinate System are constructed based on which Coordinate Variables exist for the Dimensions of the Variable. This is in contrast to a Coordinate System that is explicitly specified in the file.
-
containsAxis
public boolean containsAxis(String axisFullName)
Do we have the named axis?- Parameters:
axisFullName
- (full unescaped) name of axis- Returns:
- true if we have an axis of that name
-
toBuilder
public CoordinateSystem.Builder<?> toBuilder()
Convert to a mutable Builder.
-
builder
public static CoordinateSystem.Builder<?> builder()
Get a Builder of CoordinateSystem
-
-