MI - Fimex
CDMExtractor.h
Go to the documentation of this file.
1 /*
2  * Fimex
3  *
4  * (C) Copyright 2008, met.no
5  *
6  * Project Info: https://wiki.met.no/fimex/start
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA.
22  */
23 
24 #ifndef CDMEXTRACTOR_H_
25 #define CDMEXTRACTOR_H_
26 
27 #include <map>
28 #include <set>
29 #include <boost/shared_ptr.hpp>
30 
31 #include "fimex/CDMReader.h"
32 #include "fimex/CDMDataType.h"
33 #include "fimex/TimeUnit.h"
35 
36 namespace MetNoFimex
37 {
38 
43 {
44 private:
45  boost::shared_ptr<CDMReader> dataReader_;
47  DimSlicesMap dimSlices_;
57  DataPtr getDataSlice_(const std::string& varName, const SliceBuilder& sb);
61  CDMExtractor();
62 
63 public:
64  CDMExtractor(boost::shared_ptr<CDMReader> dataReader);
65  virtual ~CDMExtractor();
66 
67 // using CDMReader::getDataSlice;
68  virtual DataPtr getDataSlice(const std::string& varName, size_t unLimDimPos = 0);
69  virtual DataPtr getDataSlice(const std::string& varName, const SliceBuilder& sb);
70 
77  virtual void removeVariable(std::string varName);
89  virtual void selectVariables(std::set<std::string> variables, bool keepLogical = false);
97  void reduceDimension(std::string dimName, const std::set<std::size_t>& slices);
106  virtual void reduceDimension(std::string dimName, size_t start, size_t length);
115  virtual void reduceDimensionStartEnd(std::string dimName, size_t start = 0, long long end = 0);
128  virtual void reduceAxes(const std::vector<CoordinateAxis::AxisType>& types, const std::string& aUnits, double startVal, double endVal);
138  virtual void reduceTime(const FimexTime& startTime, const FimexTime& endTime);
139 
154  virtual void reduceVerticalAxis(const std::string& units, double startVal, double endVal);
155 
168  virtual void reduceLatLonBoundingBox(double south, double north, double west, double east);
169 
179  virtual void changeDataType(std::string variable, CDMDataType datatype);
180 
181 };
182 
183 }
184 
185 #endif /*CDMEXTRACTOR_H_*/
virtual void reduceDimensionStartEnd(std::string dimName, size_t start=0, long long end=0)
Reduce a dimension of the file.
basic_string< char > string
virtual void removeVariable(std::string varName)
Remove a variable from the CDM.
boost::shared_ptr< Data > DataPtr
Definition: DataDecl.h:39
STL class.
Definition: SliceBuilder.h:46
virtual void reduceTime(const FimexTime &startTime, const FimexTime &endTime)
reduce the time explicitly by a timestamp
STL class.
virtual void selectVariables(std::set< std::string > variables, bool keepLogical=false)
select only a set of variables
virtual void reduceLatLonBoundingBox(double south, double north, double west, double east)
reduce the horizontal layer to the latitude-longitude bounding box
Definition: C_CDMReader.h:35
Basic interface for CDM reading and manipulation classes.
Definition: CDMReader.h:53
Definition: CDMExtractor.h:42
virtual DataPtr getDataSlice(const std::string &varName, size_t unLimDimPos=0)
data-reading function to be called from the CDMWriter
virtual void reduceVerticalAxis(const std::string &units, double startVal, double endVal)
reduce a vertical axis by value
virtual void changeDataType(std::string variable, CDMDataType datatype)
change the datatype of the variable
void reduceDimension(std::string dimName, const std::set< std::size_t > &slices)
Reduce a dimension of the file.
virtual void reduceAxes(const std::vector< CoordinateAxis::AxisType > &types, const std::string &aUnits, double startVal, double endVal)
reduce the axes of a file with an explicit unit
CDMDataType
Definition: CDMDataType.h:35
Definition: TimeUnit.h:45