cdm/src/main/java/ucar/nc2/ParsedSectionSpec.java
public static ParsedSectionSpec parseVariableSection(NetcdfFile ncfile, String variableSection) throws InvalidRangeException {
    List<String> tokes = EscapeStrings.tokenizeEscapedName(variableSection);
    if (tokes.size() == 0)
      throw new IllegalArgumentException("empty sectionSpec = " + variableSection);

    String selector = tokes.get(0);
    ParsedSectionSpec outerV = parseVariableSelector(ncfile, selector);

    // parse each selector, find the inner variable
    ParsedSectionSpec current = outerV;
    for (int i=1; i<tokes.size(); i++) {
      selector = tokes.get(i);
      current.child = parseVariableSelector( current.v,  selector);
      current = current.child;
    }

    return outerV;
  }
public static ParsedSectionSpec parseVariableSection(NetcdfFile ncfile, String variableSection) throws InvalidRangeException {
    List<String> tokes = EscapeStrings.tokenizeEscapedName(variableSection);
    if (tokes.size() == 0)
      throw new IllegalArgumentException("empty sectionSpec = " + variableSection);

    String selector = tokes.get(0);
    ParsedSectionSpec outerV = parseVariableSelector(ncfile, selector);

    // parse each selector, find the inner variable
    ParsedSectionSpec current = outerV;
    for (int i=1; i<tokes.size(); i++) {
      selector = tokes.get(i);
      current.child = parseVariableSelector( current.v,  selector);
      current = current.child;
    }

    return outerV;
  }
Parse a section specification String. These have the form:
<pre>
section specification := selector | selector '.' selector
selector := varName ['(' dims ')']
varName := ESCAPED_STRING
<p/>
dims := dim | dim, dims
dim := ':' | slice | start ':' end | start ':' end ':' stride
slice := INTEGER
start := INTEGER
stride := INTEGER
end := INTEGER
ESCAPED_STRING : must escape characters = ".("
</pre>
<p/>
Nonterminals are in lower case, terminals are in upper case, literals are in single quotes.
Optional components are enclosed between square braces '[' and ']'.

@param ncfile          look for variable in here
@param variableSection the string to parse, eg "record(12).wind(1:20,:,3)"
@return return ParsedSectionSpec, aprsed representation of the variableSection String
@throws IllegalArgumentException       when token is misformed, or variable name doesnt exist in ncfile
@throws ucar.ma2.InvalidRangeException if section does not match variable shape
@see <a href="http://www.unidata.ucar.edu/software/netcdf-java/reference/SectionSpecification.html">SectionSpecification</a>