Data related classes, e.g., DataCenter. More...
Classes | |
class | ItpWeightData |
Read weight data of each observe stations from database. More... | |
class | clsReach |
Class to store reach related parameters from REACHES table. More... | |
class | clsReaches |
Read and store all reaches information as input parameters. More... | |
class | clsSimpleTxtData< T > |
read string line from text file More... | |
class | Subbasin |
Subbasin related parameters and methods. More... | |
class | clsSubbasins |
Manager all Subbasin related parameters and methods. More... | |
class | DataCenter |
Base class of Data center for SEIMS. More... | |
class | DataCenterMongoDB |
Class of Data center inherited from DataCenter based on MongoDB. More... | |
class | InputStation |
HydroClimate sites information. More... | |
class | Measurement |
Get HydroClimate measurement data from MongoDB. More... | |
class | NotRegularMeasurement |
Not Regular hydroclimate data. More... | |
class | ParamInfo< T > |
Class to store and manage parameter information from the parameter database. More... | |
class | RegularMeasurement |
Regular hydroclimate data, e.g., daily data. More... | |
class | Settings |
Base class for input or output Settings. More... | |
class | SettingsInput |
Input settings for SEIMS. More... | |
struct | OrgOutItem |
Original output item. More... | |
class | SettingsOutput |
Setting outputs. More... | |
Data related classes, e.g., DataCenter.
class ItpWeightData |
Read weight data of each observe stations from database.
Public Member Functions | |
ItpWeightData (MongoGridFs *gfs, const string &filename) | |
Overload constructor. More... | |
~ItpWeightData () | |
Destructor. | |
void | GetWeightData2D (int *n, int *n_stations, FLTPT ***data) |
Get the weight data read from mongoDB in form of 2DArray. More... | |
void | Dump (std::ostream *fs) |
Output the weight data to ostream. | |
void | Dump (const string &filename) |
Output the weight data to file. More... | |
bool | Initialized () |
Initialized successful? | |
ItpWeightData::ItpWeightData | ( | MongoGridFs * | gfs, |
const string & | filename | ||
) |
Overload constructor.
[in] | gfs | MongoGridFs |
[in] | filename | file name |
void ItpWeightData::Dump | ( | const string & | filename | ) |
void ItpWeightData::GetWeightData2D | ( | int * | n, |
int * | n_stations, | ||
FLTPT *** | data | ||
) |
Get the weight data read from mongoDB in form of 2DArray.
[out] | n | Rows |
[out] | n_stations | Cols |
[out] | data | data |
class clsReach |
Class to store reach related parameters from REACHES table.
Public Member Functions | |
clsReach (const bson_t *&bson_table) | |
Constructor. | |
~clsReach () | |
Destructor. | |
FLTPT | Get (const string &key) |
Get parameters by name. | |
int | GetGroupIndex (const string &method, int size) |
Get group index. | |
void | Set (const string &key, FLTPT value) |
Set parameters by name. | |
void | SetPositions (IntRaster *mask_raster) |
Set positions according to MASK data. | |
void | DerivedParameters () |
Calculate derived parameters after updating the input parameters. | |
class clsReaches |
Read and store all reaches information as input parameters.
Public Member Functions | |
clsReaches (MongoClient *conn, const string &db_name, const string &collection_name, LayeringMethod mtd=UP_DOWN) | |
Constructor, query reach table from MongoDB. More... | |
~clsReaches () | |
Destructor. | |
clsReach * | GetReachByID (int id) |
Get single reach information by subbasin ID (1 ~ N) | |
int | GetReachNumber () const |
Get reach number. | |
void | GetReachesSingleProperty (const string &key, FLTPT **data) |
Get 1D array of reach property. More... | |
vector< vector< int > > & | GetUpStreamIDs () |
Get upstream IDs. | |
map< int, int > & | GetDownStreamID () |
Get downstream ID. | |
map< int, vector< int > > & | GetReachLayers () |
Get map of reach layers. | |
void | Update (map< string, ParamInfo< FLTPT > * > &caliparams_map, IntRaster *mask_raster) |
Update reach/channel parameters according to calibration settings. | |
clsReaches::clsReaches | ( | MongoClient * | conn, |
const string & | db_name, | ||
const string & | collection_name, | ||
LayeringMethod | mtd = UP_DOWN |
||
) |
Constructor, query reach table from MongoDB.
[in] | conn | MongoClient instance |
[in] | db_name | Database name |
[in] | collection_name | Reach collection name |
[in] | mtd | layering method, the default is UP_DOWN, |
void clsReaches::GetReachesSingleProperty | ( | const string & | key, |
FLTPT ** | data | ||
) |
Get 1D array of reach property.
[in] | key | Parameter name |
[out] | data | 1D array with length of N+1, the first element is Reach number. |
class clsSimpleTxtData |
read string line from text file
class Subbasin |
Subbasin related parameters and methods.
Changelog:
Public Member Functions | |
Subbasin (int id) | |
Constructor. More... | |
~Subbasin () | |
Destructor. | |
bool | CheckInputSize (int n) |
Check input size. | |
void | SetCellList (int n_cells, int *cells) |
Set cell index list, as well as subbasin area. | |
void | SetArea (const FLTPT area) |
area of subbasin | |
void | SetSlope (const FLTPT slp) |
average slope (%) | |
void | SetSlope (FLTPT *slope) |
Set slope of current subbasin as the average of all cells. | |
void | SetSlopeCoefofBasin (const FLTPT slope_basin) |
Set slope correction factor of current subbasin. | |
void | SetPet (const FLTPT pet) |
pet | |
void | SetPerco (const FLTPT perco) |
Set average percolation (mm) | |
void | SetPerde (const FLTPT perde) |
Set average deep percolation (mm) | |
void | SetEg (const FLTPT eg) |
groundwater revaporization | |
void | SetGw (const FLTPT gw) |
Set groundwater storage. | |
void | SetQg (const FLTPT qg) |
Set groundwater discharge. | |
void | SetRg (const FLTPT rg) |
Set groundwater runoff. | |
void | SetIsRevapChanged (const bool isrevap) |
Is revap changed. | |
int | GetId () |
Get subbasin ID. | |
int | GetCellCount () |
Get valid cells number. | |
int * | GetCells () |
Get index of valid cells. | |
bool | GetIsOutput () |
Get the output flag (true mean output), the function will be deprecated. By LJ. | |
FLTPT | GetArea () |
area of subbasin | |
bool | GetIsRevapChanged () |
Get the Revap change flat (true mean changed from last time step) | |
FLTPT | GetPet () |
Get average PET. | |
FLTPT | GetPerco () |
Get average percolation (mm) | |
FLTPT | GetPerde () |
Get average deep percolation (mm) | |
FLTPT | GetSlope () |
Get average slope (%) | |
FLTPT | GetSlopeCoef () |
Get slope coefficient of basin. | |
FLTPT | GetEg () |
groundwater revaporization | |
FLTPT | GetGw () |
Get groundwater storage. | |
FLTPT | GetQg () |
Get groundwater discharge. | |
FLTPT | GetRg () |
Get groundwater runoff. | |
|
explicit |
Constructor.
[in] | id | Subbasin ID |
class clsSubbasins |
Manager all Subbasin related parameters and methods.
Public Member Functions | |
clsSubbasins (map< string, IntRaster * > &rs_int_map, map< string, FloatRaster * > &rs_map, int prefix_id) | |
Constructor. More... | |
~clsSubbasins () | |
Destructor. | |
Subbasin * | GetSubbasinByID (const int id) |
Get single reach information by subbasin ID. | |
int | GetSubbasinNumber () |
Get subbasin number. | |
vector< int > & | GetSubbasinIDs () |
Get subbasin IDs. | |
map< int, Subbasin * > & | GetSubbasinObjects () |
Get map of subbasin objects. | |
void | SetSlopeCoefficient (FLTPT *rs_slope) |
Set slope coefficient for each subbasin according to the basin slope. More... | |
FLTPT | Subbasin2Basin (const string &key) |
Get basin (watershed) scale variable (key) value. More... | |
Static Public Member Functions | |
static clsSubbasins * | Init (map< string, IntRaster * > &rs_int_map, map< string, FloatRaster * > &rs_map, int prefix_id) |
Check input parameters to ensure the successful constructor. | |
clsSubbasins::clsSubbasins | ( | map< string, IntRaster * > & | rs_int_map, |
map< string, FloatRaster * > & | rs_map, | ||
int | prefix_id | ||
) |
Constructor.
Query and constructor basic subbasin's information from MongoDB
[in] | rs_map | Map of rasters that have been loaded |
[in] | rs_int_map | Map of integer rasters that have been loaded |
[in] | prefix_id | subbasin ID as prefix in MongoDB |
void clsSubbasins::SetSlopeCoefficient | ( | FLTPT * | rs_slope | ) |
Set slope coefficient for each subbasin according to the basin slope.
seims_mpi/CalculateProcess.cpp/line 77~
. In the future, we should think of an elegant way to deal with this issue. By lj. 06/28/18 FLTPT clsSubbasins::Subbasin2Basin | ( | const string & | key | ) |
Get basin (watershed) scale variable (key) value.
[in] | key | Variable name which is defined in text.h |
class DataCenter |
Base class of Data center for SEIMS.
Public Member Functions | |
DataCenter (InputArgs *input_args, ModuleFactory *factory, int subbasin_id=0) | |
Constructor. More... | |
~DataCenter () | |
Destructor. | |
virtual bool | CheckModelPreparedData ()=0 |
Make sure all the required data are presented. | |
virtual void | ReadClimateSiteList ()=0 |
Read climate site data. | |
virtual bool | ReadParametersInDB ()=0 |
Read initial and calibrated parameters. More... | |
virtual int | ReadIntParameterInDB (const char *param_name)=0 |
Get subbasin number and outlet ID. | |
void | DumpCaliParametersInDB () |
Output calibrated parameters to txt file. | |
virtual bool | ReadRasterData (const string &remote_filename, FloatRaster *&flt_rst)=0 |
Read raster data, both 1D and 2D, and insert to m_rsMap. More... | |
virtual bool | ReadRasterData (const string &remote_filename, IntRaster *&int_rst)=0 |
Read raster data, both 1D and 2D, and insert to m_rsMap. More... | |
virtual void | ReadItpWeightData (const string &remote_filename, int &num, int &stations, FLTPT **&data)=0 |
Read interpolated weight data and insert to m_weightDataMap. More... | |
virtual void | Read1DArrayData (const string &remote_filename, int &num, FLTPT *&data)=0 |
Read 1D array data. More... | |
virtual void | Read1DArrayData (const string &remote_filename, int &num, int *&data)=0 |
Read 1D integer array data. More... | |
virtual void | Read2DArrayData (const string &remote_filename, int &rows, int &cols, FLTPT **&data)=0 |
Read 2D array data and insert to array2d_map_. More... | |
virtual void | ReadIuhData (const string &remote_filename, int &n, FLTPT **&data)=0 |
Read IUH data and insert to m_2DArrayMap. More... | |
virtual void | SetLapseData (const string &remote_filename, int &rows, int &cols, FLTPT **&data) |
Make lapse 2D array data and insert to m_2DArrayMap. More... | |
virtual bool | SetRasterForScenario ()=0 |
Set Raster data for Scenario data. More... | |
bool | CheckAdjustment (const string ¶_name) |
Check out whether the adjustment is needed. More... | |
void | LoadAdjustRasterData (const string ¶_name, const string &remote_filename, bool is_optional=false) |
Read and adjust (if necessary) 1D/2D raster data from Database. More... | |
void | LoadAdjustIntRasterData (const string ¶_name, const string &remote_filename, bool is_optional=false) |
Read and adjust (if necessary) 1D/2D integer raster data from Database. More... | |
void | LoadAdjust1DArrayData (const string ¶_name, const string &remote_filename, bool is_optional=false) |
Read and adjust (if necessary) 1D array data from Database. More... | |
void | LoadAdjust2DArrayData (const string ¶_name, const string &remote_filename) |
Read and adjust (if necessary) 2D array data from Database. More... | |
double | LoadParametersForModules (vector< SimulationModule * > &modules) |
Load data for each module, return time span. | |
void | SetData (SEIMSModuleSetting *setting, ParamInfo< FLTPT > *param, SimulationModule *p_module) |
Set data for modules, include all datatype. | |
void | SetData (SEIMSModuleSetting *setting, ParamInfo< int > *param, SimulationModule *p_module) |
Set integer data for modules, include all datatype. | |
void | SetValue (ParamInfo< FLTPT > *param, SimulationModule *p_module) |
Set single Value. | |
void | SetValue (ParamInfo< int > *param, SimulationModule *p_module) |
Set single integer Value. | |
void | Set1DData (const string ¶_name, const string &remote_filename, SimulationModule *p_module, bool is_optional=false) |
Set 1D Data. | |
void | Set2DData (const string ¶_name, const string &remote_filename, SimulationModule *p_module, bool is_optional=false) |
Set 2D Data. | |
void | SetRaster (const string ¶_name, const string &remote_filename, SimulationModule *p_module, bool is_optional=false) |
Set raster data. | |
void | SetScenario (SimulationModule *p_module, bool is_optional=false) |
Set BMPs Scenario data. | |
void | SetReaches (SimulationModule *p_module) |
Set Reaches information. | |
void | SetSubbasins (SimulationModule *p_module) |
Set Subbasins information. | |
void | UpdateInput (vector< SimulationModule * > &modules, time_t t) |
Update inputs, such climate data. | |
void | UpdateScenarioParametersStable (int subbsn_id) |
Update model parameters (value, 1D raster, and 2D raster, etc.) by Scenario, e.g., areal BMPs. More... | |
virtual bool | GetFileInStringVector () |
Get file.in configuration. | |
virtual bool | GetFileOutVector ()=0 |
Get file.out configuration. | |
void | UpdateOutputDate (time_t start_time, time_t end_time) |
Check date of output settings. | |
Protected Attributes | |
string | model_name_ |
Model name, e.g., model_dianbu30m_longterm. | |
const string | model_path_ |
Model path. | |
string | file_in_file_ |
file.in full path | |
string | file_out_file_ |
file.out full path | |
string | file_cfg_file_ |
config.fig full path | |
const LayeringMethod | lyr_method_ |
Layering method. | |
const FlowDirMethod | fdir_method_ |
Flow direction method. | |
const int | subbasin_id_ |
Subbasin ID. | |
const int | scenario_id_ |
Scenario ID. | |
const int | calibration_id_ |
Calibration ID. | |
const int | mpi_rank_ |
Rank ID for MPI, starts from 0 to mpi_size_ - 1. | |
const int | mpi_size_ |
Rank size for MPI. | |
const int | thread_num_ |
Thread number for OpenMP. | |
bool | use_scenario_ |
Model Scenario. | |
string | output_path_ |
Output path (with / in the end) according to m_outputScene. | |
vector< string > | file_in_strs_ |
file.in configuration | |
vector< OrgOutItem > | origin_out_items_ |
file.out configuration | |
string | model_mode_ |
Storm or Longterm model. | |
int | n_subbasins_ |
Number of subbasins. | |
int | outlet_id_ |
Outlet subbasin ID. | |
ModuleFactory * | factory_ |
Module factory. | |
SettingsInput * | input_ |
The basic input settings. | |
SettingsOutput * | output_ |
The user-defined outputs, Q, SED, etc. | |
InputStation * | clim_station_ |
data of input HydroClimate stations | |
Scenario * | scenario_ |
BMPs Scenario data. | |
clsReaches * | reaches_ |
Reaches information. | |
clsSubbasins * | subbasins_ |
Subbasins information. | |
IntRaster * | mask_raster_ |
Mask data. | |
map< string, FloatRaster * > | rs_map_ |
Map of spatial data, both 1D and 2D. | |
map< string, IntRaster * > | rs_int_map_ |
Map of spatial data with integer, both 1D and 2D. | |
map< string, ParamInfo< FLTPT > * > | init_params_ |
reach depth data,every cell has a depth More... | |
map< string, ParamInfo< int > * > | init_params_int_ |
Store integer parameters from Database (PARAMETERS collection) | |
map< string, FLTPT * > | array1d_map_ |
1D array data map | |
map< string, int > | array1d_len_map_ |
1D array data length map | |
map< string, FLTPT ** > | array2d_map_ |
2D array data map | |
map< string, int > | array2d_rows_map_ |
Row number of 2D array data map. | |
map< string, int > | array2d_cols_map_ |
Col number of 2D array data map CAUTION that nCols may not same for all rows. | |
map< string, int * > | array1d_int_map_ |
1D integer array data map | |
map< string, int > | array1d_int_len_map_ |
1D integer array data length map | |
map< string, int ** > | array2d_int_map_ |
2D integer array data map, e.g. FLOWIN_INDEX, FLOWOUT_INDEX, ROUTING_LAYERS | |
map< string, int > | array2d_int_rows_map_ |
Row number of 2D array data map. | |
map< string, int > | array2d_int_cols_map_ |
Col number of 2D array data map CAUTION that nCols may not same for all rows. | |
DataCenter::DataCenter | ( | InputArgs * | input_args, |
ModuleFactory * | factory, | ||
int | subbasin_id = 0 |
||
) |
Constructor.
[in] | input_args | Input arguments of SEIMS |
[in] | factory | SEIMS modules factory |
[in] | subbasin_id | Subbasin ID, 0 is the default for entire watershed |
bool DataCenter::CheckAdjustment | ( | const string & | para_name | ) |
Check out whether the adjustment is needed.
[in] | para_name | Parameter name which may match one of the parameters in init_params_ . |
void DataCenter::LoadAdjust1DArrayData | ( | const string & | para_name, |
const string & | remote_filename, | ||
bool | is_optional = false |
||
) |
Read and adjust (if necessary) 1D array data from Database.
Currently, there may no parameters are allowed to be adjusted.
[in] | para_name | Parameter name |
[in] | remote_filename | Actual file/data name stored in Database |
[in] | is_optional | Optional parameters won't raise exception when loaded failed |
void DataCenter::LoadAdjust2DArrayData | ( | const string & | para_name, |
const string & | remote_filename | ||
) |
Read and adjust (if necessary) 2D array data from Database.
Currently, there may no parameters are allowed to be adjusted.
[in] | para_name | Parameter name |
[in] | remote_filename | Actual file/data name stored in Database |
void DataCenter::LoadAdjustIntRasterData | ( | const string & | para_name, |
const string & | remote_filename, | ||
bool | is_optional = false |
||
) |
Read and adjust (if necessary) 1D/2D integer raster data from Database.
[in] | para_name | Parameter name, e.g., Landuse |
[in] | remote_filename | Actual file/data name stored in Database, e.g., 0_LANDUSE |
[in] | is_optional | Optional parameters won't raise exception when loaded failed |
void DataCenter::LoadAdjustRasterData | ( | const string & | para_name, |
const string & | remote_filename, | ||
bool | is_optional = false |
||
) |
Read and adjust (if necessary) 1D/2D raster data from Database.
[in] | para_name | Parameter name, e.g., Slope |
[in] | remote_filename | Actual file/data name stored in Database, e.g., 0_SLOPE |
[in] | is_optional | Optional parameters won't raise exception when loaded failed |
|
pure virtual |
Read 1D array data.
[in] | remote_filename | Data file name |
[out] | num | Data length |
[out] | data | returned data |
Implemented in DataCenterMongoDB.
|
pure virtual |
Read 1D integer array data.
[in] | remote_filename | Data file name |
[out] | num | Data length |
[out] | data | returned integer data |
Implemented in DataCenterMongoDB.
|
pure virtual |
Read 2D array data and insert to array2d_map_.
The matrix format is as follows:
5 (Row number)
RowIdx 0 1 2 3 4 (ColIdx)
0 1 9.
1 2 8. 1.
2 2 5. 2.
3 1 2.
4 4 2. 5. 1. 8.
i.e., the first element in each row is the valid number of the current row.
[in] | remote_filename | data file name |
[out] | rows | first dimension of the 2D Array, i.e., Rows |
[out] | cols | second dimension of the 2D Array, i.e., Cols. If each col are different, set cols to 1. |
[out] | data | returned data |
Implemented in DataCenterMongoDB.
|
pure virtual |
Read interpolated weight data and insert to m_weightDataMap.
[in] | remote_filename | Data file name |
[out] | num | Data length |
[out] | stations | Number of stations |
[out] | data | returned data |
Implemented in DataCenterMongoDB.
|
pure virtual |
Read IUH data and insert to m_2DArrayMap.
[in] | remote_filename | data file name |
[out] | n | valid cell number |
[out] | data | returned data |
Implemented in DataCenterMongoDB.
|
pure virtual |
Read initial and calibrated parameters.
Implemented in DataCenterMongoDB.
|
pure virtual |
Read raster data, both 1D and 2D, and insert to m_rsMap.
[in] | remote_filename | Raster file name. |
[in] | flt_rst | Float raster data |
Implemented in DataCenterMongoDB.
|
pure virtual |
Read raster data, both 1D and 2D, and insert to m_rsMap.
[in] | remote_filename | Raster file name. |
[in] | int_rst | Integer raster data |
Implemented in DataCenterMongoDB.
|
virtual |
Make lapse 2D array data and insert to m_2DArrayMap.
[in] | remote_filename | data file name |
[out] | rows | first dimension of the 2D Array, i.e., Rows |
[out] | cols | second dimension of the 2D Array, i.e., Cols |
[out] | data | returned data |
|
pure virtual |
Set Raster data for Scenario data.
Implemented in DataCenterMongoDB.
void DataCenter::UpdateScenarioParametersStable | ( | int | subbsn_id | ) |
Update model parameters (value, 1D raster, and 2D raster, etc.) by Scenario, e.g., areal BMPs.
changelog:
|
protected |
reach depth data,every cell has a depth
Store parameters from Database (PARAMETERS collection)
class DataCenterMongoDB |
Class of Data center inherited from DataCenter based on MongoDB.
Public Member Functions | |
DataCenterMongoDB (InputArgs *input_args, MongoClient *client, MongoGridFs *spatial_gfs_in, MongoGridFs *spatial_gfs_out, ModuleFactory *factory, int subbasin_id=0) | |
Constructor based on MongoDB. More... | |
~DataCenterMongoDB () | |
Destructor. | |
bool | CheckModelPreparedData () OVERRIDE |
Make sure all the required data are presented. | |
bool | GetFileInStringVector () OVERRIDE |
Get file.in configuration from FILE_IN collection. | |
bool | GetFileOutVector () OVERRIDE |
Get file.out configuration. | |
void | ReadClimateSiteList () OVERRIDE |
Read climate site data from HydroClimate database. | |
bool | ReadParametersInDB () OVERRIDE |
Read initial and calibrated parameters. More... | |
int | ReadIntParameterInDB (const char *param_name) OVERRIDE |
Get subbasin number and outlet ID. | |
bool | ReadRasterData (const string &remote_filename, FloatRaster *&flt_rst) OVERRIDE |
Read raster data, both 1D and 2D, and insert to m_rsMap. More... | |
bool | ReadRasterData (const string &remote_filename, IntRaster *&int_rst) OVERRIDE |
Read raster data, both 1D and 2D, and insert to m_rsMap. More... | |
void | ReadItpWeightData (const string &remote_filename, int &num, int &stations, FLTPT **&data) OVERRIDE |
Read interpolated weight data from MongoDB and insert to m_weightDataMap. More... | |
void | Read1DArrayData (const string &remote_filename, int &num, FLTPT *&data) OVERRIDE |
Read 1D array data from MongoDB and insert to m_1DArrayMap CAUTION: Value data type stored in MongoDB MUST be float. More... | |
void | Read1DArrayData (const string &remote_filename, int &num, int *&data) OVERRIDE |
Read 1D integer array data from MongoDB and insert to m_1DArrayMap CAUTION: Value data type stored in MongoDB MUST be float TODO: data stored in MongoDB should have an attribute to indicate data type! More... | |
void | Read2DArrayData (const string &remote_filename, int &rows, int &cols, FLTPT **&data) OVERRIDE |
Read 2D array data from MongoDB database. More... | |
void | ReadIuhData (const string &remote_filename, int &n, FLTPT **&data) OVERRIDE |
Read IUH data from MongoDB and insert to m_2DArrayMap. More... | |
bool | SetRasterForScenario () OVERRIDE |
Set Raster data for Scenario data. More... | |
string | QueryDatabaseName (bson_t *query, const char *tabname) |
Query database name. | |
![]() | |
DataCenter (InputArgs *input_args, ModuleFactory *factory, int subbasin_id=0) | |
Constructor. More... | |
~DataCenter () | |
Destructor. | |
void | DumpCaliParametersInDB () |
Output calibrated parameters to txt file. | |
virtual void | SetLapseData (const string &remote_filename, int &rows, int &cols, FLTPT **&data) |
Make lapse 2D array data and insert to m_2DArrayMap. More... | |
bool | CheckAdjustment (const string ¶_name) |
Check out whether the adjustment is needed. More... | |
void | LoadAdjustRasterData (const string ¶_name, const string &remote_filename, bool is_optional=false) |
Read and adjust (if necessary) 1D/2D raster data from Database. More... | |
void | LoadAdjustIntRasterData (const string ¶_name, const string &remote_filename, bool is_optional=false) |
Read and adjust (if necessary) 1D/2D integer raster data from Database. More... | |
void | LoadAdjust1DArrayData (const string ¶_name, const string &remote_filename, bool is_optional=false) |
Read and adjust (if necessary) 1D array data from Database. More... | |
void | LoadAdjust2DArrayData (const string ¶_name, const string &remote_filename) |
Read and adjust (if necessary) 2D array data from Database. More... | |
double | LoadParametersForModules (vector< SimulationModule * > &modules) |
Load data for each module, return time span. | |
void | SetData (SEIMSModuleSetting *setting, ParamInfo< FLTPT > *param, SimulationModule *p_module) |
Set data for modules, include all datatype. | |
void | SetData (SEIMSModuleSetting *setting, ParamInfo< int > *param, SimulationModule *p_module) |
Set integer data for modules, include all datatype. | |
void | SetValue (ParamInfo< FLTPT > *param, SimulationModule *p_module) |
Set single Value. | |
void | SetValue (ParamInfo< int > *param, SimulationModule *p_module) |
Set single integer Value. | |
void | Set1DData (const string ¶_name, const string &remote_filename, SimulationModule *p_module, bool is_optional=false) |
Set 1D Data. | |
void | Set2DData (const string ¶_name, const string &remote_filename, SimulationModule *p_module, bool is_optional=false) |
Set 2D Data. | |
void | SetRaster (const string ¶_name, const string &remote_filename, SimulationModule *p_module, bool is_optional=false) |
Set raster data. | |
void | SetScenario (SimulationModule *p_module, bool is_optional=false) |
Set BMPs Scenario data. | |
void | SetReaches (SimulationModule *p_module) |
Set Reaches information. | |
void | SetSubbasins (SimulationModule *p_module) |
Set Subbasins information. | |
void | UpdateInput (vector< SimulationModule * > &modules, time_t t) |
Update inputs, such climate data. | |
void | UpdateScenarioParametersStable (int subbsn_id) |
Update model parameters (value, 1D raster, and 2D raster, etc.) by Scenario, e.g., areal BMPs. More... | |
void | UpdateOutputDate (time_t start_time, time_t end_time) |
Check date of output settings. | |
Additional Inherited Members | |
![]() | |
string | model_name_ |
Model name, e.g., model_dianbu30m_longterm. | |
const string | model_path_ |
Model path. | |
string | file_in_file_ |
file.in full path | |
string | file_out_file_ |
file.out full path | |
string | file_cfg_file_ |
config.fig full path | |
const LayeringMethod | lyr_method_ |
Layering method. | |
const FlowDirMethod | fdir_method_ |
Flow direction method. | |
const int | subbasin_id_ |
Subbasin ID. | |
const int | scenario_id_ |
Scenario ID. | |
const int | calibration_id_ |
Calibration ID. | |
const int | mpi_rank_ |
Rank ID for MPI, starts from 0 to mpi_size_ - 1. | |
const int | mpi_size_ |
Rank size for MPI. | |
const int | thread_num_ |
Thread number for OpenMP. | |
bool | use_scenario_ |
Model Scenario. | |
string | output_path_ |
Output path (with / in the end) according to m_outputScene. | |
vector< string > | file_in_strs_ |
file.in configuration | |
vector< OrgOutItem > | origin_out_items_ |
file.out configuration | |
string | model_mode_ |
Storm or Longterm model. | |
int | n_subbasins_ |
Number of subbasins. | |
int | outlet_id_ |
Outlet subbasin ID. | |
ModuleFactory * | factory_ |
Module factory. | |
SettingsInput * | input_ |
The basic input settings. | |
SettingsOutput * | output_ |
The user-defined outputs, Q, SED, etc. | |
InputStation * | clim_station_ |
data of input HydroClimate stations | |
Scenario * | scenario_ |
BMPs Scenario data. | |
clsReaches * | reaches_ |
Reaches information. | |
clsSubbasins * | subbasins_ |
Subbasins information. | |
IntRaster * | mask_raster_ |
Mask data. | |
map< string, FloatRaster * > | rs_map_ |
Map of spatial data, both 1D and 2D. | |
map< string, IntRaster * > | rs_int_map_ |
Map of spatial data with integer, both 1D and 2D. | |
map< string, ParamInfo< FLTPT > * > | init_params_ |
reach depth data,every cell has a depth More... | |
map< string, ParamInfo< int > * > | init_params_int_ |
Store integer parameters from Database (PARAMETERS collection) | |
map< string, FLTPT * > | array1d_map_ |
1D array data map | |
map< string, int > | array1d_len_map_ |
1D array data length map | |
map< string, FLTPT ** > | array2d_map_ |
2D array data map | |
map< string, int > | array2d_rows_map_ |
Row number of 2D array data map. | |
map< string, int > | array2d_cols_map_ |
Col number of 2D array data map CAUTION that nCols may not same for all rows. | |
map< string, int * > | array1d_int_map_ |
1D integer array data map | |
map< string, int > | array1d_int_len_map_ |
1D integer array data length map | |
map< string, int ** > | array2d_int_map_ |
2D integer array data map, e.g. FLOWIN_INDEX, FLOWOUT_INDEX, ROUTING_LAYERS | |
map< string, int > | array2d_int_rows_map_ |
Row number of 2D array data map. | |
map< string, int > | array2d_int_cols_map_ |
Col number of 2D array data map CAUTION that nCols may not same for all rows. | |
DataCenterMongoDB::DataCenterMongoDB | ( | InputArgs * | input_args, |
MongoClient * | client, | ||
MongoGridFs * | spatial_gfs_in, | ||
MongoGridFs * | spatial_gfs_out, | ||
ModuleFactory * | factory, | ||
int | subbasin_id = 0 |
||
) |
Constructor based on MongoDB.
[in] | input_args | Input arguments of SEIMS |
[in] | client | MongoDB connection client |
[in] | spatial_gfs_in | MongoDB GridFS that stores input data |
[in] | spatial_gfs_out | MongoDB GridFS that stores output data |
[in] | factory | SEIMS modules factory |
[in] | subbasin_id | Subbasin ID, 0 is the default for entire watershed |
|
virtual |
Read 1D array data from MongoDB and insert to m_1DArrayMap CAUTION: Value data type stored in MongoDB MUST be float.
[in] | remote_filename | string data file name |
[out] | num | int&, data length |
[out] | data | float*&, returned data |
Implements DataCenter.
|
virtual |
Read 1D integer array data from MongoDB and insert to m_1DArrayMap CAUTION: Value data type stored in MongoDB MUST be float TODO: data stored in MongoDB should have an attribute to indicate data type!
[in] | remote_filename | string data file name |
[out] | num | int&, data length |
[out] | data | int*&, returned data |
Implements DataCenter.
|
virtual |
Read 2D array data from MongoDB database.
[in] | remote_filename | string data file name |
[out] | rows | int&, first dimension of the 2D Array, i.e., Rows |
[out] | cols | int&, second dimension of the 2D Array, i.e., Cols. If each col are different, set cols to 1. |
[out] | data | float**&, returned data |
Implements DataCenter.
|
virtual |
Read interpolated weight data from MongoDB and insert to m_weightDataMap.
[in] | remote_filename | string data file name |
[out] | num | int&, data length |
[out] | stations | int& number of stations |
[out] | data | float*&, returned data |
Implements DataCenter.
|
virtual |
Read IUH data from MongoDB and insert to m_2DArrayMap.
[in] | remote_filename | string data file name |
[out] | n | int&, valid cell number |
[out] | data | float*&, returned data |
Implements DataCenter.
|
virtual |
Read initial and calibrated parameters.
Changlog:
Implements DataCenter.
|
virtual |
Read raster data, both 1D and 2D, and insert to m_rsMap.
[in] | remote_filename | Raster file name. |
[in] | flt_rst | Float raster data |
Implements DataCenter.
|
virtual |
Read raster data, both 1D and 2D, and insert to m_rsMap.
[in] | remote_filename | Raster file name. |
[in] | int_rst | Float raster data |
Implements DataCenter.
|
virtual |
Set Raster data for Scenario data.
Implements DataCenter.
class InputStation |
HydroClimate sites information.
Public Member Functions | |
InputStation (MongoClient *conn, time_t dtHillslope, time_t dtChannel) | |
Constructor. | |
~InputStation () | |
Destructor. | |
bool | NumberOfSites (const char *site_type, int &site_count) |
Get site number of given site type. | |
bool | GetElevation (const char *site_type, FLTPT *&site_elevs) |
Get elevations of given site type. | |
bool | GetLatitude (const char *site_type, FLTPT *&site_lats) |
Get latitudes of given site type. | |
void | GetTimeSeriesData (time_t time, const string &type, int *nRow, FLTPT **data) |
Get time series data. More... | |
void | ReadSitesData (const string &hydroDBName, const string &sitesList, const string &siteType, time_t startDate, time_t endDate, bool stormMode=false) |
Read data of each site type. More... | |
void InputStation::GetTimeSeriesData | ( | time_t | time, |
const string & | type, | ||
int * | nRow, | ||
FLTPT ** | data | ||
) |
Get time series data.
[in] | time | data time |
[in] | type | data type |
[out] | nRow | data item number |
[out] | data | time series data |
void InputStation::ReadSitesData | ( | const string & | hydroDBName, |
const string & | sitesList, | ||
const string & | siteType, | ||
time_t | startDate, | ||
time_t | endDate, | ||
bool | stormMode = false |
||
) |
Read data of each site type.
[in] | hydroDBName | HydroClimate database which contains "DataValues" collection |
[in] | sitesList | string, site ID string derived from model database (e.g., model_dianbu30m_longterm) |
[in] | siteType | site type |
[in] | startDate | start date |
[in] | endDate | end date |
[in] | stormMode | bool, false by default |
class Measurement |
Get HydroClimate measurement data from MongoDB.
Public Member Functions | |
Measurement (MongoClient *conn, const string &hydroDBName, const string &sitesList, const string &siteType, time_t startTime, time_t endTime) | |
Initialize Measurement instance from MongoDB. More... | |
~Measurement () | |
Destructor. | |
virtual FLTPT * | GetSiteDataByTime (time_t t)=0 |
Get site data by time. | |
int | NumberOfSites () const |
Get Number of site. | |
string | Type () const |
Get HydroClimate site type, "M" or "P". | |
time_t | StartTime () const |
start time | |
time_t | EndTime () const |
end time | |
Protected Attributes | |
MongoClient * | m_conn |
MongoDB client object. | |
string | m_hydroDBName |
HydroClimate database name. | |
vector< int > | m_siteIDList |
Site IDs list. | |
string | m_type |
Site type, M means meteorology, and P means precipitation. | |
time_t | m_startTime |
Start time. | |
time_t | m_endTime |
End time. | |
FLTPT * | pData |
Measurement data of all sites in given date. | |
Measurement::Measurement | ( | MongoClient * | conn, |
const string & | hydroDBName, | ||
const string & | sitesList, | ||
const string & | siteType, | ||
time_t | startTime, | ||
time_t | endTime | ||
) |
Initialize Measurement instance from MongoDB.
[in] | conn | MongoClient, MongoDB client |
[in] | hydroDBName | string, HydroClimate database name |
[in] | sitesList | string, sites list |
[in] | siteType | string, sites type |
[in] | startTime | time_t, start date time |
[in] | endTime | time_t, end date time |
class NotRegularMeasurement |
Not Regular hydroclimate data.
Public Member Functions | |
NotRegularMeasurement (MongoClient *conn, const string &hydroDBName, const string &sitesList, const string &siteType, time_t startTime, time_t endTime) | |
Constructor. More... | |
FLTPT * | GetSiteDataByTime (time_t t) OVERRIDE |
Get site date by time pData. | |
![]() | |
Measurement (MongoClient *conn, const string &hydroDBName, const string &sitesList, const string &siteType, time_t startTime, time_t endTime) | |
Initialize Measurement instance from MongoDB. More... | |
~Measurement () | |
Destructor. | |
int | NumberOfSites () const |
Get Number of site. | |
string | Type () const |
Get HydroClimate site type, "M" or "P". | |
time_t | StartTime () const |
start time | |
time_t | EndTime () const |
end time | |
Additional Inherited Members | |
![]() | |
MongoClient * | m_conn |
MongoDB client object. | |
string | m_hydroDBName |
HydroClimate database name. | |
vector< int > | m_siteIDList |
Site IDs list. | |
string | m_type |
Site type, M means meteorology, and P means precipitation. | |
time_t | m_startTime |
Start time. | |
time_t | m_endTime |
End time. | |
FLTPT * | pData |
Measurement data of all sites in given date. | |
NotRegularMeasurement::NotRegularMeasurement | ( | MongoClient * | conn, |
const string & | hydroDBName, | ||
const string & | sitesList, | ||
const string & | siteType, | ||
time_t | startTime, | ||
time_t | endTime | ||
) |
Constructor.
Initialize NotRegular Measurement instance from MongoDB
[in] | conn | MongoClient, MongoDB client |
[in] | hydroDBName | string, HydroClimate database name |
[in] | sitesList | string, site list |
[in] | siteType | string, site type |
[in] | startTime | time_t, start date time |
[in] | endTime | time_t, end date time |
class ParamInfo |
Class to store and manage parameter information from the parameter database.
Public Member Functions | |
ParamInfo () | |
Construct an empty instance. | |
ParamInfo (string &name, string &desc, string &unit, string &mid, T value, string &change, T impact, T maximum, T minimum, bool isint) | |
Construct for initial parameters from DB. | |
ParamInfo (string &name, string &basicname, string &desc, string &unit, string &source, string &mid, dimensionTypes dim, string &climtype, T value=0) | |
Construct for module Parameter. | |
ParamInfo (string &name, string &basicname, string &desc, string &unit, string &source, string &mid, dimensionTypes dim, transferTypes tftype, string &climtype, bool isconst, bool isoutput) | |
Construct for module Input, Output, and InOutput. | |
ParamInfo (const ParamInfo &another) | |
Copy constructor. | |
~ParamInfo () | |
Destructor. | |
T | GetAdjustedValue (T pre_value=NODATA_VALUE) |
Return the adjusted value for this parameter. More... | |
T | GetAdjustedValueWithImpactIndexes (T pre_value, int curImpactIndex) |
Adjust value with indexed impact. More... | |
void | Adjust1DArray (int n, T *data) |
Adjust 1D array. More... | |
void | Adjust1DRaster (int n, T *data) |
Adjust 1D Raster,. More... | |
int | Adjust1DRaster (int n, T *data, const int *units, const vector< int > &selunits, const int *lu, const vector< int > &sellu) |
Adjust 1D Raster on selected area. More... | |
int | Adjust1DRasterWithImpactIndexes (int n, T *data, const int *units, const vector< int > &selunits, const map< int, int > &impactIndexes, const int *lu, const vector< int > &sellu) |
Adjust 1D Raster on selected area, using impact index version. More... | |
void | Adjust2DArray (int n, T **data) |
Adjust 2D array. | |
void | Adjust2DRaster (int n, int lyrs, T **data) |
Adjust 2D Raster. | |
int | Adjust2DRaster (int n, int lyrs, T **data, const int *units, const vector< int > &selunits, const int *lu, const vector< int > &sellu) |
Adjust 1D Raster on selected area. | |
int | Adjust2DRasterWithImpactIndexes (int n, int lyrs, T **data, const int *units, const vector< int > &selunits, const map< int, int > &impactIndexes, const int *lu, const vector< int > &sellu) |
Adjust 2D Raster on selected area, using impact index version. | |
Public Attributes | |
string | Name |
Name. | |
string | BasicName |
Basic name. | |
string | Description |
Description. | |
string | Units |
Units. | |
string | Source |
Source, to identify which the parameters can be derived. | |
string | ModuleID |
Used by Module Ids. | |
dimensionTypes | Dimension |
Data dimension type. | |
transferTypes | Transfer |
Data transfer type. | |
T | Value |
Value. | |
string | Change |
Change type. | |
T | Impact |
Impact value. | |
T | Maximum |
Absolute maximum value. | |
T | Minimum |
Absolute minimum value. | |
bool | IsInteger |
is integer? | |
ParamInfo * | DependPara |
Dependence parameters. | |
string | ClimateType |
Climate type. | |
bool | IsConstant |
Is constant or not. | |
bool | IsOutput |
Is output or not. | |
bool | OutputToOthers |
Is output to other modules or not. | |
bool | initialized |
whether is initialized | |
vector< T > | ImpactSeries |
If the BMP effectiveness is variable, set the values of impacts. | |
void ParamInfo< T >::Adjust1DArray | ( | int | n, |
T * | data | ||
) |
Adjust 1D array.
Do not change NoData value
void ParamInfo< T >::Adjust1DRaster | ( | int | n, |
T * | data | ||
) |
Adjust 1D Raster,.
int ParamInfo< T >::Adjust1DRaster | ( | int | n, |
T * | data, | ||
const int * | units, | ||
const vector< int > & | selunits, | ||
const int * | lu, | ||
const vector< int > & | sellu | ||
) |
Adjust 1D Raster on selected area.
Do not change NoData value
int ParamInfo< T >::Adjust1DRasterWithImpactIndexes | ( | int | n, |
T * | data, | ||
const int * | units, | ||
const vector< int > & | selunits, | ||
const map< int, int > & | impactIndexes, | ||
const int * | lu, | ||
const vector< int > & | sellu | ||
) |
Adjust 1D Raster on selected area, using impact index version.
Do not change NoData value
T ParamInfo< T >::GetAdjustedValue | ( | T | pre_value = NODATA_VALUE | ) |
Return the adjusted value for this parameter.
[in] | pre_value | Default is NODATA_VALUE which will be treated as ParamInfo.Value, otherwise adjust the given value. |
Do not change NoData value
T ParamInfo< T >::GetAdjustedValueWithImpactIndexes | ( | T | pre_value, |
int | curImpactIndex | ||
) |
Adjust value with indexed impact.
Do not change NoData value
class RegularMeasurement |
Regular hydroclimate data, e.g., daily data.
Public Member Functions | |
RegularMeasurement (MongoClient *conn, const string &hydroDBName, const string &sitesList, const string &siteType, time_t startTime, time_t endTime, time_t interval) | |
Initialize NotRegular Measurement instance from MongoDB. More... | |
~RegularMeasurement () | |
Destructor. | |
FLTPT * | GetSiteDataByTime (time_t t) OVERRIDE |
Get site date by time pData. | |
![]() | |
Measurement (MongoClient *conn, const string &hydroDBName, const string &sitesList, const string &siteType, time_t startTime, time_t endTime) | |
Initialize Measurement instance from MongoDB. More... | |
~Measurement () | |
Destructor. | |
int | NumberOfSites () const |
Get Number of site. | |
string | Type () const |
Get HydroClimate site type, "M" or "P". | |
time_t | StartTime () const |
start time | |
time_t | EndTime () const |
end time | |
Additional Inherited Members | |
![]() | |
MongoClient * | m_conn |
MongoDB client object. | |
string | m_hydroDBName |
HydroClimate database name. | |
vector< int > | m_siteIDList |
Site IDs list. | |
string | m_type |
Site type, M means meteorology, and P means precipitation. | |
time_t | m_startTime |
Start time. | |
time_t | m_endTime |
End time. | |
FLTPT * | pData |
Measurement data of all sites in given date. | |
RegularMeasurement::RegularMeasurement | ( | MongoClient * | conn, |
const string & | hydroDBName, | ||
const string & | sitesList, | ||
const string & | siteType, | ||
time_t | startTime, | ||
time_t | endTime, | ||
time_t | interval | ||
) |
Initialize NotRegular Measurement instance from MongoDB.
[in] | conn | MongoClient, MongoDB client |
[in] | hydroDBName | string, HydroClimate database name |
[in] | sitesList | string, site list |
[in] | siteType | string, site type |
[in] | startTime | time_t, start date time |
[in] | endTime | time_t, end date time |
[in] | interval | time_t, time interval |
class Settings |
Base class for input or output Settings.
Public Member Functions | |
Settings () | |
Constructor. | |
Settings (vector< vector< string > > &str2dvec) | |
Constructor via 2D string vector. | |
Settings (vector< string > &str1dvec) | |
Constructor via 1D string vector. | |
virtual void | SetSettingTagStrings (vector< vector< string > > &string2dvector) |
Set Settings vector directly. | |
virtual void | SetSettingTagStrings (vector< string > &stringvector) |
Parse and Set Settings vector by splitting strings. | |
string | GetValue (const string &tag) |
Return the value for the entry with the given tag, "" if not found. | |
virtual void | Dump (const string &filename) |
Output information to plain text file. | |
Public Attributes | |
vector< vector< string > > | m_Settings |
Store setting key and values. | |
class SettingsInput |
Input settings for SEIMS.
Public Member Functions | |
SettingsInput (vector< string > &stringvector) | |
Constructor. | |
void | Dump (const string &filename) OVERRIDE |
Output to log file. | |
time_t | getStartTime () const |
Get start time of simulation. | |
time_t | getEndTime () const |
Get end time of simulation. | |
time_t | getDtHillslope () const |
Get time interval for hillslope scale processes. | |
time_t | getDtChannel () const |
Get time interval for channel scale processes. | |
time_t | getDtDaily () const |
Get daily time interval of simulation in sec. | |
string & | getModelMode () |
Get model mode. | |
bool | isStormMode () const |
is storm model | |
![]() | |
Settings () | |
Constructor. | |
Settings (vector< vector< string > > &str2dvec) | |
Constructor via 2D string vector. | |
Settings (vector< string > &str1dvec) | |
Constructor via 1D string vector. | |
virtual void | SetSettingTagStrings (vector< vector< string > > &string2dvector) |
Set Settings vector directly. | |
virtual void | SetSettingTagStrings (vector< string > &stringvector) |
Parse and Set Settings vector by splitting strings. | |
string | GetValue (const string &tag) |
Return the value for the entry with the given tag, "" if not found. | |
Additional Inherited Members | |
![]() | |
vector< vector< string > > | m_Settings |
Store setting key and values. | |
struct OrgOutItem |
Original output item.
class SettingsOutput |
Setting outputs.
Public Member Functions | |
SettingsOutput (int subbasinNum, int outletID, int subbasinID, vector< OrgOutItem > &outputItems, int scenarioID=0, int calibrationID=-1, int mpi_rank=0, int mpi_size=-1) | |
Constructor. More... | |
~SettingsOutput () | |
Destructor. | |
void | Dump (const string &filename) OVERRIDE |
Write output information to log file. | |
![]() | |
Settings () | |
Constructor. | |
Settings (vector< vector< string > > &str2dvec) | |
Constructor via 2D string vector. | |
Settings (vector< string > &str1dvec) | |
Constructor via 1D string vector. | |
virtual void | SetSettingTagStrings (vector< vector< string > > &string2dvector) |
Set Settings vector directly. | |
virtual void | SetSettingTagStrings (vector< string > &stringvector) |
Parse and Set Settings vector by splitting strings. | |
string | GetValue (const string &tag) |
Return the value for the entry with the given tag, "" if not found. | |
Static Public Member Functions | |
static SettingsOutput * | Init (int subbasinNum, int outletID, int subbasinID, vector< OrgOutItem > &outputItems, int scenarioID=0, int calibrationID=-1, int mpi_rank=0, int mpi_size=-1) |
Init function. | |
Public Attributes | |
vector< PrintInfo * > | m_printInfos |
Check date of output settings. More... | |
map< string, PrintInfo * > | m_printInfosMap |
All the output settings key: OutputID value: PrintInfo instance. More... | |
![]() | |
vector< vector< string > > | m_Settings |
Store setting key and values. | |
SettingsOutput::SettingsOutput | ( | int | subbasinNum, |
int | outletID, | ||
int | subbasinID, | ||
vector< OrgOutItem > & | outputItems, | ||
int | scenarioID = 0 , |
||
int | calibrationID = -1 , |
||
int | mpi_rank = 0 , |
||
int | mpi_size = -1 |
||
) |
Constructor.
[in] | subbasinNum | Subbasin number of the entire watershed |
[in] | outletID | The subbasin ID of outlet |
[in] | subbasinID | Current subbasin ID, 0 for OMP version |
[in] | outputItems | Vector of original output items read from FILE_OUT file (or table) |
[in] | scenarioID | Scenario ID, -1 means no scenario is used, default is 0 |
[in] | calibrationID | Calibration ID, -1 means no calibration from calibration sequence is used |
[in] | mpi_rank | Rank ID for MPI, 0 is the default, also for OMP version |
[in] | mpi_size | Rank size for MPI, -1 is the default for compatible with OMP version |
vector<PrintInfo *> SettingsOutput::m_printInfos |
Check date of output settings.
All the print settings