imod.evaluate.calculate_gxg(head: xarray.core.dataarray.DataArray, below_surfacelevel: bool = False, tolerance: pandas._libs.tslibs.timedeltas.Timedelta = Timedelta('7 days 00:00:00')) xarray.core.dataarray.DataArray[source]#

Calculate GxG groundwater characteristics from head time series.

GLG and GHG (average lowest and average highest groundwater level respectively) are calculated as the average of the three lowest (GLG) or highest (GHG) head values per Dutch hydrological year (april - april), for head values measured at a semi-monthly frequency (14th and 28th of every month). GVG (average spring groundwater level) is calculated as the average of groundwater level on 14th and 28th of March, and 14th of April. Supplied head values are resampled (nearest) to the 14/28 frequency.

Hydrological years without all 24 14/28 dates present are discarded for glg and ghg. Years without the 3 dates for gvg are discarded.

  • head (xr.DataArray of floats) – Head relative to sea level, in m, or m below surface level if below_surfacelevel is set to True. Must be of dimensions ("time", "y", "x").

  • below_surfacelevel (boolean, optional, default: False.) – False (default) if heads are relative to a datum (e.g. sea level). If True, heads are taken as m below surface level.

  • tolerance (pd.Timedelta, default: 7 days.) – Maximum time window allowed when searching for dates around the 14th and 28th of every month.


gxg – Dataset containing glg: average lowest head, ghg: average highest head, gvg: average spring head, n_years_gvg: numbers of years used for gvg, n_years_gxg: numbers of years used for glg and ghg.

Return type



Load the heads, and calculate groundwater characteristics after the year 2000:

>>> import imod
>>> heads ="head*.idf").sel(time=heads.time.dt.year >= 2000)
>>> gxg = imod.evaluate.calculate_gxg(heads)

Transform to meters below surface level by substracting from surface level:

>>> surflevel ="surfacelevel.idf")
>>> gxg = surflevel - gxg

Or calculate from groundwater level relative to surface level directly:

>>> gwl = surflevel - heads
>>> gxg = imod.evaluate.calculate_gxg(gwl, below_surfacelevel=True)