Skip to content

Commit

Permalink
move 'if rfc:' check to happen before any other rfc related operation…
Browse files Browse the repository at this point in the history
…s are done
  • Loading branch information
shorvath-noaa committed Nov 13, 2023
1 parent d013cd3 commit f1fb50d
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions src/troute-network/troute/DataAssimilation.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,22 +541,23 @@ def __init__(self, network, from_files, value_dict):
self._reservoir_rfc_df = pd.DataFrame()
self._reservoir_rfc_param_df = pd.DataFrame()
else:
# In order to use only RFC python module (not fortran module), create rfc dataframes from reading files
#rfc_parameters = self._data_assimilation_parameters.get('reservoir_da', {}).get('reservoir_rfc_da', {})
lookback_hrs = rfc_parameters.get('reservoir_rfc_forecasts_lookback_hours')
offset_hrs = rfc_parameters.get('reservoir_rfc_forecasts_offset_hours')
start_datetime = network.t0
timeseries_end = start_datetime + timedelta(hours=offset_hrs)
timeseries_start = timeseries_end - timedelta(hours=lookback_hrs)
delta = timedelta(hours=1)
timeseries_dates = []
while timeseries_start <= timeseries_end:
timeseries_dates.append(timeseries_start.strftime('%Y-%m-%d_%H'))
timeseries_start += delta
rfc_forecast_persist_days = rfc_parameters.get('reservoir_rfc_forecast_persist_days')
final_persist_datetime = start_datetime + timedelta(days=rfc_forecast_persist_days)
# RFC Observations
if rfc:
# In order to use only RFC python module (not fortran module), create rfc dataframes from reading files
#rfc_parameters = self._data_assimilation_parameters.get('reservoir_da', {}).get('reservoir_rfc_da', {})
lookback_hrs = rfc_parameters.get('reservoir_rfc_forecasts_lookback_hours')
offset_hrs = rfc_parameters.get('reservoir_rfc_forecasts_offset_hours')
start_datetime = network.t0
timeseries_end = start_datetime + timedelta(hours=offset_hrs)
timeseries_start = timeseries_end - timedelta(hours=lookback_hrs)
delta = timedelta(hours=1)
timeseries_dates = []
while timeseries_start <= timeseries_end:
timeseries_dates.append(timeseries_start.strftime('%Y-%m-%d_%H'))
timeseries_start += delta
rfc_forecast_persist_days = rfc_parameters.get('reservoir_rfc_forecast_persist_days')
final_persist_datetime = start_datetime + timedelta(days=rfc_forecast_persist_days)

# RFC Observations
rfc_timeseries_path = str(rfc_parameters.get('reservoir_rfc_forecasts_time_series_path'))
self._rfc_timeseries_df = _read_timeseries_files(rfc_timeseries_path, timeseries_dates, start_datetime, final_persist_datetime)
self._reservoir_rfc_df, self._reservoir_rfc_param_df = assemble_rfc_dataframes(
Expand Down

0 comments on commit f1fb50d

Please sign in to comment.