module gwseries

This module contains the base object GwSeries for maintaining a groundwater series

Examples

gw = GwSeries.from_dinogws(<filepath to dinocsv file>) gw = GwSeries.from_json(<filepath to acequia json file>)

class acequia.gwseries.GwSeries(heads=None, locprops=None, tubeprops=None)

Groundwater heads time series management

from_dinogws(filepath)

read heads series from dinoloket csv file

from_json(filepath)

read heads series from json file

to_json(filepath)

read heads series from json file

to_csv(filepath)

read heads series from json file

heads(ref,freq)

return timeseries with measured heads

name()

return heads series name

locprops(minimal)

return location properties, optional minimal=True

tubeprops(last)

return tube properties, optinal only last row (last=True)

stats(ref)

return descriptice statistics

describe()

return selection of properties and descriptive statistics

gxg()

return tabel with gxg (desciptive statistics for groundwater series used in the Netherlands)

Examples

To create a GwSeries object from file: >>>gw = GwSeries.from_dinogws(<filepath to dinocsv file>) >>>gw = GwSeries.from_json(<filepath to acequia json file>)

To get GwSeries properties: >>>GwSeries.heads() >>>GwSeries.locprops() >>>GwSeries.name() >>>GwSeries.heads1428()

To export GwSeries data: >>>GwSeries.to_csv(<filename>) >>>GwSeries.To_json(<filename>)

Notes

Head measurements are stored in meters relatieve to welltopStores and served in several units: mwelltop,mref,msurfacelevel.

Valid row names for locprops and column names for tubeprops are stored in class variables locprops_names and tubeprops_names: >>> print(acequia.GwSeries.locprops_names) >>> print(acequia.GwSeries.tubeprops_names)

classmethod from_dinogws(filepath)

Read tno dinoloket csvfile with groundwater measurements and return data as gwseries object

Parameters

filepath (str) – path to dinocsv file with measured groundwater heads

Returns

result

Return type

GwSeries object

Example

gw = GwSeries.from_dinogws(<filepath>) jsondict = gw.to_json(<filepath>) gw.from_json(<filepath>)

classmethod from_json(filepath=None)

Read gwseries object from json file

to_json(dirpath=None)
Create json string from GwWeries object and optionally

write to file

Parameters

dirpath (str) – directory json file will be written to (if dirpath is not given no textfile will be written and only OrderedDict with valid JSON wil be retruned)

Returns

Return type

OrderedDict with valid json

Note

If no value for dirpath is given, a valid json string is returned. If a value for dirpath is given, nothing is returned and a json file will be written to a file with the series name in dirpath.

to_csv(path=None, ref=None)

Export groundwater heads series to simple csv file

Parameters

path (str) – csv file wil be exported to path, if path is a directory, series will be saved as <path><name>.csv. if path is not given, file is saved in present directory.

Examples

Save heads to simple csv: >>>aq.GwSeries.to_csv(<dirpath>) Read back with standard Pandas: >>>pd.read_csv(<filepath>, parse_dates=[‘date’],

index_col=’date’, squeeze=True)

name()

Return groundwater series name

locname()

Return series location name

locprops(minimal=False)

return location properties as pd.DataFrame

Parameters

minimal (bool, default=False) – return only minimal selection of columns

Returns

Return type

pd.DataFrame

tubeprops(last=False, minimal=False)

Return tube properties

Parameters
  • last (booean, default False) – retun only the last row of tube properties without date

  • minimal (bool, default False) – return only minimal selection of columns

Returns

Return type

pd.DataFrame

surface()

Return last known surface level

heads(ref='datum', freq=None)

Return groundwater head measurements

Parameters
  • ref ({'mp','datum','surface'}, default 'datum') – choosen reference for groundwater heads

  • freq (None or any valid Pandas Offset Alias) – determine frequency of time series

Returns

result

Return type

pandas time Series

Notes

Parameter ‘ref’ determines the reference level for the heads: ‘mp’ : elative to well top (‘measurement point’) ‘datum’: relative to chosen level (would be meter +NAP for the

Netherlands, or TAW for Belgium)

‘surface’ : relative to surface level (meter min maaiveld)

Parameter ‘freq’ determines the time series frequency by setting the Pandas Offset Alias. When ‘freq’ is None, no resampling is applied. Logical values for ‘freq’ would be: ‘H’ : hourly frequency ‘D’ : calender day frequency ‘W’ : weekly frequency ‘M’ : month end frequency ‘MS’: month start freuency ‘Q’ : quarter end frequency ‘QS’: quarter start frequency ‘A’ : year end frequency ‘AS’: year start frequency

timestats(ref=None)

Return descriptice statistics

Parameters

ref ({'mp','datum','surface'}, default 'datum') – choosen reference level for groundwater heads

Returns

Return type

pd.DataFrame

describe(ref=None, gxg=False)

Return selection of properties and descriptive statistics

Parameters
  • ref ({'mp','datum','surface'}, default 'datum') – choosen reference level for groundwater heads

  • gxg (bool, default False) – add GxG descriptive statistics

Returns

Return type

pd.DataFrame

tubeprops_changes(proptype='mplevel')

Return timeseries with tubeprops changes

Parameters

proptype (['mplevel','surfacelevel','filtop','filbot') – tubeproperty that is shown in reference cange graph

Returns

Return type

pd.Series

plotheads(proptype=None, filename=None)

Plot groundwater heads time series

Parameters

proptype (['mplevel','surfacelevel','filtop','filbot') – tubeproperty that is shown in reference cange graph if not given, no reference plot will be shown

gxg(ref=None)

Return table with Gxg desciptive statistics