"Fossies" - the Fresh Open Source Software Archive

Member "fimex-1.4.1/include/fimex/CDMReaderUtils.h" (30 Oct 2019, 3276 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 "CDMReaderUtils.h" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 1.3.3_vs_1.4.0.

    1 /*
    2  * Fimex, CDMReaderUtils.h
    3  *
    4  * (C) Copyright 2010-2019, 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: Sep 10, 2010
   24  *      Author: Heiko Klein
   25  */
   26 
   27 #ifndef CDMREADERUTILS_H_
   28 #define CDMREADERUTILS_H_
   29 
   30 #include "fimex/CDMReader.h"
   31 
   32 #include "fimex/TimeUnit.h"
   33 
   34 #include <memory>
   35 #include <vector>
   36 
   37 namespace MetNoFimex {
   38 
   39 /**
   40  * @headerfile fimex/CDMReaderUtils.h
   41  */
   42 
   43 /**
   44  *  @example parallelRead.cpp
   45  * Example on reading several slices in parallel with a CDMReader.
   46  */
   47 
   48 /**
   49  * avoid deletion of the shared_ptr or shared_array when used as
   50  * std::shared_ptr<T>(this, null_deleter())
   51  * @param r
   52  */
   53 struct null_deleter
   54 {
   55     void operator()(void const *) const {}
   56 };
   57 
   58 /**
   59  * Try to find the forecast reference time of the reader. This has currently
   60  * only be implemented for CF-1.x.
   61  * @param reader the CDMReader to check for the reference time
   62  * @return the reference time
   63  * @throw CDMException if eithern no reference time has been found, or if more than 1 different reference
   64  *        times have been found
   65  */
   66 FimexTime getUniqueForecastReferenceTimeFT(CDMReader_p reader);
   67 
   68 /**
   69  * This is the same function as CDMReader::getScaledDataSliceInUnit, but it converts
   70  * the data to a vector<double>.
   71  *
   72  * @param reader
   73  * @param var
   74  * @param unit
   75  * @param unLimDimPos
   76  * @return
   77  */
   78 std::vector<double> getDataSliceInUnit(CDMReader_p reader, const std::string& var, const std::string& unit, int unLimDimPos);
   79 
   80 /**
   81  * return estimated size of CDM-data in bytes
   82  */
   83 std::size_t estimateCDMDataSize(const CDM& cdm);
   84 
   85 /**
   86  * check if the shapes of two variables (eventually belonging to two different CDMs) have the same
   87  * sizes. Dimensions of size 1 are ignored.
   88  *
   89  * @param cdm1 first CDM
   90  * @param varName1 first variable-name
   91  * @param cdm2 second CDM
   92  * @param varName2 second variable-name
   93  * @return
   94  */
   95 bool compareCDMVarShapes(const CDM& cdm1, const std::string& varName1, const CDM& cdm2, const std::string& varName2);
   96 
   97 
   98 /**
   99  * find a unique variable and dimension name, starting with baseVar
  100  * @param cdm
  101  * @param baseVar the basic variable name
  102  * @return a st
  103  */
  104 std::string findUniqueDimVarName(const CDM& cdm, const std::string& baseVar);
  105 
  106 std::string findUniqueVarName(const CDM& cdm, const std::string& name);
  107 std::string findUniqueDimName(const CDM& cdm, const std::string& name);
  108 
  109 /**
  110  * generate projection coordinates if they don't exist for a coordinate system
  111  */
  112 void generateProjectionCoordinates(CDMReader_p reader);
  113 
  114 }
  115 #endif /* CDMREADERUTILS_H_ */