gridmarthe.reset_geometry

gridmarthe.reset_geometry(ds, path_to_permh, variable='permeab', fillna=False)[source]

Reset a Marthe grid geometry based on permh dataset

This function is useful/used, to reconstruct the geometry of the dataset (if NaN were dropped for example), before writting marthe grid, where the full domain is needed (including non active cells).

Parameters:
dsxarray.Dataset
path_to_permhstr

path to the .permh file containing domain

variablestr

variable (ds key) containing data

fillnabool (optional)

to fillna WITH permh nan value. permh nan value are used because it can contain different nan values (0 and -9999 for nested grids) for simplier nan fills, this can be performed outside of this function.

Returns:
xr.Dataset

dataset containing original variables and geometry read from permh file

Notes

Join is performed with xy[z] (if xy are present in coords) or zone to get zone back in full domain (if dropped, or nan were dropped, etc.).

If nan were dropped during gridmarthe.load_marthe_grid(), ‘zone_all’ was added and will be used (this variable store the zone index before the reindexing during gridmarthe.dropna()).