#include <Runoff.h>
Public Member Functions | |
Runoff (const mio::Config &in_cfg, const mio::DEMObject &in_dem, const double &in_thresh_rain) | |
Constructor of Runoff instance. More... | |
Runoff (const Runoff ©) | |
void | setSnowPack (SnowpackInterface &sn_interface) |
Sets the internal reference to SnowpackInterface object. More... | |
virtual void | output (const mio::Date &i_date, const mio::Grid2DObject &psum, const mio::Grid2DObject &ta, mio::IOManager &io_in) |
Writes the results for a specific day. More... | |
virtual | ~Runoff () |
Destructor of class Runoff. More... | |
std::string | getGridsRequirements () const |
double | getTiming () const |
Runoff (mio::IOManager &sn_io, const double &) | |
Constructor of Runoff instance. More... | |
~Runoff () | |
bool | initialize (const mio::DEMObject &in_dem, const mio::Config &cfg) |
This method initialize the importent parameters of Runoff. More... | |
void | setRunoff (const mio::Array2D< double > &, const mio::Array2D< double > &runoff_soil, const mio::Array2D< double > &, const mio::Array2D< double > &, const mio::Array2D< double > &) |
void | output (const mio::Date &i_date) |
Writes the Results for a specific day. More... | |
Protected Types | |
enum | NumberingType { Alpine3DOld, TauDEM } |
Protected Member Functions | |
virtual void | constructCatchmentMasks (mio::Grid2DObject catchmentGrid) |
Initializes private attribute catchment_masks. More... | |
virtual void | updateTotalRunoffGrid () |
Updates protected attribute total_runoff. More... | |
virtual void | updateGlacierMask () |
Updates protected attribute glacier_mask. More... | |
virtual mio::Grid2DObject | computePrecipRunoff (const mio::Grid2DObject &psum, const mio::Grid2DObject &ta) const |
Computes the grid storing the runoff which originates from liquid precipitation. More... | |
virtual void | getExtraMeteoGrids (std::vector< mio::Grid2DObject > &grids) const |
Returns the grids corresponding to the additional meteo variables which have to be averaged over the subcatchments and written in the output files. More... | |
virtual void | initializeOutputFiles (const mio::Grid2DObject &dem) const |
Initializes the SMET files in which the per-catchment-aggregated runoff values will be written. More... | |
virtual void | updateOutputFile (const size_t &catchId, const mio::Date &currTime, const double &totalRunoff, const double &precipRunoff, const double &snowRunoff, const double &glacierRunoff, const std::vector< double > &meteoVars) const |
Writes the runoff values aggregated over a given catchment in the corresponding SMET file. More... | |
Static Protected Member Functions | |
static mio::IOManager * | getIOManager (mio::Config in_cfg, const bool &outputGrids) |
Returns a IOManager object which will write the runoff grids in the correct output folder. More... | |
static mio::Grid2DObject | getSlopeCorrection (const mio::DEMObject &dem) |
Computes the grid used to correct the runoff values for slope (Alpine3D assumes the cells to be flat, the predicted runoffs therefore have to be corrected for terrain inclination) More... | |
static NumberingType | getCatchmentNumberingScheme (const mio::Config &in_cfg) |
Returns the numbering scheme used in the grid defining the catchments. More... | |
static bool | getIsGlacierDynamic (const mio::Config &cfg) |
Returns whether the glaciers are dynamic, i.e. whether the glacier mask should be expected to change from one time step to the other. More... | |
static std::vector< SnGrids::Parameters > | getExtraMeteoVariables (const mio::Config &cfg) |
This method returns the meteo variables which have to be averaged over the subwatershed areas and written in the output files on top of runoff. More... | |
static double | getResamplingCellSize (const mio::DEMObject &in_dem, const mio::Grid2DObject &catchments) |
Returns the cell size which must be used to resample both the catchment masks and the runoff grids. More... | |
static bool | isMultiple (const double &a, const double &b) |
Returns whether the first input is a multiple of the second one. More... | |
static double | estimateResamplingCellSize (const double &llOffset, const double &currSizeEstimate) |
static std::vector< size_t > | factorizeCatchmentNumber (longuint value) |
This function splits up a given unsigned int value into a sum of powers of 2. More... | |
static void | cropMask (mio::Grid2DObject &mask) |
Crops the mask so as to remove as many nodata cells as possible (note: this method possibly changes the georeferencing of the mask by changing its lower-left corner as well as its number of rows or columns) More... | |
static double | sumOverMask (const mio::Grid2DObject &grid, const mio::Grid2DObject &mask) |
Sums the values of the grid cells which are located over the mask. More... | |
static double | averageOverMask (const mio::Grid2DObject &grid, const mio::Grid2DObject &mask) |
Averages the values of the grid cells which are located over the mask. More... | |
Protected Attributes | |
mio::IOManager * | io |
SnowpackInterface * | snowpack |
Reference to SnowpackInterface object, used for callbacks, initialized during construction. More... | |
const double | thresh_rain |
const double | tz_out |
bool | output_grids |
bool | output_sums |
std::string | catchment_out_path |
double | resampling_cell_size |
double | grid_size_factor |
const size_t | n_grid_cells |
enum Runoff::NumberingType | catchment_numbering |
mio::Timer | timer |
const mio::Grid2DObject | slope_correction |
const bool | is_glacier_mask_dynamic |
bool | is_glacier_mask_set |
mio::Grid2DObject | total_runoff |
mio::Grid2DObject | glacier_mask |
std::vector< SnGrids::Parameters > | extra_meteo_variables |
size_t | n_extra_meteo_variables |
std::map< size_t, mio::Grid2DObject > | catchment_masks |
bool | use_external_iomanager_for_grids |
Static Protected Attributes | |
static const double | MIN_CELL_SIZE = 5.0 |
static const double | DISTANCE_ABSOLUTE_PRECISION = 1e-3 |
|
protected |
Runoff::Runoff | ( | const mio::Config & | in_cfg, |
const mio::DEMObject & | in_dem, | ||
const double & | in_thresh_rain | ||
) |
Constructor of Runoff instance.
in_cfg | reference to the config object used by SnowpackInterfaceWorker in order to build our own IOManager in Runoff |
in_dem | reference to the DEM used by Alpine3D |
in_thresh_rain | rain/snow temperature threshold. This will be used to correctly split the output between melt/precipitation |
Runoff::Runoff | ( | const Runoff & | copy | ) |
|
virtual |
Runoff::Runoff | ( | mio::IOManager & | sn_io, |
const double & | |||
) |
Runoff::~Runoff | ( | ) |
|
staticprotected |
Averages the values of the grid cells which are located over the mask.
grid | grid whose cell values have to be averaged |
mask | mask over which the grid cell values have to be averaged |
|
protectedvirtual |
Computes the grid storing the runoff which originates from liquid precipitation.
psum | grid of precipitation in mm/h |
ta | grid of air temperature |
|
protectedvirtual |
Initializes private attribute catchment_masks.
catchmentGrid | grid defining the catchments. The catchment numbering scheme must be specified in the ini file using the key CATCHMENT_NUMBERING in section INPUT. This scheme can be either ALPINE3D_OLD (for catchments numbered with powers of 2), or TAUDEM (for standard numbering). |
|
staticprotected |
Crops the mask so as to remove as many nodata cells as possible (note: this method possibly changes the georeferencing of the mask by changing its lower-left corner as well as its number of rows or columns)
|
staticprotected |
|
staticprotected |
This function splits up a given unsigned int value into a sum of powers of 2.
value | The value that shall be split up into a sum of powers of two |
|
staticprotected |
Returns the numbering scheme used in the grid defining the catchments.
in_cfg | Reference to the Config object used in Alpine3D |
|
protectedvirtual |
Returns the grids corresponding to the additional meteo variables which have to be averaged over the subcatchments and written in the output files.
[out] | grids | vector containing the meteo grids |
|
staticprotected |
This method returns the meteo variables which have to be averaged over the subwatershed areas and written in the output files on top of runoff.
cfg | Reference to the Config object holding the simulation parameters |
std::string Runoff::getGridsRequirements | ( | ) | const |
|
staticprotected |
Returns a IOManager object which will write the runoff grids in the correct output folder.
cfg | Config object used in Alpine3D |
outputGrids | should the runoff grids be written out? |
|
staticprotected |
Returns whether the glaciers are dynamic, i.e. whether the glacier mask should be expected to change from one time step to the other.
cfg | Reference to the Config object holding the simulation parameters |
|
staticprotected |
Returns the cell size which must be used to resample both the catchment masks and the runoff grids.
in_dem | reference to the Config object used in Alpine3D |
catchmentGrid | grid defining the catchments |
|
staticprotected |
Computes the grid used to correct the runoff values for slope (Alpine3D assumes the cells to be flat, the predicted runoffs therefore have to be corrected for terrain inclination)
dem | Reference to the DEM object used by Alpine3D |
double Runoff::getTiming | ( | ) | const |
bool Runoff::initialize | ( | const mio::DEMObject & | in_dem, |
const mio::Config & | cfg | ||
) |
|
protectedvirtual |
Initializes the SMET files in which the per-catchment-aggregated runoff values will be written.
dem | Reference to the DEM object |
|
staticprotected |
Returns whether the first input is a multiple of the second one.
|
virtual |
Writes the results for a specific day.
[in] | i_date | the date at which the results should be written |
[in] | psum | grid of precipitation in mm/h |
[in] | ta | grid of air temperature |
io_in | External IOManager that can be used to write all outputs into the same file (if GRID2DFILE=RUNOFF_GRID2DFILE) |
void Runoff::output | ( | const mio::Date & | i_date | ) |
Writes the Results for a specific day.
i_date | the Date to write the results |
void Runoff::setRunoff | ( | const mio::Array2D< double > & | , |
const mio::Array2D< double > & | runoff_soil, | ||
const mio::Array2D< double > & | , | ||
const mio::Array2D< double > & | , | ||
const mio::Array2D< double > & | |||
) |
void Runoff::setSnowPack | ( | SnowpackInterface & | sn_interface | ) |
Sets the internal reference to SnowpackInterface object.
sn_interface | Reference to the SnowpackInterface object |
|
staticprotected |
Sums the values of the grid cells which are located over the mask.
grid | grid whose cell values have to be summed |
mask | mask over which the grid cell values have to be summed |
|
protectedvirtual |
Updates protected attribute glacier_mask.
|
protectedvirtual |
Writes the runoff values aggregated over a given catchment in the corresponding SMET file.
catchId | catchment id number |
currTime | time corresponding to the runoff values |
totalRunoff | total runoff (corrected for slope) over the catchment, in mm/h |
precipRunoff | part of the total runoff attributable to liquid precipitation, in mm/h |
snowRunoff | part of the total runoff attributable to snow melt, in mm/h |
glacierRunoff | part of the total runoff attributable to glacier melt, in mm/h |
meteoVars | additional meteorological variables averaged over the catchment area. The units of each variable correspond to those used in Alpine3D or Snowpack. |
|
protectedvirtual |
Updates protected attribute total_runoff.
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
staticprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Reference to SnowpackInterface object, used for callbacks, initialized during construction.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |