pywrdrb.pre.PredictedDiversionPreprocessor#
- class pywrdrb.pre.PredictedDiversionPreprocessor(flow_type=None, start_date=None, end_date=None, modes=('regression_disagg',), use_log=True, remove_zeros=False, use_const=False)#
Predicts NJ diversions from the Delaware-Raritan Canal using regression models. (e.g., regression, perfect foresight, moving average).
Examples
>>> 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__(flow_type=None, 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__([flow_type, start_date, end_date, ...])Initialize the PredictedDiversionPreprocessor.
get_prediction_node_lag_combinations()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.