pywrdrb.pre.PredictedDiversionPreprocessor#
- class pywrdrb.pre.PredictedDiversionPreprocessor(start_date=None, end_date=None, modes=('regression_disagg',), use_log=True, remove_zeros=False, use_const=False)#
Predicts catchment inflows at Montague and Trenton using specified modes (e.g., regression, perfect foresight, moving average).
- load()#
Load NJ diversions and catchment water consumption data.
- process()#
Run the full prediction workflow.
- save()#
Save predicted diversion time series to pywrdrb/data/diversions.
- get_prediction_node_lag_combinations()#
Return dictionary of predicted diversion column names and their defining (node, lag, mode) tuples.
- input_dirs#
Input files used for prediction.
- Type:
dict
- output_dirs#
Output locations for predicted timeseries.
- Type:
dict
- timeseries_data#
DataFrame containing the timeseries data. Is None until load() is called.
- Type:
DataFrame
- predicted_timeseries#
DataFrame containing the predicted timeseries. Is None until process() is called.
- Type:
DataFrame
- catchment_wc#
DataFrame containing the average water consumption data for node catchments.
- Type:
DataFrame
Example usage: ```python from pywrdrb.pre import PredictedDiversionPreprocessor diversion_predictor = PredictedDiversionPreprocessor(
start_date=”1983-10-01”, end_date=”2016-12-31”, modes=(“regression_disagg”,),
) diversion_predictor.process() diversion_predictor.save() ```
- __init__(start_date=None, end_date=None, modes=('regression_disagg',), use_log=True, remove_zeros=False, use_const=False)#
Initialize the PredictedDiversionPreprocessor.
- Parameters:
start_date (str, None) – Start date for the time series. If None, match the input data.
end_date (str, None) – End date for the time series. If None, match the input data.
modes (tuple) – Modes to use for prediction. Default is (‘regression_disagg’,). Options include: “regression_disagg”, “perfect_foresight”, “moving_average”, “same_day”.
use_log (bool) – Whether to use log transformation for model vars. Default is True.
remove_zeros (bool) – Whether to remove zero values. Default is False.
use_const (bool) – Whether to use a constant/intercept in regression. Default is False.
- Return type:
None
Methods
__init__
([start_date, end_date, modes, ...])Initialize the PredictedDiversionPreprocessor.
Return dict of predicted diversion column names formatted as (node, lag, mode) tuples.
load
()Load NJ diversions and catchment WC data (used for structural compatibility).
make_predictions
(regressions)Generate lead-time predictions using the timeseries data and trained models.
process
()Run full prediction workflow.
save
()Save predicted diversion time series to CSV.
train_regressions
()Train the AR models for different node, lag combinations.