chump.objects.dataobjects.mfbin

read MODFLOW binary output file (head, drawdown or concentration)

source

set the file path of the file

model

set the model object

Example:

>>> model = {mf='gwf'}
a_scale

apply scaling value a_scale to all values.

a_offset

apply offset value a_offset to all values.

limits

drop values not in limits.

Example:

>>> limits = [1000, 5000]
abslimits

drop the absolute values not in abslimits.

Example:

>>> abslimits = [1, 1e10]
minlayer

Filter data with layers larger than or euqal to minlayer.

maxlayer

Filter data with layers smaller than or euqal to maxlayer.

mintime

Filter data with time larger than or euqal to mintime.

maxtime

Filter data with time smaller than or euqal to maxtime.

lfunc

apply a function over the layers.

Example:

>>> lfunc = 'max'
calculate the maximum values over the layers
tfunc

apply a function over time.

Example:

>>> tfunc = 'mean'
calculate the mean values over time
resample

resample data to other time frequency. see https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.resample.html.

Example:

>>> resample = {rule='7D', func='mean'}
add

add values of another object.

Example:

>>> add = {other={csv='obslevel'}, fill_value=0}
subtract

subtract values of another object.

Example:

>>> subtract = {other={csv='obslevel'}, fill_value=0}
mul

multiply values of another object.

Example:

>>> mul = {other={csv='obslevel'}, fill_value=1}
div

divide values of another object.

Example:

>>> div = {other={csv='obslevel'}, fill_value=1}
calculate

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.

extfunc

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:]
t_scale

set a scaling factor, default is 1.0. final time values = original time values * t_scale + t_offset

Example:

>>> t_scale = 86400 # convert days to seconds
t_offset

set a time offset, default is 0.0. final time values = original time values * t_scale + t_offset

Example:

>>> t_offset = -365 # move time ahead by one year
plottype

plotting type of the grid data, must be 'contour', 'grid', 'cgrid', 'colorgrid', 'colormesh' or 'colorflood'.

plotarg

plotting argument for the object

norm

the color scale used for color grid, either 'Normalize' or 'LogNorm', default is 'Normalize' which is linear scale color map.

legend

whether to plot the legend of this object, default is false.

Example:

>>> legend = true
colorbararg

the color bar argument for color grid plot.

Example:

>>> colorbararg = {shrink=0.88, pad=0.01, label='Simulated groundwater elevation (feet)'}
clabelarg

the contour label argument for contour plot.

Example:

>>> clabel = {}
levels

levels used for contour plots.

Example:

>>> levels = [0,1,2,5,10,20,50,100,200,300,500]
dlevel

level intervel for contour plots.

Example:

>>> dlevel = 10
label

set data label/name used in legend.

writedata

set writedata to true to export the data. The data will saved as a CSV or SHP file.

writeshp

if true, write shapefile of the object.

Example:

>>> writeshp = true
writefunc

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]))