ucar.nc2.ncml
Class AggregationFmrcSingle.OpenDataset

java.lang.Object
  extended by ucar.nc2.ncml.Aggregation.Dataset
      extended by ucar.nc2.ncml.AggregationFmrcSingle.OpenDataset
All Implemented Interfaces:
java.lang.Comparable
Enclosing class:
AggregationFmrcSingle

public class AggregationFmrcSingle.OpenDataset
extends Aggregation.Dataset

Encapsolates a NetcdfFile that is a component of the aggregation. public for NcMLWriter


Field Summary
protected  java.lang.String coordValue
           
protected  java.util.Date coordValueDate
           
protected  boolean isStringValued
           
protected  int ncoord
           
 
Fields inherited from class ucar.nc2.ncml.Aggregation.Dataset
cacheLocation, enhance, extraInfo, id, location, reader
 
Constructor Summary
protected AggregationFmrcSingle.OpenDataset(NetcdfFile openFile, java.util.Date coordValueDate, java.lang.String coordValue)
          Dataset constructor with an opened NetcdfFile.
 
Method Summary
 NetcdfFile acquireFile(CancelTask cancelTask)
           
protected  void cacheVariables(NetcdfFile ncfile)
           
protected  void close(NetcdfFile ncfile)
           
 int compareTo(java.lang.Object o)
           
 java.util.Date getCoordValueDate()
          Get the coordinate value as a Date for this Dataset; may be null
 java.lang.String getCoordValueString()
          Get the coordinate value(s) as a String for this Dataset
 int getNcoords(CancelTask cancelTask)
          Get number of coordinates in this Dataset.
protected  Range getNestedJoinRange(Range totalRange)
          Get the desired Range, reletive to this Dataset, if no overlap, return null.
protected  boolean isNeeded(Range totalRange)
           
protected  Array read(Variable mainv, CancelTask cancelTask, java.util.List<Range> section)
          Read a section of the local Variable.
protected  int setStartEnd(int aggStart, CancelTask cancelTask)
          Set the starting and ending index into the aggregation dimension
 void show(java.util.Formatter f)
           
 
Methods inherited from class ucar.nc2.ncml.Aggregation.Dataset
equals, getCacheLocation, getId, getLocation, hashCode, read
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ncoord

protected int ncoord

coordValue

protected java.lang.String coordValue

coordValueDate

protected java.util.Date coordValueDate

isStringValued

protected boolean isStringValued
Constructor Detail

AggregationFmrcSingle.OpenDataset

protected AggregationFmrcSingle.OpenDataset(NetcdfFile openFile,
                                            java.util.Date coordValueDate,
                                            java.lang.String coordValue)
Dataset constructor with an opened NetcdfFile. Used in nested aggregations like scanFmrc.

Parameters:
openFile - already opened file
coordValueDate - has this coordinate as a date
coordValue - has this coordinate as a String
Method Detail

acquireFile

public NetcdfFile acquireFile(CancelTask cancelTask)
                       throws java.io.IOException
Overrides:
acquireFile in class Aggregation.Dataset
Throws:
java.io.IOException

close

protected void close(NetcdfFile ncfile)
              throws java.io.IOException
Overrides:
close in class Aggregation.Dataset
Throws:
java.io.IOException

getCoordValueString

public java.lang.String getCoordValueString()
Get the coordinate value(s) as a String for this Dataset

Returns:
the coordinate value(s) as a String

getCoordValueDate

public java.util.Date getCoordValueDate()
Get the coordinate value as a Date for this Dataset; may be null

Returns:
the coordinate value as a Date, or null

show

public void show(java.util.Formatter f)
Overrides:
show in class Aggregation.Dataset

getNcoords

public int getNcoords(CancelTask cancelTask)
               throws java.io.IOException
Get number of coordinates in this Dataset. If not already set, open the file and get it from the aggregation dimension.

Parameters:
cancelTask - allow cancellation
Returns:
number of coordinates in this Dataset.
Throws:
java.io.IOException - if io error

setStartEnd

protected int setStartEnd(int aggStart,
                          CancelTask cancelTask)
                   throws java.io.IOException
Set the starting and ending index into the aggregation dimension

Parameters:
aggStart - starting index
cancelTask - allow to bail out
Returns:
number of coordinates in this dataset
Throws:
java.io.IOException - if io error

getNestedJoinRange

protected Range getNestedJoinRange(Range totalRange)
                            throws InvalidRangeException
Get the desired Range, reletive to this Dataset, if no overlap, return null.

wantStart, wantStop are the indices in the aggregated dataset, wantStart <= i < wantEnd. if this overlaps, set the Range required for the nested dataset. note this should handle strides ok.

Parameters:
totalRange - desired range, reletive to aggregated dimension.
Returns:
desired Range or null if theres nothing wanted from this datase.
Throws:
InvalidRangeException - if invalid range request

isNeeded

protected boolean isNeeded(Range totalRange)

cacheVariables

protected void cacheVariables(NetcdfFile ncfile)
                       throws java.io.IOException
Overrides:
cacheVariables in class Aggregation.Dataset
Throws:
java.io.IOException

read

protected Array read(Variable mainv,
                     CancelTask cancelTask,
                     java.util.List<Range> section)
              throws java.io.IOException,
                     InvalidRangeException
Description copied from class: Aggregation.Dataset
Read a section of the local Variable.

Overrides:
read in class Aggregation.Dataset
Parameters:
mainv - aggregated Variable
cancelTask - let user cancel
section - reletive to the local Variable
Returns:
the complete Array for mainv
Throws:
java.io.IOException - on I/O error
InvalidRangeException - on section error

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable
Overrides:
compareTo in class Aggregation.Dataset