Package ucar.nc2
Class Dimensions
- java.lang.Object
-
- ucar.nc2.Dimensions
-
public class Dimensions extends Object
Static helper methods for Dimension.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Dimensions.FindDimensionByName
A Function that finds a Dimension by name.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static long
getSize(Iterable<Dimension> dimensions)
Get the total number of elements the dimensions represent.static boolean
isCoordinateSystemFor(Collection<Dimension> domain, Variable v)
Can this be a coordinate system for v? True if each dimension of v is in this domain, or is 1 dimensional.static boolean
isSubset(Collection<Dimension> subset, Collection<Dimension> set)
Test if all the Dimensions in subset are in setstatic boolean
isSubset(Set<String> subset, Set<String> set)
Test if all the Strings in subset are in setstatic Section.Builder
makeArraySectionFromDimensions(Iterable<Dimension> dimensions)
Make a ucar.array.Section.Builder from an ordered set of Dimension objects.static List<Dimension>
makeDimensionsAll(Variable v)
Get list of Dimensions, including parent Structure(s), if any.static List<Dimension>
makeDimensionsAnon(int[] shape)
Make a list of private dimensions from an array of lengthsstatic List<Dimension>
makeDimensionsList(Dimensions.FindDimensionByName finder, String dimString)
Make a list of Dimensions from a list of names.static String
makeDimensionsString(Iterable<Dimension> dimensions)
Make a space-delineated String from a list of Dimension names, inverse of makeDimensionsList().static Set<Dimension>
makeDomain(Iterable<? extends Variable> axes, boolean addAnon)
Make the set of Dimensions used by axes.static int[]
makeShape(Iterable<Dimension> dimensions)
Make an array of Dimension lengths.static int[]
makeShapeAll(Variable v)
Make an array of Dimension lengths from all the dimensions in a variable, including parentStructures.
-
-
-
Method Detail
-
makeArraySectionFromDimensions
public static Section.Builder makeArraySectionFromDimensions(Iterable<Dimension> dimensions)
Make a ucar.array.Section.Builder from an ordered set of Dimension objects.
-
getSize
public static long getSize(Iterable<Dimension> dimensions)
Get the total number of elements the dimensions represent.
-
makeShapeAll
public static int[] makeShapeAll(Variable v)
Make an array of Dimension lengths from all the dimensions in a variable, including parentStructures.
-
makeShape
public static int[] makeShape(Iterable<Dimension> dimensions)
Make an array of Dimension lengths.
-
makeDimensionsString
public static String makeDimensionsString(Iterable<Dimension> dimensions)
Make a space-delineated String from a list of Dimension names, inverse of makeDimensionsList().
-
makeDimensionsList
public static List<Dimension> makeDimensionsList(Dimensions.FindDimensionByName finder, String dimString) throws IllegalArgumentException
Make a list of Dimensions from a list of names.- Parameters:
finder
- interface to find a Dimension by name.dimString
- space separated list of dimension names.- Returns:
- equivalent list of Dimension objects.
- Throws:
IllegalArgumentException
- if cant find or parse the name.
-
makeDimensionsAnon
public static List<Dimension> makeDimensionsAnon(int[] shape)
Make a list of private dimensions from an array of lengths
-
makeDimensionsAll
public static List<Dimension> makeDimensionsAll(Variable v)
Get list of Dimensions, including parent Structure(s), if any.- Returns:
- array of Dimension, rank of v plus all parent Structures.
-
isSubset
public static boolean isSubset(Collection<Dimension> subset, Collection<Dimension> set)
Test if all the Dimensions in subset are in set- Parameters:
subset
- is this a subsetset
- of this?
-
isCoordinateSystemFor
public static boolean isCoordinateSystemFor(Collection<Dimension> domain, Variable v)
Can this be a coordinate system for v? True if each dimension of v is in this domain, or is 1 dimensional.
-
isSubset
public static boolean isSubset(Set<String> subset, Set<String> set)
Test if all the Strings in subset are in set- Parameters:
subset
- is this a subsetset
- of this?
-
-