#include <CDMExtractor.h>
Public Member Functions | |
CDMExtractor (boost::shared_ptr< CDMReader > dataReader) | |
virtual | ~CDMExtractor () |
virtual boost::shared_ptr< Data > | getDataSlice (const std::string &varName, size_t unLimDimPos=0) throw (CDMException) |
data-reading function to be called from the CDMWriter | |
virtual void | removeVariable (std::string variable) |
Remove a variable from the CDM. | |
virtual void | selectVariables (std::set< std::string > variables) |
select only a set of variables | |
virtual void | reduceDimension (std::string dimName, size_t start, size_t length) throw (CDMException) |
Reduce a dimension of the file. | |
virtual void | reduceDimensionStartEnd (std::string dimName, size_t start=0, long end=0) throw (CDMException) |
Reduce a dimension of the file. | |
virtual void | reduceAxes (const std::vector< CoordinateAxis::AxisType > &types, const std::string &aUnits, double startVal, double endVal) throw (CDMException) |
reduce the axes of a file with an explicit unit | |
virtual void | reduceTime (const FimexTime &startTime, const FimexTime &endTime) throw (CDMException) |
reduce the time explicitly by a timestamp | |
virtual void | reduceVerticalAxis (const std::string &units, double startVal, double endVal) throw (CDMException) |
reduce a vertical axis by value | |
virtual void | reduceLatLonBoundingBox (double south, double north, double west, double east) throw (CDMException) |
reduce the horizontal layer to the latitude-longitude bounding box | |
virtual void | changeDataType (std::string variable, CDMDataType datatype) throw (CDMException) |
change the datatype of the variable |
MetNoFimex::CDMExtractor::CDMExtractor | ( | boost::shared_ptr< CDMReader > | dataReader | ) |
virtual MetNoFimex::CDMExtractor::~CDMExtractor | ( | ) | [virtual] |
virtual boost::shared_ptr<Data> MetNoFimex::CDMExtractor::getDataSlice | ( | const std::string & | varName, | |
size_t | unLimDimPos = 0 | |||
) | throw (CDMException) [virtual] |
data-reading function to be called from the CDMWriter
This methods needs to be implemented by the CDMReader. It should provide the data for each variable, either by reading from disk, converting from another CDMReader or reading from an in-memory data-section.
This function should retrieve the whole data for a dataset without unlimited dimension if the unLimDimPos == 0.
varName | name of the variable to read | |
unLimDimPos | (optional) if the variable contains a unlimited dimension (max one allowed) an slice of this position is returned |
Implements MetNoFimex::CDMReader.
virtual void MetNoFimex::CDMExtractor::removeVariable | ( | std::string | variable | ) | [virtual] |
Remove a variable from the CDM.
varName | name of the variable |
virtual void MetNoFimex::CDMExtractor::selectVariables | ( | std::set< std::string > | variables | ) | [virtual] |
select only a set of variables
This function will remove all variables except the ones selected plus eventually some auxiliary variables needed by the selected variables (not decided yet)
variables | list of variables-names |
virtual void MetNoFimex::CDMExtractor::reduceDimension | ( | std::string | dimName, | |
size_t | start, | |||
size_t | length | |||
) | throw (CDMException) [virtual] |
Reduce a dimension of the file.
name | dimension to change | |
start | start-position corresponding to the original dimension | |
size | size of the new dimension |
CDMException | if dimension doesn't exist or start+size outside range of the original dimension |
virtual void MetNoFimex::CDMExtractor::reduceDimensionStartEnd | ( | std::string | dimName, | |
size_t | start = 0 , |
|||
long | end = 0 | |||
) | throw (CDMException) [virtual] |
Reduce a dimension of the file.
name | dimension to change | |
start | start-position corresponding to the original dimension, defaults to 0 | |
end | end-position of dimension, 0 means full size, negative values start from end |
CDMException | if dimension doesn't exist or start+size outside range of the original dimension |
virtual void MetNoFimex::CDMExtractor::reduceAxes | ( | const std::vector< CoordinateAxis::AxisType > & | types, | |
const std::string & | aUnits, | |||
double | startVal, | |||
double | endVal | |||
) | throw (CDMException) [virtual] |
reduce the axes of a file with an explicit unit
In contrast to reduceDimension, this method allows the usage of absolute values, not positions on the dimension. It will try to detect the reduction of dimensions as needed.
reduceAxes requires the file to come with a known convention, e.g. CF, see listCoordinateSystems()
reduceAxes is not able to reduce multi-dimensional axes-dimensions, e.g. time(time, station), yet
virtual void MetNoFimex::CDMExtractor::reduceTime | ( | const FimexTime & | startTime, | |
const FimexTime & | endTime | |||
) | throw (CDMException) [virtual] |
reduce the time explicitly by a timestamp
In contrast to reduceDimension, this method allows the usage of absolute times. It will try to detect the reduction of dimensions as needed
This is implemented using reduceAxes() and the TimeAxis type.
virtual void MetNoFimex::CDMExtractor::reduceVerticalAxis | ( | const std::string & | units, | |
double | startVal, | |||
double | endVal | |||
) | throw (CDMException) [virtual] |
reduce a vertical axis by value
In contrast to reduceDimension, this method allows the usage of vertical axes values having a compatible unit to units. It will try to detect the reduction of dimensions as needed.
units | the units of the start and end value. Only vertical axes with compatible units will be reduced. | |
startVal | the lower value of the axis (included) | |
endVal | the upper value of the axis (included) |
virtual void MetNoFimex::CDMExtractor::reduceLatLonBoundingBox | ( | double | south, | |
double | north, | |||
double | west, | |||
double | east | |||
) | throw (CDMException) [virtual] |
reduce the horizontal layer to the latitude-longitude bounding box
This method will try to reduce the horizontal layer to the given latitude/longitude bounding box. It requires the original data to have a simple geospatial gridded CoordinateSystem, i.e. CoordinateSystem::isSimpleSpatialGridded() and a projection mapping to lat/lon
south | southernmost border in dec. degree, -90 < south < north < 90 | |
north | northernmost border in dec. degree, -90 < south < north < 90 | |
west | westernmost border in dec. degree, -180 < west < east < 180 | |
east | easternmost border in dec. degree, -180 < west < east < 180 |
virtual void MetNoFimex::CDMExtractor::changeDataType | ( | std::string | variable, | |
CDMDataType | datatype | |||
) | throw (CDMException) [virtual] |
change the datatype of the variable
a change of the variable will also change the datatype of the _FillValue attribute
variable | name of the variable | |
datatype | new datatype |
CDMException | if variable doesn't exist or conversion to datatype is not supported |