Alpine3D  Alpine3D-3.2.0
MeteoObj.h
Go to the documentation of this file.
1 /***********************************************************************************/
2 /* Copyright 2009-2015 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 METEOOBJ_H
19 #define METEOOBJ_H
20 
21 #include <meteoio/MeteoIO.h>
22 #include <snowpack/libsnowpack.h>
23 
24 #include <alpine3d/MPIControl.h>
25 #include <alpine3d/Glaciers.h>
26 
27 #include <iostream>
28 
29 class SnGrids {
30  public:
34  RH,
35  VW,
36  DW,
37  ISWR,
40  ILWR,
41  HS,
42  PSUM,
46  TSG,
47  TSS,
48  TS0,
52  SWE,
53  RSNO,
56  SP,
57  RB,
58  RG,
59  N3,
67  ET,
69  lastparam=TSOIL5};
70 
71 
72  static const size_t nrOfParameters;
73  static const std::string& getParameterName(const size_t& parindex);
74  static size_t getParameterIndex(const std::string& parname);
75 
76  private:
77  static std::vector<std::string> paramname;
78  static const bool __init;
79  static bool initStaticData();
80 };
81 
82 class MeteoObj
83 {
84  public:
85  MeteoObj(const mio::Config& config, const mio::DEMObject& in_dem);
86  ~MeteoObj();
87 
88  void setSkipWind(const bool& i_skipWind);
89  void prepare(const mio::Date& in_date);
90  void get(const mio::Date& in_date,
91  mio::Grid2DObject& ta,
92  mio::Grid2DObject& rh,
93  mio::Grid2DObject& psum,
94  mio::Grid2DObject& psum_ph,
95  mio::Grid2DObject& vw,
96  mio::Grid2DObject& dw,
97  mio::Grid2DObject& p,
98  mio::Grid2DObject& ilwr);
99  void get(const mio::Date& in_date, std::vector<mio::MeteoData>& o_vecMeteo);
100  void checkMeteoForcing(const mio::Date& calcDate);
101  void setGlacierMask(const mio::Grid2DObject& glacierMask);
102  double getTiming() const;
103 
104  private:
105  static void checkLapseRate(const std::vector<mio::MeteoData>& i_vecMeteo, const mio::MeteoData::Parameters& param);
106  static void checkGridRange(const mio::Date& calcDate, const mio::Grid2DObject& grid, const mio::MeteoData::Parameters& param);
107  static void checkInputsRequirements(std::vector<mio::MeteoData>& vecData);
108  void fillMeteoGrids(const mio::Date& calcDate);
109  void getMeteo(const mio::Date& calcDate);
110 
111  mio::Timer timer;
112  const mio::Config &config;
113  mio::IOManager io;
114  const mio::DEMObject &dem;
115  mio::Grid2DObject ta, rh, psum, psum_ph, vw, dw, p, ilwr;
116  mio::Grid2DObject sum_ta, sum_rh, sum_rh_psum, sum_psum, sum_psum_ph, sum_vw, sum_ilwr;
117  std::vector<mio::MeteoData> vecMeteo;
118  mio::Date date;
119  Glaciers *glaciers;
120  unsigned int count_sums, count_precip;
121  bool skipWind;
122 };
123 
124 #endif
Average snow density in the top xxx m.
Definition: MeteoObj.h:51
internal usage (precipitation events that are delayed because they are too small) ...
Definition: MeteoObj.h:64
Albedo of the surface (ie below canopy)
Definition: MeteoObj.h:55
runoff on the surface of the soil (vitual lysimeter)
Definition: MeteoObj.h:60
Relative humidity.
Definition: MeteoObj.h:34
Incoming long wave radiation.
Definition: MeteoObj.h:40
static size_t getParameterIndex(const std::string &parname)
Definition: MeteoObj.cc:89
Definition: MeteoObj.h:68
Evapotranspiration.
Definition: MeteoObj.h:67
Wind direction (deg)
Definition: MeteoObj.h:36
Incoming short wave, direct.
Definition: MeteoObj.h:39
Definition: MeteoObj.h:32
Temperature snow surface.
Definition: MeteoObj.h:47
Snow mean density.
Definition: MeteoObj.h:53
Definition: MeteoObj.h:68
Snow Water Equivalent.
Definition: MeteoObj.h:52
Average snow temperature in the top xxx m.
Definition: MeteoObj.h:50
Albedo from the top (ie above canopy)
Definition: MeteoObj.h:54
Water equivalent precipitation from artificial snow production.
Definition: MeteoObj.h:44
sphericity
Definition: MeteoObj.h:56
mask showing the glaciated pixels
Definition: MeteoObj.h:65
grain Coordination number
Definition: MeteoObj.h:59
The total amount of water in the snowpack at the present time.
Definition: MeteoObj.h:62
Parameters
Definition: MeteoObj.h:32
Definition: MeteoObj.h:68
Definition: MeteoObj.h:82
static const std::string & getParameterName(const size_t &parindex)
Definition: MeteoObj.cc:81
Snow temperature at depth xxx m.
Definition: MeteoObj.h:49
Definition: Glaciers.h:47
Temperature ground surface.
Definition: MeteoObj.h:46
Incoming short wave radiation.
Definition: MeteoObj.h:37
bond radius
Definition: MeteoObj.h:57
Height of snow.
Definition: MeteoObj.h:41
Air temperature.
Definition: MeteoObj.h:33
Definition: MeteoObj.h:68
Incoming short wave, diffuse.
Definition: MeteoObj.h:38
Definition: MeteoObj.h:29
The mass loss or gain of the top element due to snow (ice) sublimating.
Definition: MeteoObj.h:63
mask showing the exposed glaciated pixels (ie not snow covered)
Definition: MeteoObj.h:66
grain radius
Definition: MeteoObj.h:58
Temperature within the soil, at a given depth.
Definition: MeteoObj.h:68
Used as a boolean flag to decide whever a pixel is scheduled for grooming or not. ...
Definition: MeteoObj.h:45
Water equivalent of precipitations, either solid or liquid.
Definition: MeteoObj.h:42
static const size_t nrOfParameters
holds the number of meteo parameters stored in MeteoData
Definition: MeteoObj.h:72
Precipitation phase, between 0 (fully solid) and 1 (fully liquid)
Definition: MeteoObj.h:43
runoff at the bottom of the snow/soil column
Definition: MeteoObj.h:61
Wind velocity.
Definition: MeteoObj.h:35
Definition: MeteoObj.h:69
Temperature soil surface.
Definition: MeteoObj.h:48