flopy.export.vtk module¶
-
class
Vtk
(model, verbose=None, nanval=-1e+20, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False)[source]¶ Bases:
object
Class to build VTK object for exporting flopy vtk
Parameters: - model (MFModel) – flopy model instance
- verbose (bool) – If True, stdout is verbose
- nanval (float) – no data value, default is -1e20
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False
-
arrays
¶ Stores data arrays added to VTK object
Type: dict
-
add_array
(name, a, array2d=False)[source]¶ Adds an array to the vtk object.
Parameters: - name (str) – Name of the array.
- a (flopy array) – The array to be added to the vtk object. The shape should match either grid cells or grid vertices.
- array2d (bool) – true if the array is 2d and represents the first layer, default is False
-
add_vector
(name, v, array2d=False)[source]¶ Adds a vector (i.e., a tuple of arrays) to the vtk object.
Parameters: - name (str) – Name of the vector.
- v (tuple of arrays) – The vector to be added to the vtk object. The shape of each component should match either grid cells or grid vertices.
- array2d (bool) – true if the vector components are 2d arrays and represent the first layer, default is False
Notes
If the grid is rotated, the vector will be rotated too, assuming that the first and second components are along x and y directions, respectively.
-
write
(output_file, timeval=None)[source]¶ Writes the stored arrays to vtk file in XML format.
Parameters: - output_file (str) – output file name without extension (extension is determined automatically)
- timeval (scalar) – model time value to be stored in the time section of the vtk file, default is None
-
class
XmlWriterAscii
(file_path)[source]¶ Bases:
flopy.export.vtk.XmlWriterInterface
Helps writing ascii vtk files.
Parameters: file_path (str) – output file path
-
class
XmlWriterBinary
(file_path)[source]¶ Bases:
flopy.export.vtk.XmlWriterInterface
Helps writing binary vtk files.
Parameters: file_path (str) – output file path
-
class
XmlWriterInterface
(file_path)[source]¶ Bases:
object
Helps writing vtk files.
Parameters: file_path (str) – output file path
-
export_array
(model, array, output_folder, name, nanval=-1e+20, array2d=False, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False)[source]¶ Export array to vtk
Parameters: - model (flopy model instance) – the flopy model instance
- array (flopy array) – flopy 2d or 3d array
- output_folder (str) – output folder to write the data
- name (str) – name of array
- nanval (scalar) – no data value, default value is -1e20
- array2d (bool) – true if the array is 2d and represents the first layer, default is False
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False
-
export_cbc
(model, cbcfile, otfolder, precision='single', verbose=False, nanval=-1e+20, kstpkper=None, text=None, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False)[source]¶ Exports cell by cell file to vtk
Parameters: - model (flopy model instance) – the flopy model instance
- cbcfile (str) – the cell by cell file
- otfolder (str) – output folder to write the data
- precision (str) – Precision of data in the cell by cell file: ‘single’ or ‘double’. Default is ‘single’.
- verbose (bool) – If True, write information to the screen. Default is False.
- nanval (scalar) – no data value
- kstpkper (tuple of ints or list of tuple of ints) – A tuple containing the time step and stress period (kstp, kper). The kstp and kper values are zero based.
- text (str or list of str) – The text identifier for the record. Examples include ‘RIVER LEAKAGE’, ‘STORAGE’, ‘FLOW RIGHT FACE’, etc.
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False
-
export_heads
(model, hdsfile, otfolder, text='head', precision='auto', verbose=False, nanval=-1e+20, kstpkper=None, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False)[source]¶ Exports binary head file to vtk
Parameters: - model (MFModel) – the flopy model instance
- hdsfile (str) – binary heads file
- otfolder (str) – output folder to write the data
- text (string) – Name of the text string in the head file. Default is ‘head’.
- precision (str) – Precision of data in the head file: ‘auto’, ‘single’ or ‘double’. Default is ‘auto’.
- verbose (bool) – If True, write information to the screen. Default is False.
- nanval (scalar) – no data value, default value is -1e20
- kstpkper (tuple of ints or list of tuple of ints) – A tuple containing the time step and stress period (kstp, kper). The kstp and kper values are zero based.
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False
-
export_model
(model, otfolder, package_names=None, nanval=-1e+20, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False, kpers=None)[source]¶ Exports model to vtk
Parameters: - model (flopy model instance) – flopy model
- ot_folder (str) – output folder
- package_names (list) – list of package names to be exported
- nanval (scalar) – no data value, default value is -1e20
- array2d (bool) – True if array is 2d, default is False
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False
- kpers (iterable of int) – Stress periods to export. If None (default), all stress periods will be exported.
-
export_package
(pak_model, pak_name, otfolder, vtkobj=None, nanval=-1e+20, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False, kpers=None)[source]¶ Exports package to vtk
Parameters: - pak_model (flopy model instance) – the model of the package
- pak_name (str) – the name of the package
- otfolder (str) – output folder to write the data
- vtkobj (VTK instance) – a vtk object (allows export_package to be called from export_model)
- nanval (scalar) – no data value, default value is -1e20
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False
- kpers (iterable of int) – Stress periods to export. If None (default), all stress periods will be exported.
-
export_transient
(model, array, output_folder, name, nanval=-1e+20, array2d=False, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False, kpers=None)[source]¶ Export transient 2d array to vtk
Parameters: - model (MFModel) – the flopy model instance
- array (Transient instance) – flopy transient array
- output_folder (str) – output folder to write the data
- name (str) – name of array
- nanval (scalar) – no data value, default value is -1e20
- array2d (bool) – True if array is 2d, default is False
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False
- kpers (iterable of int) – Stress periods to export. If None (default), all stress periods will be exported.
-
export_vector
(model, vector, output_folder, name, nanval=-1e+20, array2d=False, smooth=False, point_scalars=False, vtk_grid_type='auto', true2d=False, binary=False)[source]¶ Export vector (i.e., a tuple of arrays) to vtk
Parameters: - model (flopy model instance) – the flopy model instance
- vector (tuple of arrays) – vector to be exported
- output_folder (str) – output folder to write the data
- name (str) – name of vector
- nanval (scalar) – no data value, default value is -1e20
- array2d (bool) – true if the vector components are 2d arrays and represent the first layer, default is False
- smooth (bool) – if True, will create smooth layer elevations, default is False
- point_scalars (bool) – if True, will also output array values at cell vertices, default is False; note this automatically sets smooth to True
- vtk_grid_type (str) –
Specific vtk_grid_type or ‘auto’ (default). Possible specific values are ‘ImageData’, ‘RectilinearGrid’, and ‘UnstructuredGrid’. If ‘auto’, the grid type is automatically determined. Namely:
- A regular grid (in all three directions) will be saved as an ‘ImageData’.
- A rectilinear (in all three directions), non-regular grid will be saved as a ‘RectilinearGrid’.
- Other grids will be saved as ‘UnstructuredGrid’.
- true2d (bool) – If True, the model is expected to be 2d (1 layer, 1 row or 1 column) and the data will be exported as true 2d data, default is False.
- binary (bool) – if True the output file will be binary, default is False