chump.objects.dataobjects.mfbin
read MODFLOW binary output file (head, drawdown or concentration)
apply a function over the layers.
Example:
>>> lfunc = 'max'
calculate the maximum values over the layers
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:]
plotting type of the grid data, must be 'contour', 'grid', 'cgrid', 'colorgrid', 'colormesh' or 'colorflood'.
the color scale used for color grid, either 'Normalize' or 'LogNorm', default is 'Normalize' which is linear scale color map.
the color bar argument for color grid plot.
Example:
>>> colorbararg = {shrink=0.88, pad=0.01, label='Simulated groundwater elevation (feet)'}
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]))