NGen
|
Forcing class providing time-series precipiation forcing data to the model. More...
#include <CsvPerFeatureForcingProvider.hpp>
Public Types | |
typedef struct tm | time_type |
using | data_type = DataType |
This class provides a generic interface to data services. | |
using | selection_type = SelectionType |
Public Member Functions | |
CsvPerFeatureForcingProvider (forcing_params forcing_config) | |
long | get_data_start_time () const override |
the inclusive beginning of the period of time over which this instance can provide data for this forcing. | |
long | get_data_stop_time () const override |
the exclusive ending of the period of time over which this instance can provide data for this forcing. | |
long | record_duration () const override |
the duration of one record of this forcing source | |
size_t | get_ts_index_for_time (const time_t &epoch_time) const override |
Get the index of the forcing time step that contains the given point in time. | |
double | get_value (const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override |
Get the value of a forcing property for an arbitrary time period, converting units if needed. | |
virtual std::vector< double > | get_values (const CatchmentAggrDataSelector &selector, data_access::ReSampleMethod m) override |
bool | is_param_sum_over_time_step (const std::string &name) const |
Get whether a param's value is an aggregate sum over the entire time step. | |
bool | is_property_sum_over_time_step (const std::string &name) const override |
Get whether a property's per-time-step values are each an aggregate sum over the entire time step. | |
boost::span< const std::string > | get_available_variable_names () const override |
Return the variables that are accessable by this data provider. | |
virtual void | finalize () |
Release any resources that should not be held as the run is shutting down. | |
virtual data_type | get_value (const selection_type &selector, ReSampleMethod m=SUM)=0 |
Get the value of a forcing property for an arbitrary time period, converting units if needed. | |
virtual std::vector< data_type > | get_values (const selection_type &selector, ReSampleMethod m=SUM)=0 |
Get the values of a forcing property for an arbitrary time period, converting units if needed. | |
Private Member Functions | |
void | check_forcing_vector_index_bounds () |
Checks forcing vector index bounds and adjusts index if out of vector bounds ///. | |
double | get_value_for_param_name (const std::string &name, int index) |
Get the current value of a forcing param identified by its name. | |
void | read_csv (std::string file_name) |
Read Forcing Data from CSV Reads only data within the specified model start and end date-times. | |
Private Attributes | |
std::vector< std::string > | available_forcings |
std::unordered_map< std::string, std::string > | available_forcings_units |
std::unordered_map< std::string, std::vector< double > > | forcing_vectors |
std::vector< time_t > | time_epoch_vector |
int | forcing_vector_index |
double | precipitation_rate_meters_per_second |
double | air_temperature_fahrenheit |
double | latitude |
double | longitude |
int | catchment_id |
int | day_of_year |
std::string | forcing_file_name |
time_t | start_date_time_epoch |
time_t | end_date_time_epoch |
time_t | current_date_time_epoch |
Forcing class providing time-series precipiation forcing data to the model.
|
inherited |
This class provides a generic interface to data services.
|
inherited |
struct tm CsvPerFeatureForcingProvider::time_type |
|
inline |
References forcing_params::path, and read_csv().
|
inlineprivate |
Checks forcing vector index bounds and adjusts index if out of vector bounds ///.
References forcing_vector_index, and time_epoch_vector.
|
inlinevirtualinherited |
Release any resources that should not be held as the run is shutting down.
In particular, this should be called before MPI_Finalize()
Reimplemented in data_access::WrappedDataProvider.
|
inlineoverridevirtual |
Return the variables that are accessable by this data provider.
Implements data_access::DataProvider< DataType, SelectionType >.
References available_forcings.
|
inlineoverridevirtual |
the inclusive beginning of the period of time over which this instance can provide data for this forcing.
Implements data_access::DataProvider< DataType, SelectionType >.
References start_date_time_epoch.
|
inlineoverridevirtual |
the exclusive ending of the period of time over which this instance can provide data for this forcing.
Implements data_access::DataProvider< DataType, SelectionType >.
References end_date_time_epoch.
|
inlineoverridevirtual |
Get the index of the forcing time step that contains the given point in time.
An std::out_of_range exception should be thrown if the time is not in any time step.
epoch_time | The point in time, as a seconds-based epoch time. |
std::out_of_range | If the given point is not in any time step. |
Implements data_access::DataProvider< DataType, SelectionType >.
References end_date_time_epoch, and start_date_time_epoch.
Referenced by get_value().
|
inlineoverride |
Get the value of a forcing property for an arbitrary time period, converting units if needed.
An std::out_of_range exception should be thrown if the data for the time period is not available.
selector | Object storing information about the data to be queried |
m | methode to resample data if needed |
std::out_of_range | If data for the time period is not available. |
References available_forcings_units, UnitsHelper::get_converted_value(), CatchmentAggrDataSelector::get_duration_secs(), CatchmentAggrDataSelector::get_init_time(), CatchmentAggrDataSelector::get_output_units(), get_ts_index_for_time(), get_value_for_param_name(), CatchmentAggrDataSelector::get_variable_name(), is_param_sum_over_time_step(), start_date_time_epoch, and time_epoch_vector.
Referenced by get_values().
|
pure virtualinherited |
Get the value of a forcing property for an arbitrary time period, converting units if needed.
An std::out_of_range exception should be thrown if the data for the time period is not available.
selector | Data required to establish what subset of the stored data should be accessed |
m | How data is to be resampled if there is a mismatch in data alignment or repeat rate |
std::out_of_range | If data for the time period is not available. |
Referenced by data_access::WrappedDataProvider::get_value(), and realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update().
|
inlineprivate |
Get the current value of a forcing param identified by its name.
name | The name of the forcing param for which the current value is desired. |
index | The index of the desired forcing time step from which to obtain the value. |
References forcing_vectors, time_epoch_vector, and data_access::WellKnownFields.
Referenced by get_value().
|
inlineoverridevirtual |
References get_value().
|
pure virtualinherited |
Get the values of a forcing property for an arbitrary time period, converting units if needed.
An std::out_of_range exception should be thrown if the data for the time period is not available.
If a provider doesn't implement this function, then by default, get_values will be a simple proxy to get_value with the result wrapped in a std::vector<double>
output_name | The name of the forcing property of interest. |
init_time_epoch | The epoch time (in seconds) of the start of the time period. |
duration_seconds | The length of the time period, in seconds. |
output_units | The expected units of the desired output value. |
std::out_of_range | If data for the time period is not available. |
Referenced by data_access::WrappedDataProvider::get_values(), and realization::Bmi_Module_Formulation::set_model_inputs_prior_to_update().
|
inline |
Get whether a param's value is an aggregate sum over the entire time step.
Certain params, like rain fall, are aggregated sums over an entire time step. Others, such as pressure, are not such sums and instead something else like an instantaneous reading or an average value over the time step.
It may be the case that forcing data is needed for some discretization different than the forcing time step. These values can be calculated (or at least approximated), but doing so requires knowing which values are summed versus not.
name | The name of the forcing param for which the current value is desired. |
Referenced by get_value(), and is_property_sum_over_time_step().
|
inlineoverridevirtual |
Get whether a property's per-time-step values are each an aggregate sum over the entire time step.
Certain properties, like rain fall, are aggregated sums over an entire time step. Others, such as pressure, are not such sums and instead something else like an instantaneous reading or an average value.
It may be the case that forcing data is needed for some discretization different than the forcing time step. This aspect must be known in such cases to perform the appropriate value interpolation.
name | The name of the forcing property for which the current value is desired. |
Reimplemented from data_access::DataProvider< DataType, SelectionType >.
References is_param_sum_over_time_step().
|
inlineprivate |
Read Forcing Data from CSV Reads only data within the specified model start and end date-times.
file_name | Forcing file name |
References available_forcings, available_forcings_units, end_date_time_epoch, forcing_vectors, CSVReader::getData(), start_date_time_epoch, time_epoch_vector, and data_access::WellKnownFields.
Referenced by CsvPerFeatureForcingProvider().
|
inlineoverridevirtual |
the duration of one record of this forcing source
Implements data_access::DataProvider< DataType, SelectionType >.
References time_epoch_vector.
|
private |
|
private |
Referenced by get_available_variable_names(), and read_csv().
|
private |
Referenced by get_value(), and read_csv().
|
private |
|
private |
|
private |
|
private |
Referenced by get_data_stop_time(), get_ts_index_for_time(), and read_csv().
|
private |
|
private |
Referenced by check_forcing_vector_index_bounds().
|
private |
Referenced by get_value_for_param_name(), and read_csv().
|
private |
|
private |
|
private |
|
private |
Referenced by get_data_start_time(), get_ts_index_for_time(), get_value(), and read_csv().
|
private |
Referenced by check_forcing_vector_index_bounds(), get_value(), get_value_for_param_name(), read_csv(), and record_duration().