16 #ifndef SNOWPACKINTERFACEWORKER_H 17 #define SNOWPACKINTERFACEWORKER_H 24 #include <snowpack/libsnowpack.h> 30 const mio::DEMObject& dem_in,
31 const mio::Grid2DObject& landuse_in,
32 const std::vector< std::pair<size_t,size_t> >& pts_in,
33 const std::vector<SnowStation*>& snow_stations,
34 const std::vector<std::pair<size_t,size_t> >& snow_stations_coord,
35 const size_t offset_in);
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);
49 void runModel(
const mio::Date& julian,
50 const mio::Grid2DObject &psum,
51 const mio::Grid2DObject &psum_ph,
52 const mio::Grid2DObject &psum_tech,
53 const mio::Grid2DObject &rh,
54 const mio::Grid2DObject &ta,
55 const mio::Grid2DObject &vw,
56 const mio::Grid2DObject &dw,
57 const mio::Grid2DObject &mns,
58 const mio::Grid2DObject &shortwave,
59 const mio::Grid2DObject &diffuse,
60 const mio::Grid2DObject &longwave,
61 const double solarElevation);
63 void grooming(
const mio::Date ¤t_date,
const mio::Grid2DObject &grooming_map);
66 static bool skipThisCell(
const double& landuse_val,
const double& dem_val);
67 static bool is_special(
const std::vector< std::pair<size_t,size_t> >& pts_in,
const size_t& ix,
const size_t& iy);
70 void setLateralFlow(
const std::vector<SnowStation*>& snow_station);
73 void initGrids(std::vector<std::string>& params);
74 void gatherSpecialPoints(
const CurrentMeteo& meteoPixel,
const SnowStation& snowPixel,
const SurfaceFluxes& surfaceFlux);
75 void fillGrids(
const size_t& ii,
const size_t& jj,
const CurrentMeteo& meteoPixel,
const SnowStation& snowPixel,
const SurfaceFluxes& surfaceFlux);
78 SnowpackConfig sn_cfg;
84 const mio::DEMObject dem;
85 const size_t dimx, dimy, offset;
86 std::vector<SnowStation*> SnowStations;
87 std::vector<std::pair<size_t,size_t> > SnowStationsCoord;
88 std::vector<bool> isSpecialPoint;
90 const mio::Grid2DObject landuse;
91 mio::Grid2DObject store;
92 std::map< SnGrids::Parameters, mio::Grid2DObject > grids;
95 std::vector<SnowStation> snow_pixel;
96 std::vector<CurrentMeteo> meteo_pixel;
97 std::vector<SurfaceFluxes> surface_flux;
98 std::vector<double> soil_temp_depths;
100 double calculation_step_length;
101 double height_of_wind_value;
102 double snow_temp_depth, snow_avg_temp_depth, snow_avg_rho_depth;
103 bool useDrift, useEBalance, useCanopy;
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:276
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:431
void setUseEBalance(const bool useEBalance_in)
Definition: SnowpackInterfaceWorker.h:40
void clearSpecialPointsData()
Definition: SnowpackInterfaceWorker.cc:243
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:711
void getOutputSNO(std::vector< SnowStation *> &snow_station) const
method that returns SnowCover files for specific date.
Definition: SnowpackInterfaceWorker.cc:254
static void uniqueOutputGrids(std::vector< std::string > &output_grids)
Make sure all requested grids only appear once.
Definition: SnowpackInterfaceWorker.cc:202
Definition: SnowpackInterfaceWorker.h:26
void grooming(const mio::Date ¤t_date, const mio::Grid2DObject &grooming_map)
Definition: SnowpackInterfaceWorker.cc:636
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:686
~SnowpackInterfaceWorker()
Definition: SnowpackInterfaceWorker.cc:188
Parameters
Definition: MeteoObj.h:32
void getOutputSpecialPoints(std::vector< SnowStation *> &ptr_snow_pixel, std::vector< CurrentMeteo *> &ptr_meteo_pixel, std::vector< SurfaceFluxes *> &ptr_surface_flux)
Definition: SnowpackInterfaceWorker.cc:232
double & getGridPoint(const SnGrids::Parameters ¶m, const size_t &ii, const size_t &jj)
Retrieve one point (ii,jj) from the specified grid.
Definition: SnowpackInterfaceWorker.cc:293
static bool skipThisCell(const double &landuse_val, const double &dem_val)
check if a cell should be simulated or skipped
Definition: SnowpackInterfaceWorker.cc:671
static int round_landuse(const double &landuse_dbl)
optimised way to round landuse
Definition: SnowpackInterfaceWorker.cc:661
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)
Constructs and initialise Snowpack Interface Worker. Create one worker and init values for slice whic...
Definition: SnowpackInterfaceWorker.cc:127
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:699