plans.datasets.chrono#
Classes for handling chronological (time series) datasets.
Classes
|
A class for representing and working with discharge time series data (volumentric flow). |
|
A class for representing and working with ET data. |
|
A class for representing and working with PET data. |
|
A class for representing and working with rainfall time series data. |
|
|
|
A class for representing and working with river stage time series data. |
|
|
|
A class for representing and working with streamflow data (specific flow). |
|
A class for representing and working with temperature time series data. |
|
|
|
- class plans.datasets.chrono.WaterBalanceSeries(name='MyWaterBalanceSeries', alias=None)[source]#
Bases:
TimeSeries
- class plans.datasets.chrono.RainSeries(name='MyRainSeries', alias=None)[source]#
Bases:
WaterBalanceSeriesA class for representing and working with rainfall time series data.
Notes
todo notes
Examples
todo examples
- interpolate_gaps(inplace=False, method=None)[source]#
Fills gaps in a time series using various interpolation methods.
- Parameters:
method (str) – Specifies the interpolation method. The default value is
linear.constant (float) – The constant value used when the
constantmethod is selected. Default value = 0.inplace (bool) – If True, modifies the original DataFrame in-place. Default value = False.
- Returns:
A new
pandas.DataFramewith interpolated values and anis_interpolationflag column (1 where the value was filled by interpolation, 0 where it was already present) if inplace is False, otherwise None.- Return type:
pandas.DataFrameor None
Notes
This function handles time series data, standardizing it if necessary before performing interpolation. The process is applied to each unique epoch within the series.
linear: linear interpolationnearest: uses the value of the closest data point.zero: fills gaps with zeros.constant: fills gaps with a constant value provided in method parameterslinear: first order spline interpolationquadratic: second order spline interpolationcubic: third order spline interpolation
- _set_frequency()[source]#
Infer the datetime frequency of the time series from the spacing between consecutive timestamps.
The mode (most common value) of consecutive timestamp deltas is used to determine the frequency, rather than checking which calendar components (seconds, minutes, hours, …) vary across the series. This makes detection robust to a small minority of jittered or missing timestamps: as long as the majority of gaps between consecutive records share the same spacing, that spacing wins, even if a few records are irregular.
Sets
self.dtfreqto one of the supported Pandas-like frequency aliases ("1min","20min","h","D","MS","YS") based on which boundary the modal delta falls into, andself.dtresto the corresponding resolution label ("second","minute","hour","day","month","year").For
"MS"and"YS"frequencies,self.gapsizeis also forced to1, since a single missing month or year is already a meaningful gap at that resolution.Note
Detection is based on the majority delta, not a strict consistency check. If irregular spacing accounts for more than half of the deltas in the series, the detected frequency will reflect that majority rather than the “intended” sampling rate. Always sanity-check
self.dtfreqafter loading unfamiliar or untrusted data.- Returns:
None. Updates
self.dtfreq,self.dtres, and possiblyself.gapsizein place.- Return type:
None
- class plans.datasets.chrono.StreamflowSeries(name='MyStreaFlowSeries', alias=None)[source]#
Bases:
WaterBalanceSeriesA class for representing and working with streamflow data (specific flow).
Notes
todo notes
Examples
todo examples
- class plans.datasets.chrono.ETSeries(name='MyETSeries', alias=None)[source]#
Bases:
WaterBalanceSeriesA class for representing and working with ET data.
Notes
todo notes
Examples
todo examples
- class plans.datasets.chrono.PETSeries(name='MyPETSeries', alias=None)[source]#
Bases:
WaterBalanceSeriesA class for representing and working with PET data.
Notes
todo notes
Examples
todo examples
- class plans.datasets.chrono.TemperatureSeries(name='MyTemperatureSeries', alias=None)[source]#
Bases:
TimeSeriesA class for representing and working with temperature time series data.
Notes
todo notes
Examples
todo examples
- class plans.datasets.chrono.StageSeries(name='MyStageSeries', alias=None)[source]#
Bases:
TimeSeriesA class for representing and working with river stage time series data.
Notes
todo notes
Examples
todo examples
- class plans.datasets.chrono.DischargeSeries(name='MyFlowSeries', alias=None)[source]#
Bases:
TimeSeriesA class for representing and working with discharge time series data (volumentric flow).
Notes
todo notes
Examples
todo examples
- class plans.datasets.chrono.RainSeriesSamples(name='MyRSColection')[source]#
Bases:
TimeSeriesSpatialSamples
- class plans.datasets.chrono.TemperatureSeriesSamples(name='MyTempSColection')[source]#
Bases:
TimeSeriesSpatialSamples
- class plans.datasets.chrono.StageSeriesCollection(name='MySSColection')[source]#
Bases:
TimeSeriesCluster- __init__(name='MySSColection')[source]#
Initialize the
Collectionobject.- Parameters:
base_object (
MbaE) –MbaE-based object for collectionname (str) – unique object name
alias (str) – unique object alias.
- set_data(df_info, src_dir=None, filter_dates=None)[source]#
Set data for the time series collection from a info class:pandas.DataFrame.
- Parameters:
df_info (class:pandas.DataFrame) – This DataFrame is expected to have matching fields to the metadata keys.
src_dir (str) – Path for inputs directory in the case for only file names in
Filecolumn.filter_dates (str) – List of Start and End dates for filter data
Notes
The
set_datamethod populates the time series collection with data based on the provided DataFrame.It creates time series objects, loads data, and performs additional processing steps.
Adjust
skip_processaccording to your data processing needs.