MeteoIODoc  2.10.0
FilterDeGrass.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 FilterDeGrass_H
20 #define FilterDeGrass_H
21 
22 #include <meteoio/meteoFilters/ProcessingBlock.h> //use this one for all others
23 #include <vector>
24 #include <string>
25 
26 namespace mio {
27 
69  public:
70  FilterDeGrass(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& name, const Config& cfg);
71 
72  virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
73  std::vector<MeteoData>& ovec);
74 
75  private:
76  void filterOnTsg(const unsigned int& param, const size_t& ii, std::vector<MeteoData>& ovec);
77  void filterOnTss(const unsigned int& param, const size_t& ii, const double& tss_offset, std::vector<MeteoData>& ovec);
78 
79  static double getTssTsgCorrelation(const std::vector<MeteoData>& ovec, const size_t& firstWarmDay_idx);
80  static void findFirstWarmDay(const std::vector<MeteoData>& ovec, size_t &tssWarmDay_idx, size_t &tsgWarmDay_idx);
81  static double getTSSOffset(const unsigned int& param, const std::vector<MeteoData>& ivec);
82  static bool getDailyParameters(const std::vector<MeteoData>& ivec, const Date day_start, double &HS_daily_median, double &TSS_daily_median, double &RSWR_daily_10pc);
83  static void getTSSDailyPpt(const std::vector<MeteoData>& ivec, const Date day_start, double &o_TSS_daily_min, double &o_TSS_daily_max, double &o_TSS_daily_mean);
84  static double getDailyTSGVariance(const std::vector<MeteoData>& ivec, const Date day_start);
85  static Date getDailyStart(const Date& resampling_date);
86 
87  Date prev_day;
88  double TSS_daily_max, TSS_daily_min, TSS_daily_mean, TSG_daily_var;
89  double TSS_user_offset;
90  int month;
91 };
92 
93 } //end namespace
94 
95 #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 handle timestamps. This class handles conversion between different time display formats (I...
Definition: Date.h:87
This filter is used to distinguish if snow (HS) is on the ground or not.
Definition: FilterDeGrass.h:68
FilterDeGrass(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &name, const Config &cfg)
Definition: FilterDeGrass.cc:26
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec)
Definition: FilterDeGrass.cc:41
The base class for all filters that provides the interface and a few helper methods.
Definition: ProcessingBlock.h:67
Definition: Config.cc:30