#include <SnowpackInterfaceWorker.h>
Public Member Functions | |
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 which the worker need to simulate it slice. More... | |
~SnowpackInterfaceWorker () | |
void | setUseDrift (const bool useDrift_in) |
void | setUseEBalance (const bool useEBalance_in) |
void | getOutputSNO (std::vector< SnowStation *> &snow_station) const |
method that returns SnowCover files for specific date. More... | |
void | getOutputSpecialPoints (std::vector< SnowStation *> &ptr_snow_pixel, std::vector< CurrentMeteo *> &ptr_meteo_pixel, std::vector< SurfaceFluxes *> &ptr_surface_flux) |
void | clearSpecialPointsData () |
mio::Grid2DObject | getGrid (const SnGrids::Parameters ¶m) const |
Method that the Master can search the neded data (in grids) from Worker (Pull from client) More... | |
double & | getGridPoint (const SnGrids::Parameters ¶m, const size_t &ii, const size_t &jj) |
Retrieve one point (ii,jj) from the specified grid. More... | |
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. More... | |
void | grooming (const mio::Date ¤t_date, const mio::Grid2DObject &grooming_map) |
void | getLateralFlow (std::vector< SnowStation *> &snow_station) |
method called by SnowpackInterface to retrieve all snow_pixels, to read the lateral flow variable More... | |
void | setLateralFlow (const std::vector< SnowStation *> &snow_station) |
method called by SnowpackInterface to send back the source/sink term for treating lateral flow More... | |
Static Public Member Functions | |
static int | round_landuse (const double &landuse_dbl) |
optimised way to round landuse More... | |
static bool | skipThisCell (const double &landuse_val, const double &dem_val) |
check if a cell should be simulated or skipped More... | |
static bool | is_special (const std::vector< std::pair< size_t, size_t > > &pts_in, const size_t &ix, const size_t &iy) |
static void | uniqueOutputGrids (std::vector< std::string > &output_grids) |
Make sure all requested grids only appear once. More... | |
SnowpackInterfaceWorker::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 which the worker need to simulate it slice.
io_cfg | configuration to pass to Snowpack |
dem_in | gives the demographic Data. Also tetermines size and position of the slice |
landuse_in | gives the landuse Data. Also tetermines size and position of the landuse for slice |
pts_in | gives the spezial points. For this points more output is done then for the others. Calcualtion is the same. |
snow_stations | gives a vector of pointers to the SnowStation objects relevant for this thread |
snow_stations_coord | provide the (ii,jj) coordinates of each snow station. This is necessary because the slices might be irregular |
offset_in | gives the offsett on X for this slice (needed to read data and error messages) |
SnowpackInterfaceWorker::~SnowpackInterfaceWorker | ( | ) |
void SnowpackInterfaceWorker::clearSpecialPointsData | ( | ) |
mio::Grid2DObject SnowpackInterfaceWorker::getGrid | ( | const SnGrids::Parameters & | param | ) | const |
Method that the Master can search the neded data (in grids) from Worker (Pull from client)
param | says which grid param the Master wants to have |
double & SnowpackInterfaceWorker::getGridPoint | ( | const SnGrids::Parameters & | param, |
const size_t & | ii, | ||
const size_t & | jj | ||
) |
Retrieve one point (ii,jj) from the specified grid.
param | says which grid param the Master wants to have |
ii | ii index |
jj | jj index |
void SnowpackInterfaceWorker::getLateralFlow | ( | std::vector< SnowStation *> & | ptr_snow_pixel | ) |
method called by SnowpackInterface to retrieve all snow_pixels, to read the lateral flow variable
ptr_snow_pixel | to vector of SnowStations, where the variable SlopeParFlux contains the lateral flow |
void SnowpackInterfaceWorker::getOutputSNO | ( | std::vector< SnowStation *> & | snow_station | ) | const |
method that returns SnowCover files for specific date.
snow_station | vector that will be filled with the SnowStation data for each pixels |
void SnowpackInterfaceWorker::getOutputSpecialPoints | ( | std::vector< SnowStation *> & | ptr_snow_pixel, |
std::vector< CurrentMeteo *> & | ptr_meteo_pixel, | ||
std::vector< SurfaceFluxes *> & | ptr_surface_flux | ||
) |
void SnowpackInterfaceWorker::grooming | ( | const mio::Date & | current_date, |
const mio::Grid2DObject & | grooming_map | ||
) |
|
static |
|
static |
optimised way to round landuse
landuse_dbl | is the landuse to round |
void SnowpackInterfaceWorker::runModel | ( | const mio::Date & | date, |
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.
date | current simulation time step |
psum | precipitation grid (kg m-2) |
psum_ph | precipitation phase grid (between 0 and 1) |
psum_tech | technical precipitation grid (kg m-2) |
rh | relative humidity grid (% or 1) |
ta | air temperature grid (K) |
vw | wind velocity grid (m s-1) |
dw | wind direction grid (degrees north) |
mns | map of the Precipitation (mm/h) HACK get this map only if per pull from Master if Drift is used !! |
shortwave | incoming shortwave radiation grid (W m-2) |
diffuse | diffuse radiation from the sky grid (W m-2) |
longwave | incoming longwave grid (W m-2) |
solarElevation | solar elevation (in dec) |
void SnowpackInterfaceWorker::setLateralFlow | ( | const std::vector< SnowStation *> & | ptr_snow_pixel | ) |
method called by SnowpackInterface to send back the source/sink term for treating lateral flow
ptr_snow_pixel | to vector of SnowStations, in which the lwc_source variable is set to contain the lateral flow. |
|
inline |
|
inline |
|
static |
check if a cell should be simulated or skipped
landuse_val | land use parameter for this pixel |
dem_val | dem altitude for this pixel |
|
static |
Make sure all requested grids only appear once.
output_grids | vector of requeste grids to sort and filter |