chump.objects.dataobjects.tseries
read time series data.
a string or a list of string defining the value columns in the data source.
Example:
>>> valcol = 'Simulated'
>>> valcol = ['Observed', 'Simulated']
set the plotting type of the time series, must be 'bar' or 'line'. Default is 'line'.
Example:
>>> plottype = 'bar'
a dictionary to set additonal plotting arguments for different data columns.
Example:
>>> plotargs = {Observed={color='b'}, Simulated={color='r'}}
a dictionary containing a geospatial data object shp
or CSV
and table
to define the locations of the plotting site/well.
Example:
>>> location = {shp='huc12'}
minimum number of value entry. For sites/wells with observation counts less than this number will be excluded. Default is 0.
Example:
>>> nmin = 5
a list of idcol and valcol names. if set, it stacks the columns in the table . it can be used for MF6 OBS outputs
Example:
>>> stack = ['WellName', 'SimulatedHead']
apply aggregation function based on the site/well id. Default is None.
Example:
>>> aggfunc = 'sum'
resample data to other time frequency. see https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.resample.html.
Example:
>>> resample = {rule='7D', func='mean'}
subtract values of another object.
Example:
>>> subtract = {other={csv='obslevel'}, fill_value=0}
set the object as a result of a mathmatic expression.
The expression will be evaluated by the Python's eval
function.
Examples:
>>> [mfbin.simdiff]
>>> calculate = '(simheadA - simHeadB) - (simheadC - simHeadD)'
where simheadA
, simheadB
, simheadC
and simheadD
are names of other mfbin
objects.
call a function in an external Python script after reading the data.
extfunc
sets the file name of the script.
This script needs to be placed in the working directory.
The function name must be "extfunc" and the first argument is the object.
The dataframe of the object can be accessed through obj.dat
where obj is the argument name in your function.
Example:
>>> # code inside the external script
>>> def extfunc(obj):
>>> # extract results for the final 12 month
>>> obj.dat = obj.dat.iloc[-12:]
call a function in an external Python script to write data.
writefunc
sets the file name of the script.
This script needs to be placed in the working directory.
The function name must be "writefunc" and the first argument is the object.
The dataframe of the object can be accessed through obj.dat
where obj is the argument name in your function.
Example:
>>> # code inside the external script
>>> import numpy as np
>>> def writefunc(obj):
>>> # write head results as arrray
>>> nrow = 50
>>> ncol = 100
>>> for (time,layer), r in obj.dat.iterrows():
>>> np.savetxt(f'time{time}_layer{layer}.dat', r.reshape([nrow, ncol]))