26 #include <meteoio/MeteoIO.h> 85 Runoff(
const mio::Config& in_cfg,
const mio::DEMObject& in_dem,
86 const double& in_thresh_rain);
92 virtual void output(
const mio::Date& i_date,
const mio::Grid2DObject& psum,
93 const mio::Grid2DObject& ta, mio::IOManager& io_in);
129 virtual mio::Grid2DObject
computePrecipRunoff(
const mio::Grid2DObject& psum,
const mio::Grid2DObject& ta)
const;
132 virtual void updateOutputFile(
const size_t& catchId,
const mio::Date& currTime,
133 const double& totalRunoff,
const double& precipRunoff,
134 const double& snowRunoff,
const double& glacierRunoff,
135 const std::vector<double>& meteoVars)
const;
137 static mio::IOManager*
getIOManager(mio::Config in_cfg,
const bool& outputGrids);
142 static double getResamplingCellSize(
const mio::DEMObject& in_dem,
const mio::Grid2DObject& catchments);
143 static bool isMultiple(
const double& a,
const double& b);
146 static void cropMask(mio::Grid2DObject& mask);
147 static double sumOverMask(
const mio::Grid2DObject& grid,
const mio::Grid2DObject& mask);
148 static double averageOverMask(
const mio::Grid2DObject& grid,
const mio::Grid2DObject& mask);
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...
Definition: Runoff.cc:578
virtual ~Runoff()
Destructor of class Runoff.
Definition: Runoff.cc:220
const size_t n_grid_cells
Definition: Runoff.h:110
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 ...
Definition: Runoff.cc:347
static void cropMask(mio::Grid2DObject &mask)
Crops the mask so as to remove as many nodata cells as possible (note: this method possibly changes t...
Definition: Runoff.cc:659
static bool getIsGlacierDynamic(const mio::Config &cfg)
Returns whether the glaciers are dynamic, i.e. whether the glacier mask should be expected to change ...
Definition: Runoff.cc:542
const mio::Grid2DObject slope_correction
Definition: Runoff.h:114
virtual mio::Grid2DObject computePrecipRunoff(const mio::Grid2DObject &psum, const mio::Grid2DObject &ta) const
Computes the grid storing the runoff which originates from liquid precipitation.
Definition: Runoff.cc:313
static double estimateResamplingCellSize(const double &llOffset, const double &currSizeEstimate)
Definition: Runoff.cc:620
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...
Definition: Runoff.cc:500
double getTiming() const
Definition: Runoff.cc:716
static const double MIN_CELL_SIZE
Definition: Runoff.h:123
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.
Definition: Runoff.cc:149
mio::IOManager * io
Definition: Runoff.h:100
const double thresh_rain
Definition: Runoff.h:103
std::string getGridsRequirements() const
Definition: Runoff.cc:127
Definition: SnowpackInterface.h:127
bool is_glacier_mask_set
Definition: Runoff.h:116
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...
Definition: Runoff.cc:472
Runoff(const mio::Config &in_cfg, const mio::DEMObject &in_dem, const double &in_thresh_rain)
Constructor of Runoff instance.
Definition: Runoff.cc:29
unsigned long long longuint
Definition: Runoff.h:30
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 wri...
Definition: Runoff.cc:555
mio::Grid2DObject glacier_mask
Definition: Runoff.h:117
std::map< size_t, mio::Grid2DObject > catchment_masks
Definition: Runoff.h:120
static NumberingType getCatchmentNumberingScheme(const mio::Config &in_cfg)
Returns the numbering scheme used in the grid defining the catchments.
Definition: Runoff.cc:519
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...
Definition: Runoff.cc:436
std::vector< SnGrids::Parameters > extra_meteo_variables
Definition: Runoff.h:118
virtual void constructCatchmentMasks(mio::Grid2DObject catchmentGrid)
Initializes private attribute catchment_masks.
Definition: Runoff.cc:233
static const double DISTANCE_ABSOLUTE_PRECISION
Definition: Runoff.h:124
static bool isMultiple(const double &a, const double &b)
Returns whether the first input is a multiple of the second one.
Definition: Runoff.cc:614
static double sumOverMask(const mio::Grid2DObject &grid, const mio::Grid2DObject &mask)
Sums the values of the grid cells which are located over the mask.
Definition: Runoff.cc:683
std::string catchment_out_path
Definition: Runoff.h:107
bool use_external_iomanager_for_grids
Definition: Runoff.h:121
virtual void updateGlacierMask()
Updates protected attribute glacier_mask.
Definition: Runoff.cc:293
void setSnowPack(SnowpackInterface &sn_interface)
Sets the internal reference to SnowpackInterface object.
Definition: Runoff.cc:137
static std::vector< size_t > factorizeCatchmentNumber(longuint value)
This function splits up a given unsigned int value into a sum of powers of 2.
Definition: Runoff.cc:640
static double averageOverMask(const mio::Grid2DObject &grid, const mio::Grid2DObject &mask)
Averages the values of the grid cells which are located over the mask.
Definition: Runoff.cc:711
SnowpackInterface * snowpack
Reference to SnowpackInterface object, used for callbacks, initialized during construction.
Definition: Runoff.h:101
bool output_grids
Definition: Runoff.h:105
const double tz_out
Definition: Runoff.h:104
enum Runoff::NumberingType catchment_numbering
NumberingType
Definition: Runoff.h:111
mio::Timer timer
Definition: Runoff.h:113
const bool is_glacier_mask_dynamic
Definition: Runoff.h:115
size_t n_extra_meteo_variables
Definition: Runoff.h:119
virtual void updateTotalRunoffGrid()
Updates protected attribute total_runoff.
Definition: Runoff.cc:277
double grid_size_factor
Definition: Runoff.h:109
bool output_sums
Definition: Runoff.h:106
mio::Grid2DObject total_runoff
Definition: Runoff.h:117
virtual void initializeOutputFiles(const mio::Grid2DObject &dem) const
Initializes the SMET files in which the per-catchment-aggregated runoff values will be written...
Definition: Runoff.cc:376
double resampling_cell_size
Definition: Runoff.h:108