MeteoIODoc 20241221.207bde49
TauCLDGenerator.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-3.0-or-later
2/***********************************************************************************/
3/* Copyright 2013 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 TAUCLDGENERATOR_H
20#define TAUCLDGENERATOR_H
21
25
26#include <map>
27
28namespace mio {
29
87 public:
88 typedef enum CLF_PARAMETRIZATION {
89 DEFAULT, //will be mapped to KASTEN
94
95 TauCLDGenerator(const std::vector< std::pair<std::string, std::string> >& vecArgs, const std::string& i_algo, const std::string& i_section, const double& TZ, const Config &i_cfg);
97
98 bool generate(const size_t& param, MeteoData& md, const std::vector<MeteoData>& vecMeteo);
99 bool create(const size_t& param, const size_t& ii_min, const size_t& ii_max, std::vector<MeteoData>& vecMeteo);
100
101 protected:
102 struct CLOUDCACHE; //forward declaration
103 typedef struct CLOUDCACHE cloudCache;
104
105 double interpolateCloudiness(const std::string& station_hash, const double& julian_gmt) const;
106 double getCloudiness(const MeteoData& md);
107 double computeCloudiness(const MeteoData& md, bool &is_night);
108 double getClearness(const double& cloudiness) const;
109 static std::vector< std::pair<double,double> > computeMask(const DEMObject& i_dem, const StationData& sd);
110 double getHorizon(const MeteoData& md, const double& sun_azi);
111
112 std::map< std::string, cloudCache > last_cloudiness; //as < station_hash, <julian_gmt, cloudiness> >
113 std::map< std::string , std::vector< std::pair<double,double> > > masks;
114 std::string horizons_outfile;
115 const Config &cfg;
121};
122
123
129 CLOUDCACHE() : last_valid(std::make_pair(IOUtils::nodata, IOUtils::nodata)) {}
130 CLOUDCACHE(const double& julian_gmt, const double& cloudiness) : last_valid(std::make_pair(IOUtils::nodata, IOUtils::nodata)) { addCloudiness(julian_gmt, cloudiness); }
131
132 void addCloudiness(const double& julian_gmt, const double& cloudiness);
133
134 std::pair<double, double> last_valid;
135};
136
137} //end namespace mio
138
139#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 DEMs and automatically compute some properties. This class stores elevation grid...
Definition: DEMObject.h:40
Interface class for the generator models.
Definition: GeneratorAlgorithms.h:111
A class to represent a singular measurement received from one station at a certain time (represented ...
Definition: MeteoData.h:108
A class to represent meteo stations with attributes like longitude, latitude, etc.
Definition: StationData.h:41
A class to calculate Solar radiation characteristics This is largely based on M. Iqbal,...
Definition: Sun.h:37
Atmospheric transmissivity generator.
Definition: TauCLDGenerator.h:86
bool use_rswr
Definition: TauCLDGenerator.h:119
clf_parametrization cloudiness_model
Definition: TauCLDGenerator.h:118
double getHorizon(const MeteoData &md, const double &sun_azi)
Definition: TauCLDGenerator.cc:116
std::string horizons_outfile
Definition: TauCLDGenerator.h:114
std::map< std::string, cloudCache > last_cloudiness
Definition: TauCLDGenerator.h:112
DEMObject dem
Definition: TauCLDGenerator.h:116
bool use_rad_threshold
Definition: TauCLDGenerator.h:119
clf_parametrization
Definition: TauCLDGenerator.h:88
@ CLF_CRAWFORD
Definition: TauCLDGenerator.h:92
@ KASTEN
Definition: TauCLDGenerator.h:91
@ DEFAULT
Definition: TauCLDGenerator.h:89
@ CLF_LHOMME
Definition: TauCLDGenerator.h:90
bool use_horizons
Definition: TauCLDGenerator.h:120
bool generate(const size_t &param, MeteoData &md, const std::vector< MeteoData > &vecMeteo)
Definition: TauCLDGenerator.cc:289
bool write_mask_out
Definition: TauCLDGenerator.h:120
static std::vector< std::pair< double, double > > computeMask(const DEMObject &i_dem, const StationData &sd)
Definition: TauCLDGenerator.cc:104
double computeCloudiness(const MeteoData &md, bool &is_night)
Compute the atmospheric cloudiness from the available measurements.
Definition: TauCLDGenerator.cc:226
double getCloudiness(const MeteoData &md)
Return the atmospheric cloudiness.
Definition: TauCLDGenerator.cc:176
double interpolateCloudiness(const std::string &station_hash, const double &julian_gmt) const
Definition: TauCLDGenerator.cc:141
bool create(const size_t &param, const size_t &ii_min, const size_t &ii_max, std::vector< MeteoData > &vecMeteo)
Fill one time series of MeteoData for one station.
Definition: TauCLDGenerator.cc:300
SunObject sun
Definition: TauCLDGenerator.h:117
TauCLDGenerator(const std::vector< std::pair< std::string, std::string > > &vecArgs, const std::string &i_algo, const std::string &i_section, const double &TZ, const Config &i_cfg)
Definition: TauCLDGenerator.cc:29
double getClearness(const double &cloudiness) const
Compute the clearness index from an atmospheric cloudiness value.
Definition: TauCLDGenerator.cc:92
~TauCLDGenerator()
Definition: TauCLDGenerator.cc:74
const Config & cfg
Definition: TauCLDGenerator.h:115
std::map< std::string, std::vector< std::pair< double, double > > > masks
Definition: TauCLDGenerator.h:113
bool from_dem
Definition: TauCLDGenerator.h:120
const double nodata
This is the internal nodata value.
Definition: IOUtils.h:75
Definition: Config.cc:31
This is a small helper structure to store pairs of <timestamp, cloudiness> values for caching.
Definition: TauCLDGenerator.h:128
void addCloudiness(const double &julian_gmt, const double &cloudiness)
Add a cloudiness value to the cache.
Definition: TauCLDGenerator.cc:162
std::pair< double, double > last_valid
Definition: TauCLDGenerator.h:134
CLOUDCACHE(const double &julian_gmt, const double &cloudiness)
Definition: TauCLDGenerator.h:130
CLOUDCACHE()
Definition: TauCLDGenerator.h:129