Skip to content

Commit

Permalink
Updates in response to code review.
Browse files Browse the repository at this point in the history
  • Loading branch information
donaldwj committed Apr 12, 2022
1 parent 5637e22 commit 638e908
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion include/forcing/CsvPerFeatureForcingProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class CsvPerFeatureForcingProvider : public data_access::GenericDataProvider
* @return The duration of time over which this instance can provide this data.
*/
long record_duration() override {
return end_date_time_epoch - start_date_time_epoch;
return time_epoch_vector[1] - time_epoch_vector[0];
}

/**
Expand Down
2 changes: 2 additions & 0 deletions include/forcing/Forcing.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ class Forcing : public data_access::GenericDataProvider
*
* @return The inclusive beginning of the period of time over which this instance can provide this data.
*/
[[deprecated]]
time_t get_forcing_output_time_begin(const std::string &output_name) {
return start_date_time_epoch;
}
Expand All @@ -191,6 +192,7 @@ class Forcing : public data_access::GenericDataProvider
*
* @return The exclusive ending of the period of time over which this instance can provide this data.
*/
[[deprecated]]
time_t get_forcing_output_time_end(const std::string &output_name) {
return end_date_time_epoch;
}
Expand Down
12 changes: 4 additions & 8 deletions include/forcing/NetCDFPerFeatureDataProvider.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,7 @@ namespace data_access
auto num_ids = id_dim.getSize();

// allocate an array of character pointers
std::vector< char* > string_buffers;

// resize to match dimension size
string_buffers.resize(num_ids);
std::vector< char* > string_buffers(num_ids);

// read the id strings
ids.getVar(&string_buffers[0]);
Expand All @@ -91,8 +88,7 @@ namespace data_access
auto num_times = nc_file->getDim("time").getSize();

// allocate storage for the raw time array
std::vector<double> raw_time;
raw_time.resize(num_times);
std::vector<double> raw_time(num_times);

// get the time variable
auto time_var = nc_file->getVar("Time");
Expand Down Expand Up @@ -130,7 +126,7 @@ namespace data_access
time_unit = TIME_HOURS;
time_scale_factor = 3600;
}
else if ( time_unit_str == "m" || time_unit_str == "minuets" )
else if ( time_unit_str == "m" || time_unit_str == "minutes" )
{
time_unit = TIME_MINUETS;
time_scale_factor = 60;
Expand All @@ -140,7 +136,7 @@ namespace data_access
time_unit = TIME_SECONDS;
time_scale_factor = 1;
}
else if ( time_unit_str == "ms" || time_unit_str == "miliseconds" )
else if ( time_unit_str == "ms" || time_unit_str == "milliseconds" )
{
time_unit = TIME_MILLISECONDS;
time_scale_factor = .001;
Expand Down

0 comments on commit 638e908

Please sign in to comment.