cdm/src/main/java/ucar/nc2/Variable.java
public Section getShapeAsSection() {
    if (shapeAsSection == null) {
      try {
        List<Range> list = new ArrayList<>();
        for (Dimension d : dimensions) {
          int len = d.getLength();
          if (len > 0)
            list.add(new Range(d.getShortName(), 0, len - 1));
          else if (len == 0)
            list.add( Range.EMPTY); // LOOK empty not named
          else {
            assert d.isVariableLength();
            list.add( Range.VLEN); // LOOK vlen not named
          }
        }
        shapeAsSection = new Section(list).makeImmutable();

      } catch (InvalidRangeException e) {
        log.error("Bad shape in variable " + getFullName(), e);
        throw new IllegalStateException(e.getMessage());
      }
    }
    return shapeAsSection;
  }
public Section getShapeAsSection() {
    if (shapeAsSection == null) {
      try {
        List<Range> list = new ArrayList<>();
        for (Dimension d : dimensions) {
          int len = d.getLength();
          if (len > 0)
            list.add(new Range(d.getShortName(), 0, len - 1));
          else if (len == 0)
            list.add( Range.EMPTY); // LOOK empty not named
          else {
            assert d.isVariableLength();
            list.add( Range.VLEN); // LOOK vlen not named
          }
        }
        shapeAsSection = new Section(list).makeImmutable();

      } catch (InvalidRangeException e) {
        log.error("Bad shape in variable " + getFullName(), e);
        throw new IllegalStateException(e.getMessage());
      }
    }
    return shapeAsSection;
  }
public Section getShapeAsSection ( ) { if ( shapeAsSection == null ) { try { List < Range > list = new ArrayList <> ( ) ; for ( Dimension d : dimensions ) { int len = d . getLength ( ) ; if ( len > 0 ) list . add ( new Range ( d . getShortName ( ) , 0 , len - 1 ) ) ; else if ( len == 0 ) list . add ( Range . EMPTY ) ; // LOOK empty not named else { assert d . isVariableLength ( ) ; list . add ( Range . VLEN ) ; // LOOK vlen not named } } shapeAsSection = new Section ( list ) . makeImmutable ( ) ; } catch ( InvalidRangeException e ) { log . error ( "Bad shape in variable " + getFullName ( ) , e ) ; throw new IllegalStateException ( e . getMessage ( ) ) ; } } return shapeAsSection ; }
Get shape as a Section object.

@return Section containing List<Range>, one for each Dimension.
Get shape as a Section object .