MeteoIODoc 20260919.909d27f1
Environmental timeseries pre-processing
Loading...
Searching...
No Matches
ProcUndercatch_Spice.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2012 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 PROCUNDERCATCH_SPICE_H
20#define PROCUNDERCATCH_SPICE_H
21
23#include <vector>
24#include <string>
25#include <map>
26
27namespace mio {
28
53 public:
54 ProcUndercatch_Spice(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& name, const Config& cfg);
55
56 virtual void process(const unsigned int& param, const std::vector<MeteoData>& ivec,
57 std::vector<MeteoData>& ovec) override;
58
59 private:
60 // Rain gauge models
61 enum class GaugeModel {
62 Geonor,
63 Hellmann
64 };
65
66 // Wind speed measurement height
67 enum class WindHeight {
68 Gauge,
69 TenMeters
70 };
71
72 // Correction equation types
73 enum class EquationType {
74 Eq1,
75 Eq2,
76 Eq3,
77 max_eqs
78 };
79
80 // Configuration for a single (gauge, height, equation) triplet
81 struct GaugeConfig {
82 EquationType equation;
83 double a, b, c;
84 };
85
86 // Setup for a (gauge, height) pair: all valid equations + fallback selection
87 struct GaugeSetup {
88 GaugeConfig equations[(size_t)EquationType::max_eqs];
89 EquationType fallback_equation;
90 };
91
92 // Static configuration data
93 static const std::map<std::pair<GaugeModel, WindHeight>, GaugeSetup> gauge_setups;
94
95 // Runtime state
96 GaugeModel active_gauge;
97 WindHeight active_height;
98 EquationType primary_eq;
99 EquationType fallback_eq;
100 double primary_a, primary_b, primary_c;
101 double fallback_a, fallback_b, fallback_c;
102 bool use_fallback;
103
104 // Temperature thresholds
105 double Tsnow, Train;
106 static const double Tsnow_SPICE, Train_SPICE;
107
108 // Correction equation implementations (from Kochendorfer et al., 2018)
109 static double eq1(const double& VW, const double& TA, const double& a, const double& b, const double& c);
110 static double eq2(const double& VW, const double& TA, const double& a, const double& b, const double& c);
111 static double eq3(const double& VW, const double& TA, const double& a, const double& b, const double& c);
112
113 void parse_args(const std::vector< std::pair<std::string, std::string> >& vecArgs);
114
115 // Helper functions for parsing
116 static GaugeModel parseGaugeModel(const std::string& name);
117 static WindHeight parseWindHeight(const std::string& name);
118 static EquationType parseEquationType(const std::string& name);
119
120 // Helper to create a GaugeConfig
121 static GaugeConfig makeConfig(EquationType eq, double a, double b, double c);
122};
123
124} //end namespace
125
126#endif
A class that reads a key/value file. These files (typically named *.ini) follow the INI file format s...
Definition Config.h:79
SPICE precipitation correction functions for undercatch in winter conditions.
Definition ProcUndercatch_Spice.h:52
virtual void process(const unsigned int &param, const std::vector< MeteoData > &ivec, std::vector< MeteoData > &ovec) override
Definition ProcUndercatch_Spice.cc:216
The base class for all filters that provides the interface and a few helper methods.
Definition ProcessingBlock.h:67
Definition Config.cc:34