pymarthe.mpump

Contains the MarthePump class (Subclass of MartheModel) for handling pumping conditions by locations.

Attributes

encoding

Classes

MarthePump

Class for handling Marthe pumping data.

Module Contents

pymarthe.mpump.encoding = 'latin-1'
class pymarthe.mpump.MarthePump(mm, pastp_file=None, mode='aquifer', verbose=False)

Class for handling Marthe pumping data.

_verbose()

Perform some classic checks about pumping data validity and print bad behaviour as warnings

  • Search for pumpings in inactive cells ()

  • Search for multiple pumping on same cell

_extract_data(mode)

Extract pumping data from .past file according to the pumping mode. Wrapper to marthe_utils.extract_pastp_pumping()

Parameters:

mode (str)pumping mode.

Can be ‘aquifer’ or ‘river’.

Returns:

Set pumping data and meta data inplace (as attribute)

Examples:

mp._extract_data()

get_data(istep=None, node=None, layer=None, i=None, j=None, boundname=None, force=False, as_mask=False)

Function to select/subset pumping data.

Parameters:

istep (int, optional)required timestep id(s).

If None, all timesteps wil be considered. Default is None.

node (int, optional)cell id(s).

Must be 0 < node < nnodes. If None, all cells will be considered. Default is None.

layer (int, optional)required layer id(s).

If None, all layers will be considered. Default is None.

i (int, optional)required row id(s).

If None, all rows will be considered. Default is None.

j (int, optional)required column id(s).

If None, all columns will be considered. Default is None.

boundname (str, optional)required well name(s).

If None, all boundnames will be considered. Default is None.

force (bool, optional)force getting pumping data for all required timesteps

even if there are not provided explicitly in the pastp file. For a not provided required time step the nearest previous istep (npi) containing pumping data will be considered. Note: can be slow if the model contains a lot of timesteps.

as_mask (bool)returning data as boolean index.

Default is False.

Returns:

df (np.recarray) : subset DataFrame Note: if all arguments are set to None,

all data is returned.

Examples:

df1 = mp.get_data(istep=[3,6,9,14], boundname = [‘p1’,’p2’]) df2 = mp.get_data(layer=2, i=33, j=18)

set_data_from_parfile(parfile, keys, value_col, btrans)
set_data(value, istep=None, node=None, layer=None, i=None, j=None, boundname=None)

Function to set pumping data inplace.

Parameters:

value (int/float) : pumping rate value to set. node (int, optional) : cell id(s).

Must be 0 < node < nnodes. If None, all cells will be considered.

istep (int, optional)number(s) of timestep required.

If None, all timesteps are considered. Default is None.

layer (int, optional)number(s) of layer required.

If None, all layers are considered. Default is None.

i (int, optional)number(s) of line required.

If None, all lines are considered. Default is None.

j (int, optional)number(s) of column required.

If None, all columns are considered. Default is None.

boundname (str, optional)name(s) required pumping point.

If None, all boundnames are considered. Default is None.

Returns:

Set pumping rate value inplace.

Examples:

mp.set_data(value = -44,67, istep=0, boundname = [‘p1’,’p2’]) mp.set_data(value = -189,4, layer=2, i=33, j=18)

get_boundnames(istep=None, layer=None, i=None, j=None)

Function to get boundname on subset data.

Parameters:

istep (int, optional)number(s) of timestep required.

If None, all timesteps are considered. Default is None.

layer (int, optional)number(s) of layer required.

If None, all layers are considered. Default is None.

i (int, optional)number(s) of line required.

If None, all lines are considered. Default is None.

j (int, optional)number(s) of column required.

If None, all columns are considered. Default is None.

Returns:

boundnames (list) : available boundnames of selected data.

Examples:

steady_bdnmes = mp.get_boundnames(istep=0) bdnmes_l2 = mp.get_boundnames(layer=2)

switch_boundnames(switch_dic)

Function to change boundname of a pumping point by another.

Parameters:

switch_dic (dict)boundnames to switch

Format : {bdnme_source: bdnme_target, …}

Returns:

Replace new boundname inplace.

Examples:

mp.switch_boundnames(switch_dic = {‘B1951752/F1’: ‘F1’})

split_qtype(qtype=None)

Function to split pumping data into pandas Dataframe(s) according to the provided qtype (‘mail’, ‘record’ ,’listm’)

Parameters:

qtype (str/iterable)type of pumping data to return

Can be (list) ‘mail’, ‘record’, ‘listm’ or None. If None, all qtypes are provided Dataframe. Default is None.

Returns:

[mail_df, record_df, listm_df] (list) : if qtype is None mail_df or record_df or listm_df (Dataframe) : is qtype is provided

Examples:

mail_df = mp.split_qtype(‘mail’)[0]

_write_mail()

Function to write pumping data (as ‘mail’ qtype) inplace.

Parameters:

self (MarthePump) : instance.

Returns:

Write ‘mail’ pumping data in parent model .pastp file.

Examples:

mm.prop[‘aqpump’]._write_mail()

_write_record()

Function to write pumping data (as ‘record’ qtype) inplace.

Parameters:

self (MarthePump) : instance.

Returns:

Write ‘record’ pumping data in parent model .pastp file (steady-state data) and external file (transient data).

Examples:

mm.prop[‘aqpump’]._write_record()

_write_listm()

Function to write pumping data (as ‘listm’ qtype) inplace.

Parameters:

self (MarthePump) : instance.

Returns:

Write ‘listm’ pumping data in external file.

Examples:

mm.prop[‘aqpump’]._write_listm()

write_data()

Function to write pumping data inplace. (All qtypes are considered).

Parameters:

self : MarthePump instance

Returns:

Write data inplace. (record files, listm files, pastp file)

Examples:

mp.set_data(value = 3, istep=[3,5]) mp.write_data()

__str__()

Internal string method.