Alpine3D 20241222.625fd38
TechSnowA3D.h
Go to the documentation of this file.
1/***********************************************************************************/
2/* Copyright 2018-2018 WSL Institute for Snow and Avalanche Research SLF-DAVOS */
3/***********************************************************************************/
4/* This file is part of Alpine3D.
5 Alpine3D is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 Alpine3D is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with Alpine3D. If not, see <http://www.gnu.org/licenses/>.
17*/
18#ifndef TECHSNOWA3D_H
19#define TECHSNOWA3D_H
20
22
23#include <meteoio/MeteoIO.h>
24#include <snowpack/libsnowpack.h>
25#include <alpine3d/MeteoObj.h>
26
71{
72 public:
73 TechSnowA3D(const mio::Config& cfg, const mio::DEMObject& dem);
74
75 void setMeteo(const mio::Grid2DObject& ta,
76 const mio::Grid2DObject& rh,
77 const mio::Grid2DObject& hs,
78 const mio::Date& timestamp);
79
80 mio::Grid2DObject getGrid(const SnGrids::Parameters& param) const;
81
82 static std::string getGridsRequirements() { return "TA RH HS"; }
83
84 private:
85 typedef struct CONDITION {
86 CONDITION()
87 : slope_area(0.), number_snowguns(0), priority(mio::IOUtils::unodata), min_height(0.) {}
88
89 void setUserProperties(const unsigned int& nr_snowguns, const unsigned int& i_priority, const double& i_min_height, const double& wb_thresh) {
90 number_snowguns = nr_snowguns;
91 priority = i_priority;
92 min_height = i_min_height;
93 wet_bulb_thresh = wb_thresh;
94 }
95
96 const std::string toString() {std::ostringstream os; os << "[" << slope_area << "m², " << number_snowguns << " snowguns, " << priority << " priority, " << min_height << "m min, min wbt: " << wet_bulb_thresh << "°C]"; return os.str();}
97
98 double slope_area; //area of the slope section
99 unsigned int number_snowguns; //number of snow guns per slope section
100 unsigned int priority; //snow production priority for this slope
101 double min_height; //minimum snow height for technical snow production
102 double wet_bulb_thresh; //wet bulb temperature threshold (°C) below which snow can be produced
103 } condition;
104
105 typedef struct SNOWSTRATEGY {
106 SNOWSTRATEGY() : startProd(), endProd(), startAim(0.), endAim(0.), gunOperation(0.) {}
107 const std::string toString() {std::ostringstream os; os << "[" << startProd.toString(mio::Date::ISO) << "-" << endProd.toString(mio::Date::ISO) << " aim: " << startAim << " -> " << endAim << " @ " << gunOperation << "]"; return os.str();}
108
109 mio::Date startProd; //start date of snow production
110 mio::Date endProd; //end date of snow production
111 double startAim; //snow production aim in snow height [m] until ski resort opening (factor x snow_prod_min)
112 double endAim; //snow production aim in snow height [m] between ski resort opening and end date of snow production (factor x snow_prod_min)
113 double gunOperation; //percentage of snow gun operation
114 } snowStrategy;
115
116 static TechSnowA3D::snowStrategy setSnowStrategy(const mio::Config& cfg, const double& TZ, const unsigned int& nr);
117 void setSlopeConditions(const std::string& filename);
118 static size_t getSlopeNumber(const double& dbl_code);
119 double setPriority(const mio::Date& date, const TechSnowA3D::snowStrategy &ppt, const double& snow_height, const TechSnowA3D::condition& slope, const int date_hour) const;
120
121 mio::Grid2DObject skiRunsMap;
122 mio::Grid2DObject psum_tech;
123
124 std::map<size_t, condition> slope_conditions;
125 mio::Date start_season, end_season;
126 mio::Date earliest_production;
127 std::vector<snowStrategy> priorities;
128
129 double max_snowgun_water;
130 const double mean_elevation;
131 int slope_open, slope_closed;
132};
133
134#endif
Parameters
this enum provides names for possible Snowpack grids
Definition: MeteoObj.h:33
Definition: SnowpackInterfaceWorker.h:26
Definition: TechSnowA3D.h:71
mio::Grid2DObject getGrid(const SnGrids::Parameters &param) const
Definition: TechSnowA3D.cc:254
TechSnowA3D(const mio::Config &cfg, const mio::DEMObject &dem)
Reading the slope file and slope conditions.
Definition: TechSnowA3D.cc:36
void setMeteo(const mio::Grid2DObject &ta, const mio::Grid2DObject &rh, const mio::Grid2DObject &hs, const mio::Date &timestamp)
Get the grooming and amount of technical snow production map.
Definition: TechSnowA3D.cc:217
static std::string getGridsRequirements()
Definition: TechSnowA3D.h:82