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

Note

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_grid_marthe(), ‘zone_all’ was added and will be used (this variable store the zone index before the reindexing during gridmarthe.dropna()).

Parameters:
  • ds (xr.Dataset)

  • path_to_permh (str) – path to the .permh file containing domain

  • variable (str) – variable (ds key) containing data

  • fillna (bool (Optionnal)) – 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 containing original variables and geometry read from permh file