gridmarthe.convert_grid_to_vtk

gridmarthe.convert_grid_to_vtk(grid, varname, time=None, output_tpl='output/gm_vtk')[source]

Convert a gridmarthe grid to a vtk grid.

Parameters:
gridxarray.Dataset

The grid to convert, with variable to export varname In addition, it needs to have all geometry informations/variables. See gridmarthe.grid.processing.geometry.compute_geometry()

varnamestr

name of the variable to export

timestr or datetime, optional

time to export, by default None (all times)

output_tplstr, optional

path/template name of file to write. By default, ‘output/gm_vtk’. Final file names will be {output_tpl}_{varname}.pvd and {output_tpl}_{varname}_{time}.pvu

Returns:
None

Write pvu/pvd files to output directory

Examples

>>> import gridmarthe as gm
>>> model_name = 'hallue_multilayer'
>>> hsubs = gm.load_marthe_grid('./tests/data/{}.hsubs'.format(model_name), xyfactor=1e3)
>>> topo  = gm.load_marthe_grid('./tests/data/{}.topog'.format(model_name), xyfactor=1e3)
>>> permh = gm.load_marthe_grid('./tests/data/{}.permh'.format(model_name), xyfactor=1e3, varname='PERMEAB', drop_nan=True)
>>> geom = gm.compute_geometry(topo, hsubs).sel(zone=permh.zone.values)
>>> convert_grid_to_vtk(geom, 'z', time=0, output_tpl='tests/res/vtk/hallue')