Utility functions

Miscellaneous utilities

mfobs.utils.fill_nats(df, perioddata)[source]

Fill in NaT (not a time) values with corresponding date for that stress period.

Parameters:
dfDataFrame

Observation data. Must have ‘datetime’ column with date and ‘per’ column with stress period.

perioddataDataFrame

Perioddata table produced by modflow-setup. Must have ‘per’ column and ‘start_datetime’ column.

Returns:
Operates on perioddata in-place.
mfobs.utils.get_input_arguments(kwargs, function, verbose=False, warn=False, exclude=None)[source]

Return subset of keyword arguments in kwargs dict that are valid parameters to a function or method.

Parameters:
kwargsdict (parameter names, values)
functionfunction of class method
warnbool;

If true, print supplied argument that are not in the function’s signature

excludesequence
Returns:
input_kwargsdict
mfobs.utils.print_item(k, v)[source]
mfobs.utils.set_period_start_end_dates(perioddata)[source]

Ensure that the start and end dates for consecutive periods are consistent but don’t overlap. For example given two consecutive periods start dates of 3/1/2020 and 4/1/2020, we want the end dates should be 3/31/2020 and 4/30/2020, so that a selection in pandas with pandas.DataFrame.loc() doesn’t include values from the next period.

Parameters:
perioddataDataFrame

Perioddata table produced by modflow-setup. Must have ‘start_datetime’ and either a ‘time’ column (of elapsed times at the end of each period, in days), or an ‘end_datetime’ column of period end dates.

Returns:
Operates on perioddata in-place.

Notes

Assumes time units of days.