ucar.nc2.ncml
Class AggregationFmrcSingle.OpenDataset

java.lang.Object
  extended by ucar.nc2.ncml.AggregationFmrcSingle.OpenDataset
Enclosing class:
AggregationFmrcSingle

public class AggregationFmrcSingle.OpenDataset
extends java.lang.Object

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


Field Summary
protected  java.lang.String cacheLocation
           
protected  ucar.nc2.ncml.MyCrawlableDataset cd
           
protected  java.lang.String coordValue
           
protected  java.util.Date coordValueDate
           
protected  java.util.EnumSet<NetcdfDataset.Enhance> enhance
           
protected  boolean isStringValued
           
protected  java.lang.String location
           
protected  int ncoord
           
protected  FileFactory reader
           
 
Constructor Summary
protected AggregationFmrcSingle.OpenDataset(NetcdfFile openFile, java.util.Date coordValueDate, java.lang.String coordValue)
          Dataset constructor with an opened NetcdfFile.
 
Method Summary
protected  NetcdfFile acquireFile(CancelTask cancelTask)
           
protected  void cacheVariables(NetcdfFile ncfile)
           
protected  void close(NetcdfFile ncfile)
           
 boolean equals(java.lang.Object oo)
           
 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
 java.lang.String getLocation()
          Get the location of 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.
 int hashCode()
           
protected  boolean isNeeded(Range totalRange)
           
protected  Array read(Variable mainv, CancelTask cancelTask)
           
protected  Array read(Variable mainv, CancelTask cancelTask, java.util.List<Range> section)
          Read a section of the local Variable.
protected  void setInfo(ucar.nc2.ncml.MyCrawlableDataset myf)
           
protected  int setStartEnd(int aggStart, CancelTask cancelTask)
          Set the starting and ending index into the aggregation dimension
 
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

location

protected java.lang.String location

cd

protected ucar.nc2.ncml.MyCrawlableDataset cd

cacheLocation

protected java.lang.String cacheLocation

reader

protected FileFactory reader

enhance

protected java.util.EnumSet<NetcdfDataset.Enhance> enhance
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

protected NetcdfFile acquireFile(CancelTask cancelTask)
                          throws java.io.IOException
Throws:
java.io.IOException

close

protected void close(NetcdfFile ncfile)
              throws java.io.IOException
Throws:
java.io.IOException

setInfo

protected void setInfo(ucar.nc2.ncml.MyCrawlableDataset myf)

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

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
Throws:
java.io.IOException

read

protected Array read(Variable mainv,
                     CancelTask cancelTask,
                     java.util.List<Range> section)
              throws java.io.IOException,
                     InvalidRangeException
Read a section of the local Variable.

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

getLocation

public java.lang.String getLocation()
Get the location of this Dataset

Returns:
the location of this Dataset

read

protected Array read(Variable mainv,
                     CancelTask cancelTask)
              throws java.io.IOException
Throws:
java.io.IOException

equals

public boolean equals(java.lang.Object oo)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object