plans.hydrology.core#
{Short module description (1-3 sentences)} todo docstring
Features#
todo docstring
{feature 1}
{feature 2}
{feature 3}
{etc}
Overview#
todo docstring {Overview description}
Examples#
todo docstring {Examples in rST}
Print a message
# print message
print("Hello world!")
# [Output] >> 'Hello world!'
Functions
|
|
|
Classes
|
The core |
- class plans.hydrology.core.Model(name='MyModel', alias='HM01')[source]#
Bases:
DataSet
The core
Model
base object. Expected to hold onepandas.DataFrame
as simulation data and a dictionary as parameters. This is a dummy class to be developed downstream.- __init__(name='MyModel', alias='HM01')[source]#
Initialize the
DataSet
object.- Parameters:
name (str) – unique object name
alias (str) – unique object alias. If None, it takes the first and last characters from name
- _set_model_params()[source]#
Internal method for setting up model parameters data
- Returns:
None
- Return type:
None
- _set_view_specs()[source]#
Set view specifications. Expected to increment superior methods.
- Returns:
None
- Return type:
None
- get_metadata()[source]#
Get a dictionary with object metadata. Expected to increment superior methods.
Note
Metadata does not necessarily inclue all object attributes.
- Returns:
dictionary with all metadata
- Return type:
dict
- setter(dict_setter)[source]#
Set selected attributes based on an incoming dictionary. This is calling the superior method using load_data=False.
- Parameters:
dict_setter (dict) – incoming dictionary with attribute values
- Returns:
None
- Return type:
None
- update()[source]#
Refresh all mutable attributes based on data (includins paths). Base method. This is overwrinting the superior method.
- Returns:
None
- Return type:
None
- update_dt()[source]#
Update Time Step value, units and tag to match the model reference time parameter (like k)
- Returns:
None
- Return type:
None
- load_data()[source]#
Load simulation data. Expected to overwrite superior methods.
- Returns:
None
- Return type:
None
- setup()[source]#
Set model simulation. Expected to be incremented downstream.
Warning
This method overwrites model data.
- Returns:
None
- Return type:
None
- solve()[source]#
Solve the model for boundary and initial conditions by numerical methods.
Warning
This method overwrites model data.
- Returns:
None
- Return type:
None
- run(setup_model=True)[source]#
Simulate model (full procedure).
- Parameters:
setup_model (bool) – flag for setting up data (default=True)
- Returns:
None
- Return type:
None
- export(folder, filename)[source]#
Export object resources
- Parameters:
folder (str) – path to folder
filename (str) – file name without extension
- Returns:
None
- Return type:
None
- save(folder)[source]#
Save to sourced files is not allowed for Model() family. Use .export() instead. This is overwriting superior methods.
- Returns:
None
- Return type:
None
- view(show=True)[source]#
Get the basic visualization.
- Parameters:
show (bool) – option for showing instead of saving.
Note
Uses values in the
view_specs()
attribute for plotting.
- static get_timestep_factor(from_unit: str, to_unit: str) float [source]#
Calculates the conversion factor between two time units.
For instance, to find out how many days are in a given number of ‘10min’ intervals, this function provides the multiplier.
- Parameters:
from_unit (str) – The starting time unit (e.g., ‘10min’, ’15s’).
to_unit (str) – The desired time unit (e.g., ‘days’, ‘min’).
- Returns:
The factor to convert from the starting to the desired time unit.
- Return type:
float
- static get_timestep_series(start_time: str, end_time: str, time_unit: str) pandas.DatetimeIndex [source]#
Generates a time series of timestamps.
Creates a sequence of timestamps between a start and end time, with a specified frequency.
- Parameters:
start_time (str) – The starting timestamp for the series (e.g., ‘2024-01-01’, ‘2024-01-01 00:00:00’).
end_time (str) – The ending timestamp for the series (e.g., ‘2024-01-10’, ‘2024-01-10 23:59:59’).
time_unit (str) – The frequency or interval between timestamps (e.g., ‘D’ for day, ‘H’ for hour, ‘10min’).
- Returns:
A pandas DatetimeIndex representing the generated time series.
- Return type:
pd.DatetimeIndex
- static get_gaussian_signal(value_max, size, sigma=50, position_factor=5, reverse=False)[source]#
Generates a vector of normally (gaussian) distributed values. Useful for testing inputs inflows.
- Parameters:
value_max (float) – actual maximum value in the vector
size (int) – size of vector (time series size)
sigma (float) – standard deviation for gaussian (normal) distribution.
position_factor (float) – where to place the peak in the vector
reverse (bool) – boolean to reverse position in order
- Returns:
vector of values
- Return type:
Numpy array