Package ucar.nc2
Class ParsedArraySectionSpec
- java.lang.Object
-
- ucar.nc2.ParsedArraySectionSpec
-
public class ParsedArraySectionSpec extends Object
A String expression for denoting a section of a Variable to be read. 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 ']'.
-
-
Constructor Summary
Constructors Constructor Description ParsedArraySectionSpec(Variable variable, Section section)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Section
getArraySection()
ParsedArraySectionSpec
getChild()
Variable
getVariable()
static ParsedArraySectionSpec
makeFromVariable(Variable v, String selector)
String
makeSectionSpecString()
static String
makeSectionSpecString(Variable v, Section section)
Make section specification String from a ucar.array.Section for a Variable.static ParsedArraySectionSpec
parseVariableSection(NetcdfFile ncfile, String variableSection)
Parse a section specification String.String
toString()
-
-
-
Method Detail
-
parseVariableSection
public static ParsedArraySectionSpec parseVariableSection(NetcdfFile ncfile, String variableSection) throws InvalidRangeException
Parse a section specification String.- Parameters:
ncfile
- look for variable in herevariableSection
- the string to parse, eg "record(12).wind(1:20,:,3)"- Returns:
- return ParsedSectionSpec, parsed representation of the variableSection String
- Throws:
IllegalArgumentException
- when token is misformed, or variable name doesnt exist in ncfileInvalidRangeException
- if section does not match variable shape
-
makeFromVariable
public static ParsedArraySectionSpec makeFromVariable(Variable v, String selector) throws InvalidRangeException
- Throws:
InvalidRangeException
-
makeSectionSpecString
public static String makeSectionSpecString(Variable v, @Nullable Section section)
Make section specification String from a ucar.array.Section for a Variable.- Parameters:
v
- for this Variable.section
- list of Range. Must includes all parent structures. May be null, meaning use all. Individual ranges may be null, meaning all for that dimension.- Returns:
- section specification String.
-
getVariable
public Variable getVariable()
-
getArraySection
public Section getArraySection()
-
getChild
public ParsedArraySectionSpec getChild()
-
makeSectionSpecString
public String makeSectionSpecString()
-
-