"Fossies" - the Fresh Open Source Software Archive

Member "fimex-1.4.1/include/fimex/CDMVerticalInterpolator.h" (30 Oct 2019, 2916 Bytes) of package /linux/privat/fimex-1.4.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "CDMVerticalInterpolator.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.2.2_vs_1.2.3.

    1 /*
    2  * Fimex, CDMVerticalInterpolator.h
    3  *
    4  * (C) Copyright 2011, 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  *  Created on: Aug 1, 2011
   24  *      Author: Heiko Klein
   25  */
   26 
   27 #ifndef CDMVERTICALINTERPOLATOR_H_
   28 #define CDMVERTICALINTERPOLATOR_H_
   29 
   30 
   31 #include <vector>
   32 #include "fimex/mifi_constants.h"
   33 #include "fimex/CDMReader.h"
   34 #include "fimex/coordSys/CoordinateSystem.h"
   35 
   36 
   37 namespace MetNoFimex
   38 {
   39 
   40 /**
   41  * @headerfile fimex/CDMVerticalInterpolator.h
   42  */
   43 /**
   44  * @brief Interpolation of vertical layers
   45  *
   46  * The CDMVerticalInterpolator can be used to interpolate vertical levels.
   47  *
   48  * @warning CDMVerticalInterpolator requires a valid coordinate-system. In addition, the vertical axis may
   49  * not be the unlimited dimension. Furthermore, the vertical layer may not depend
   50  * or more dimensions than x,y and time. The order of dimensions must be time, k, y, x.
   51  *
   52  * @warning The routine does not handle invalid values, except float/double nans
   53  *
   54  */
   55 class CDMVerticalInterpolator: public MetNoFimex::CDMReader
   56 {
   57 public:
   58     /**
   59      * Initialize a vertical interpolator.
   60      *
   61      * @param dataReader the data-source
   62      * @param verticalType must be 'pressure' (hPa), 'height' (m) or 'depth' (m)
   63      * @param verticalInterpolationMethod one of 'linear', 'log', 'loglog'
   64      */
   65     CDMVerticalInterpolator(CDMReader_p dataReader, const std::string& verticalType, const std::string& verticalInterpolationMethod);
   66     ~CDMVerticalInterpolator();
   67 
   68     void ignoreValidityMin(bool ignore);
   69     void ignoreValidityMax(bool ignore);
   70 
   71     void interpolateToFixed(const std::vector<double>& level1);
   72     void interpolateByTemplateVariable(const std::string& tv);
   73 
   74     using CDMReader::getDataSlice;
   75     /**
   76      * retrieve data from the underlying dataReader and interpolate the values to the new vertical levels
   77      */
   78     virtual DataPtr getDataSlice(const std::string& varName, size_t unLimDimPos = 0);
   79 
   80 private:
   81     DataPtr getLevelDataSlice(CoordinateSystem_cp cs, const std::string& varName, size_t unLimDimPos);
   82 
   83 private:
   84     CDMReader_p dataReader_;
   85 
   86     struct Impl;
   87     std::unique_ptr<Impl> pimpl_;
   88 };
   89 
   90 }
   91 
   92 #endif /* CDMVERTICALINTERPOLATOR_H_ */