From 04853cf50cc2f645f27728279ac4905b9f10d821 Mon Sep 17 00:00:00 2001 From: Matt Williamson <87771120+mattw-nws@users.noreply.github.com> Date: Thu, 21 Sep 2023 15:29:17 +0000 Subject: [PATCH] Cleanup from review feedback --- include/forcing/NullForcingProvider.hpp | 74 ++----------------- .../catchment/Formulation_Constructors.hpp | 2 +- 2 files changed, 6 insertions(+), 70 deletions(-) diff --git a/include/forcing/NullForcingProvider.hpp b/include/forcing/NullForcingProvider.hpp index 91f524e1be..185392684c 100644 --- a/include/forcing/NullForcingProvider.hpp +++ b/include/forcing/NullForcingProvider.hpp @@ -3,83 +3,37 @@ #include #include -#include -#include -#include -#include "AorcForcing.hpp" +#include +#include #include "GenericDataProvider.hpp" -#include "DataProviderSelectors.hpp" -#include /** - * @brief Forcing class providing time-series precipiation forcing data to the model. + * @brief Forcing class that returns no variables to the simulation--use this e.g. if a BMI model provides forcing data. */ class NullForcingProvider : public data_access::GenericDataProvider { public: - NullForcingProvider(forcing_params forcing_config):start_date_time_epoch(forcing_config.simulation_start_t), - end_date_time_epoch(forcing_config.simulation_end_t), - current_date_time_epoch(forcing_config.simulation_start_t), - forcing_vector_index(-1) - {} + NullForcingProvider(){} // BEGIN DataProvider interface methods - /** - * @brief the inclusive beginning of the period of time over which this instance can provide data for this forcing. - * - * @return The inclusive beginning of the period of time over which this instance can provide this data. - */ long get_data_start_time() override { - //FIXME: Trace this back and you will find that it is the simulation start time, not having anything to do with the forcing at all. - // Apparently this "worked", but at a minimum the description above is false. - //return start_date_time_epoch; - // LONG_MIN is a large negative number, so we return 0 as the starting time return 0; } - /** - * @brief the exclusive ending of the period of time over which this instance can provide data for this forcing. - * - * @return The exclusive ending of the period of time over which this instance can provide this data. - */ long get_data_stop_time() override { - //return end_date_time_epoch; return LONG_MAX; } - /** - * @brief the duration of one record of this forcing source - * - * @return The duration of one record of this forcing source - */ long record_duration() override { return 1; } - /** - * Get the index of the forcing time step that contains the given point in time. - * - * An @ref std::out_of_range exception should be thrown if the time is not in any time step. - * - * @param epoch_time The point in time, as a seconds-based epoch time. - * @return The index of the forcing time step that contains the given point in time. - * @throws std::out_of_range If the given point is not in any time step. - */ size_t get_ts_index_for_time(const time_t &epoch_time) override { return 0; } - /** - * Get the value of a forcing property for an arbitrary time period, converting units if needed. - * - * An @ref std::out_of_range exception should be thrown if the data for the time period is not available. - * - * @param selector Object storing information about the data to be queried - * @param m methode to resample data if needed - * @throws std::runtime_error as this provider does not provide forcing value/values - */ double get_value(const CatchmentAggrDataSelector& selector, data_access::ReSampleMethod m) override { throw std::runtime_error("Called get_value function in NullDataProvider"); @@ -90,19 +44,6 @@ class NullForcingProvider : public data_access::GenericDataProvider throw std::runtime_error("Called get_values function in NullDataProvider"); } - /** - * 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. - * - * @param name The name of the forcing property for which the current value is desired. - * @return Whether the property's value is an aggregate sum. - */ - //TODO this one used in Bmi_Module_Formulation.hpp and Bmi_Multi_Formulation.hpp inline bool is_property_sum_over_time_step(const std::string& name) override { throw std::runtime_error("Got request for variable " + name + " but no such variable is provided by NullForcingProvider." + SOURCE_LOC); } @@ -112,14 +53,9 @@ class NullForcingProvider : public data_access::GenericDataProvider } private: - + std::vector available_forcings; - int forcing_vector_index; - - time_t start_date_time_epoch; - time_t end_date_time_epoch; - time_t current_date_time_epoch; }; #endif // NGEN_NULLFORCING_H diff --git a/include/realizations/catchment/Formulation_Constructors.hpp b/include/realizations/catchment/Formulation_Constructors.hpp index 7e6d46ea36..a5cf348f04 100644 --- a/include/realizations/catchment/Formulation_Constructors.hpp +++ b/include/realizations/catchment/Formulation_Constructors.hpp @@ -66,7 +66,7 @@ namespace realization { } #endif else if (forcing_config.provider == "NullForcingProvider"){ - fp = std::make_shared(forcing_config); + fp = std::make_shared(); } else { // Some unknown string in the provider field? throw std::runtime_error(