ucar.nc2
Class ParsedSectionSpec

java.lang.Object
  extended by ucar.nc2.ParsedSectionSpec

public class ParsedSectionSpec
extends Object

Parsed Section Expression, allows nesting for subsetting of Structure member variables.

Since:
May 8, 2008
Author:
caron
See Also:
SectionSpecification

Field Summary
 ParsedSectionSpec child
           
 Section section
           
 Variable v
           
 
Method Summary
static String makeSectionSpecString(Variable v, List<Range> ranges)
          Make section specification String from a range list for a Variable.
static ParsedSectionSpec parseVariableSection(NetcdfFile ncfile, String variableSection)
          Parse a section specification String.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

v

public final Variable v

section

public final Section section

child

public ParsedSectionSpec child
Method Detail

parseVariableSection

public static ParsedSectionSpec parseVariableSection(NetcdfFile ncfile,
                                                     String variableSection)
                                              throws InvalidRangeException
Parse a section specification String. These have the form:
  section specification := selector | selector '.' selector
  selector := varName ['(' dims ')']
  varName := ESCAPED_STRING
 

dims := dim | dim, dims dim := ':' | slice | start ':' end | start ':' end ':' stride slice := INTEGER start := INTEGER stride := INTEGER end := INTEGER ESCAPED_STRING : must escape characters = ".("

Nonterminals are in lower case, terminals are in upper case, literals are in single quotes. Optional components are enclosed between square braces '[' and ']'.

Parameters:
ncfile - look for variable in here
variableSection - the string to parse, eg "record(12).wind(1:20,:,3)"
Returns:
return ParsedSectionSpec, aprsed representation of the variableSection String
Throws:
IllegalArgumentException - when token is misformed, or variable name doesnt exist in ncfile
InvalidRangeException - if section does not match variable shape
See Also:
SectionSpecification

makeSectionSpecString

public static String makeSectionSpecString(Variable v,
                                           List<Range> ranges)
                                    throws InvalidRangeException
Make section specification String from a range list for a Variable.

Parameters:
v - for this Variable.
ranges - list of Range. Must includes all parent structures. The list be null, meaning use all. Individual ranges may be null, meaning all for that dimension.
Returns:
section specification String.
Throws:
InvalidRangeException - is specified section doesnt match variable shape

toString

public String toString()
Overrides:
toString in class Object


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.