MeteoIODoc 20240426.aefd3c94
ProcTransformWindVector.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2014 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
4/***********************************************************************************/
5/* This file is part of MeteoIO.
6 MeteoIO is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 MeteoIO is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with MeteoIO. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef PROCTRANSFORMWINDVECTOR_H
20#define PROCTRANSFORMWINDVECTOR_H
21
22#include <meteoio/meteoFilters/ProcessingBlock.h> //use this one for all others
23
24#include <vector>
25#include <string>
26
27namespace mio {
28
70#if defined(PROJ4)
71 #define ACCEPT_USE_OF_DEPRECATED_PROJ_API_H
72 #include <proj_api.h>
73#elif defined(PROJ)
74 #include <proj.h>
75#endif
76
77class ProcTransformWindVector : public ProcessingBlock { //use this one for simple filter that only look at one data point at a time, for example min_max
78 public:
79 ProcTransformWindVector(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& name, const Config &cfg);
83
84 virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
85 std::vector<MeteoData>& ovec);
86
87 private:
88#if defined PROJ4 || defined PROJ
89 static std::string findUComponent(const MeteoData& md);
90 static std::string findVComponent(const MeteoData& md);
91 void parse_args(const std::vector< std::pair<std::string, std::string> >& vecArgs, const Config &cfg);
92 void initPROJ(void);
93 void TransformCoord(const double& X_in, const double& Y_in, double& X_out, double& Y_out);
94
95#if defined(PROJ4)
96 projPJ pj_src, pj_dest;
97#elif defined(PROJ)
98 PJ_CONTEXT* pj_context;
99 PJ* pj_trans;
100#endif
101
102 // The declarations below are needed when the copy constructor is called.
103 std::vector< std::pair<std::string, std::string> > vecArgs_i;
104 std::string name_i;
105 Config cfg_i;
106#endif
107 std::string s_coordparam, t_coordparam;
108};
109
110} //end namespace
111
112#endif
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition: Config.h:79
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition: MeteoData.h:107
This filter reprojects wind direction, and/or wind speed components, between PROJ supported coordinat...
Definition: ProcTransformWindVector.h:77
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)
Definition: ProcTransformWindVector.cc:43
ProcTransformWindVector & operator=(const ProcTransformWindVector &c)
~ProcTransformWindVector()
Definition: ProcTransformWindVector.cc:41
ProcTransformWindVector(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
Definition: ProcTransformWindVector.cc:35
ProcTransformWindVector(const ProcTransformWindVector &c)
The base class for all filters that provides the interface and a few helper methods.
Definition: ProcessingBlock.h:67
Definition: Config.cc:31