16#ifndef SNOWPACKINTERFACEWORKER_H
17#define SNOWPACKINTERFACEWORKER_H
23#include <snowpack/libsnowpack.h>
29 const mio::DEMObject& dem_in,
30 const mio::Grid2DObject& landuse_in,
31 const std::vector< std::pair<size_t,size_t> >& pts_in,
32 const std::vector<SnowStation*>& snow_stations,
33 const std::vector<std::pair<size_t,size_t> >& snow_stations_coord,
34 const size_t offset_in,
35 const std::vector<std::string>& grids_not_computed_in_worker);
39 void setUseDrift(
const bool useDrift_in) {useDrift = useDrift_in;}
40 void setUseEBalance(
const bool useEBalance_in) {useEBalance = useEBalance_in;}
41 void getOutputSNO(std::vector<SnowStation*>& snow_station)
const;
42 void getOutputSpecialPoints(std::vector<SnowStation*>& ptr_snow_pixel, std::vector<CurrentMeteo*>& ptr_meteo_pixel,
43 std::vector<SurfaceFluxes*>& ptr_surface_flux);
48 void runModel(
const mio::Date& julian,
49 const mio::Grid2DObject &psum,
50 const mio::Grid2DObject &psum_ph,
51 const mio::Grid2DObject &psum_tech,
52 const mio::Grid2DObject &rh,
53 const mio::Grid2DObject &ta,
54 const mio::Grid2DObject &vw,
55 const mio::Grid2DObject &dw,
56 const mio::Grid2DObject &mns,
57 const mio::Grid2DObject &shortwave,
58 const mio::Grid2DObject &diffuse,
59 const mio::Grid2DObject &longwave,
60 const double solarElevation);
62 void grooming(
const mio::Date ¤t_date,
const mio::Grid2DObject &grooming_map);
65 static bool skipThisCell(
const double& landuse_val,
const double& dem_val);
66 static bool is_special(
const std::vector< std::pair<size_t,size_t> >& pts_in,
const size_t& ix,
const size_t& iy);
69 void setLateralFlow(
const std::vector<SnowStation*>& snow_station);
72 void initGrids(std::vector<std::string> params,
const std::vector<std::string>& grids_not_computed_in_worker);
73 void gatherSpecialPoints(
const CurrentMeteo& meteoPixel,
const SnowStation& snowPixel,
const SurfaceFluxes& surfaceFlux);
74 void fillGrids(
const size_t& ii,
const size_t& jj,
const CurrentMeteo& meteoPixel,
const SnowStation& snowPixel,
const SurfaceFluxes& surfaceFlux);
81 SnowpackConfig sn_cfg;
87 const mio::DEMObject& dem;
88 const size_t dimx, dimy, offset;
89 std::vector<SnowStation*> SnowStations;
90 std::vector<bool> isSpecialPoint;
92 const mio::Grid2DObject& landuse;
93 mio::Grid2DObject store;
94 std::map< SnGrids::Parameters, mio::Grid2DObject > grids;
97 std::vector<SnowStation> snow_pixel;
98 std::vector<CurrentMeteo> meteo_pixel;
99 std::vector<SurfaceFluxes> surface_flux;
100 std::vector<double> soil_temp_depths, soil_runoff_depths;
102 double calculation_step_length;
103 double height_of_wind_value;
104 double snow_temp_depth, snow_avg_temp_depth, snow_avg_rho_depth;
105 bool useDrift, useEBalance, useCanopy;
Parameters
this enum provides names for possible Snowpack grids
Definition: MeteoObj.h:33
Definition: SnowpackInterfaceWorker.h:26
void getOutputSpecialPoints(std::vector< SnowStation * > &ptr_snow_pixel, std::vector< CurrentMeteo * > &ptr_meteo_pixel, std::vector< SurfaceFluxes * > &ptr_surface_flux)
Definition: SnowpackInterfaceWorker.cc:279
static int round_landuse(const double &landuse_dbl)
optimised way to round landuse
Definition: SnowpackInterfaceWorker.cc:707
void setLateralFlow(const std::vector< SnowStation * > &snow_station)
method called by SnowpackInterface to send back the source/sink term for treating lateral flow
Definition: SnowpackInterfaceWorker.cc:757
void setUseEBalance(const bool useEBalance_in)
Definition: SnowpackInterfaceWorker.h:40
static void uniqueOutputGrids(std::vector< std::string > &output_grids)
Make sure all requested grids only appear once.
Definition: SnowpackInterfaceWorker.cc:245
void setUseDrift(const bool useDrift_in)
Definition: SnowpackInterfaceWorker.h:39
SnowpackInterfaceWorker(const mio::Config &io_cfg, const mio::DEMObject &dem_in, const mio::Grid2DObject &landuse_in, const std::vector< std::pair< size_t, size_t > > &pts_in, const std::vector< SnowStation * > &snow_stations, const std::vector< std::pair< size_t, size_t > > &snow_stations_coord, const size_t offset_in, const std::vector< std::string > &grids_not_computed_in_worker)
Constructs and initialise Snowpack Interface Worker. Create one worker and init values for slice whic...
Definition: SnowpackInterfaceWorker.cc:157
void grooming(const mio::Date ¤t_date, const mio::Grid2DObject &grooming_map)
Definition: SnowpackInterfaceWorker.cc:682
std::vector< std::pair< size_t, size_t > > SnowStationsCoord
Definition: SnowpackInterfaceWorker.h:78
static bool skipThisCell(const double &landuse_val, const double &dem_val)
check if a cell should be simulated or skipped
Definition: SnowpackInterfaceWorker.cc:717
static bool is_special(const std::vector< std::pair< size_t, size_t > > &pts_in, const size_t &ix, const size_t &iy)
Definition: SnowpackInterfaceWorker.cc:732
~SnowpackInterfaceWorker()
Definition: SnowpackInterfaceWorker.cc:231
void clearSpecialPointsData()
Definition: SnowpackInterfaceWorker.cc:290
void getOutputSNO(std::vector< SnowStation * > &snow_station) const
method that returns SnowCover files for specific date.
Definition: SnowpackInterfaceWorker.cc:301
void getLateralFlow(std::vector< SnowStation * > &snow_station)
method called by SnowpackInterface to retrieve all snow_pixels, to read the lateral flow variable
Definition: SnowpackInterfaceWorker.cc:745
mio::Grid2DObject getGrid(const SnGrids::Parameters ¶m) const
Method that the Master can search the neded data (in grids) from Worker (Pull from client)
Definition: SnowpackInterfaceWorker.cc:323
void runModel(const mio::Date &julian, const mio::Grid2DObject &psum, const mio::Grid2DObject &psum_ph, const mio::Grid2DObject &psum_tech, const mio::Grid2DObject &rh, const mio::Grid2DObject &ta, const mio::Grid2DObject &vw, const mio::Grid2DObject &dw, const mio::Grid2DObject &mns, const mio::Grid2DObject &shortwave, const mio::Grid2DObject &diffuse, const mio::Grid2DObject &longwave, const double solarElevation)
method which prepares all data for simulation and then access correctly the Snowpack model interfaces...
Definition: SnowpackInterfaceWorker.cc:470