Package ucar.nc2

Class Dimensions


  • public class Dimensions
    extends Object
    Static helper methods for Dimension.
    • 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().
      • 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 subset
        set - 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 subset
        set - of this?
      • makeDomain

        public static Set<Dimension> makeDomain​(Iterable<? extends Variable> axes,
                                                boolean addAnon)
        Make the set of Dimensions used by axes.