# Data

- tecplot.data
- Loading Data
  - data.load_tecplot()
  - data.load_tecplot_szl()
  - data.load_cgns()
  - data.load_converge_output()
  - data.load_fluent()
  - data.load_fvcom()
  - data.load_plot3d()
- Saving Data
  - data.save_tecplot_ascii()
  - data.save_tecplot_plt()
  - data.save_tecplot_szl()
- Data Queries
  - data.query.probe_at_position()
  - data.query.probe_on_surface()
- Data Operations
  - data.operate.Range()
  - data.operate.execute_equation()
  - data.operate.interpolate_linear()
  - data.operate.interpolate_inverse_distance()
  - data.operate.interpolate_kriging()
- Data Extractions
  - data.extract.extract_line()
  - data.extract.extract_slice()
- Data Access
  - Dataset
  - Variable
  - Zones
  - Array
  - Nodemap
  - Facemap
  - FaceNeighbors
- Auxiliary Data
  - AuxData

## tecplot.data

`Dataset` access and manipulation.

A `Dataset` consists of a matrix of Zones and `Variables`. Each `Zone <data_access>`-`Variable` pair corresponds to a data object which can always be treated as a 1D array, but which may be interpreted as 2D or 3D in the case of ijk-ordered data. In general, the Zone defines the size, shape and connectivity of the data while the `Variable` defines the underlying data type and whether the data is nodal or cell-centered.

Warning

Zero-based Indexing

It is important to know that all indexing in PyTecplot scripts are zero-based. This is a departure from the macro language which is one-based. This is to keep with the expectations when working in the python language. However, PyTecplot does not modify strings that are passed to the Tecplot Engine. This means that one-based indexing should be used when running macro commands from python or when using `execute_equation()`.

## Loading Data

- data.load_tecplot()
- data.load_tecplot_szl()
- data.load_cgns()
- data.load_converge_output()
- data.load_fluent()
- data.load_fvcom()
- data.load_plot3d()

### data.load_tecplot()

`tecplot.data.``load_tecplot`(filenames, frame=None, read_data_option=<ReadDataOption.Append: 1>, reset_style=None, initial_plot_first_zone_only=None, initial_plot_type=None, zones=None, variables=None, collapse=None, skip=None, assign_strand_ids=True, add_zones_to_existing_strands=None, include_text=None, include_geom=None, include_custom_labels=None, include_data=None)

  Read a tecplot data file.

  Parameters: | filenames (`string` or `list` of `strings`) – Files to be read. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` to attach the resulting `Dataset`. If `None`, the currently active `Frame` is used and the zones are appended by default. read_data_option (`ReadDataOption`, optional) – Specify how the data is loaded into Tecplot. (default: `ReadDataOption.Append`) Possible values are: `ReadDataOption.ReplaceInActiveFrame` The `DataSet` in the active frame is replaced by the new `DataSet`. If other frames were using the same `DataSet` originally in the active frame, they will continue to use it. `ReadDataOption.Append` Append the new `DataSet` to the existing `DataSet`. `ReadDataOption.Replace` Replace the `DataSet` attached to the active frame, and to all other frames that use the same `DataSet`. Default: `ReadDataOption.Append` reset_style (`boolean`, optional) – Reset the style for destination `Frame`, if `False`, the `Frame`’s current style is preserved. (default: `True`) initial_plot_first_zone_only (`boolean`, optional) – Informs the Tecplot Engine that after the data is loaded it only needs to activate the first enabled Zone for the initial plot. This option is particularly useful if you have many Zones and want to get the data into the Tecplot Engine and the first Zone drawn as fast as possible. The inactive Zones can always be activated when needed. (default: `False`) initial_plot_type (`PlotType`, optional) – Forces a specific type of plot upon loading of the data. Only used if resetstyle is `True`. To have Tecplot 360 determine the most appropriate plot type for the data, use `PlotType.Automatic`. Possible values are: `PlotType.Automatic` (default), `Cartesian3D`, `Cartesian2D`, `XYLine`, `PlotType.Sketch`, `PolarLine`. zones (`set` of `integers`, optional) – Set of Zones to load. Use `None` to load all zones. (default: `None`) variables (`set` of `strings` or `integers`, optional) – Set of `Variables` to load. Use `None` to load all variables. (default: `None`) collapse (`boolean`, optional) – Reindex Zones and `Variables` if any are disabled. (default: `False`) skip – (3-`tuple` of `integers`, optional) The ijk-skip. A value of (1,1,1) loads every data point in the (i,j,k) directions. A value of (2,2,2) loads every other data point and so forth. This only applies to ordered data. (default: (1,1,1)) assign_strand_ids (`boolean`, optional) – Assign strand ID’s to zones that have a strand ID of -1. (default: `True`) add_zones_to_existing_strands (`boolean`, optional) – Add the Zones to matching strands, if they exist. Otherwise, if the new data specifies strands, new ones will be created beginning after the last strand in the `Dataset`. (default: `False`) include_text (`boolean`, optional) – Load any text, geometries, or custom labels (default: `True`) include_geom (`boolean`, optional) – Load geometries. (default: `True`) include_custom_labels (`boolean`, optional) – (default: `True`) include_data (`boolean`, optional) – Load data. Set this to `False` if you only want annotations such as text or geometries. (default: `True`)
  Returns: | `Dataset` – The `Dataset` holding the loaded data.
  Raises: | `TecplotSystemError` – Internal error when loading data. `TecplotTypeError` – In-valid input.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

### data.load_tecplot_szl()

`tecplot.data.``load_tecplot_szl`(filenames, frame=None, read_data_option=<ReadDataOption.Append: 1>, reset_style=None, initial_plot_first_zone_only=None, initial_plot_type=None, assign_strand_ids=True, add_zones_to_existing_strands=None, server=None, connection_method=None, user=None, ssh_private_keyfile=None)

  Read tecplot SZL data file.

  Parameters: | filenames (`string` or `list` of `strings`) – Files to be read. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` to attach the resulting `Dataset`. If `None`, the currently active `Frame` is used and the zones are appended by default. read_data_option (`ReadDataOption`, optional) – Specify how the data is loaded into Tecplot. (default: `ReadDataOption.Append`) Possible values are: `ReadDataOption.ReplaceInActiveFrame` Remove the dataset from the active frame prior to reading in the new dataset. If other frames use the same `DataSet` in the active frame, they will continue to use the old one. `ReadDataOption.Append` Append the new `DataSet` to the dataset to the existing dataset. `ReadDataOption.Replace` Replace the `DataSet` attached to the active frame and to all other frames that use the same `DataSet`. reset_style (`boolean`, optional) – Reset the style for destination `Frame`, if `False`, the `Frame`’s current style is preserved. (default: `True`) initial_plot_first_zone_only (`boolean`, optional) – Informs the Tecplot Engine that after the data is loaded it only needs to activate the first enabled Zone for the initial plot. This option is particularly useful if you have many Zones and want to get the data into the Tecplot Engine and the first Zone drawn as fast as possible. The inactive Zones can always be activated when needed. (default: `False`) initial_plot_type (`PlotType`, optional) – Forces a specific type of plot upon loading of the data. Only used if resetstyle is `True`. To have Tecplot 360 determine the most appropriate plot type for the data, use `PlotType.Automatic`. Possible values are: `PlotType.Automatic` (default), `Cartesian3D`, `Cartesian2D`, `XYLine`, `PlotType.Sketch`, `PolarLine`. assign_strand_ids (`boolean`, optional) – Assign strand ID’s to zones that have a strand ID of -1. (default: `True`) add_zones_to_existing_strands (`boolean`, optional) – Add the Zones to matching strands, if they exist. Otherwise, if the new data specifies strands, new ones will be created beginning after the last strand in the `Dataset`. (default: `False`) server (`string`, optional) – Load the data remotely from this server address. When provided, file paths will be relative to the SZL server’s working directory. (default: `None`) connection_method (`RemoteConnectionMethod`, optional) – When server is given, this specifies the type of connection to be made. Possible values are: `RemoteConnectionMethod.Tunneled` (default), `RemoteConnectionMethod.Direct`, `RemoteConnectionMethod.Manual`. user (`string`, optional) – When server is given, this specifies the username to use when logging into the server. This will default to the client’s user name. private_ssh_keyfile (`string`, optional) – When server is given, this specifies the full path to the private SSH keyfile which defaults to `~/.ssh/id_rsa` where `~` expands out to the local user’s home directory.
  Returns: | `Dataset` – The `Dataset` holding the loaded data.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

### data.load_cgns()

`tecplot.data.``load_cgns`(filenames, frame=None, read_data_option=<ReadDataOption.Append: 1>, reset_style=None, initial_plot_first_zone_only=None, initial_plot_type=None, zones=None, variables=None, load_convergence_history=None, combine_fe_sections=None, average_to_nodes='Arithmetic', uniform_grid=None, assign_strand_ids=None, add_zones_to_existing_strands=None, include_boundary_conditions=True)

  Read CGNS data files.

  Parameters: | filenames (`string` or `list` of `strings`) – CGNS data files to be read. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` to attach the resulting `Dataset`. If `None`, the currently active `Frame` is used and the zones are appended by default. read_data_option (`ReadDataOption`, optional) – Specify how the data is loaded into Tecplot. (default: `ReadDataOption.Append`) Possible values are: `ReadDataOption.ReplaceInActiveFrame` Remove the dataset from the active frame prior to reading in the new dataset. If other frames use the same `DataSet` in the active frame, they will continue to use the old one. `ReadDataOption.Append` Append the new `DataSet` to the dataset to the existing dataset. `ReadDataOption.Replace` Replace the `DataSet` attached to the active frame and to all other frames that use the same `DataSet`. reset_style (`boolean`, optional) – Reset the style for destination `Frame`, if `False`, the `Frame`’s current style is preserved. (default: `True`) initial_plot_first_zone_only (`boolean`, optional) – Informs the Tecplot Engine that after the data is loaded it only needs to activate the first enabled Zone for the initial plot. This option is particularly useful if you have many Zones and want to get the data into the Tecplot Engine and the first Zone drawn as fast as possible. The inactive Zones can always be activated when needed. (default: `False`) initial_plot_type (`PlotType`, optional) – Forces a specific type of plot upon loading of the data. Only used if resetstyle is `True`. To have Tecplot 360 determine the most appropriate plot type for the data, use `PlotType.Automatic`. Possible values are: `PlotType.Automatic` (default), `Cartesian3D`, `Cartesian2D`, `XYLine`, `PlotType.Sketch`, `PolarLine`. zones (`list` of `integers`, optional) – List of zone indexes to load starting from zero. `None` implies loading all zones. (default: `None`) variables (`list` of `integers`, optional) – List of variable indexes, beyond the first coordinate variables, to load starting from zero. `None` implies loading all variables. The grid will always be loaded and an index of zero indicates the first non-coordinate variable. (default: `None`) load_convergence_history (`boolean`, optional) – Load the global convergence history rather than any grid or solution data. (default: `False`) combine_fe_sections (`boolean`, optional) – Combine all finite-element sections with the zone cell-dimension into one zone. (default: `False`) average_to_nodes (`string`, optional) – Average cell-centered data to grid nodes using the specified method. (Options: `None`, “Arithmetic”, “Laplacian”, default: “Arithmetic”) uniform_grid (`boolean`, optional) – Indicates the grid structure is the same for all time steps. (default: `True`) assign_strand_ids (`boolean`, optional) – Assign strand ID’s to zones that have a strand ID of -1. (default: `True`) add_zones_to_existing_strands (`boolean`, optional) – Add the Zones to matching strands, if they exist. Otherwise, if the new data specifies strands, new ones will be created beginning after the last strand in the `Dataset`. (default: `False`) include_boundary_conditions (`boolean`, optional) – Load the boundary conditions along with the data. Upon loading, the associated fieldmaps will remain inactive. For unstructured data, boundary conditions are always loaded and this option is ignored. (default: `True`)
  Returns: | `Dataset` – The `Dataset` holding the loaded data.
  Raises: | `TecplotSystemError` – Internal error when loading data. `TecplotTypeError` – Invalid input.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

### data.load_converge_output()

`tecplot.data.``load_converge_output`(filenames, frame=None, read_data_option=<ReadDataOption.Append: 1>, reset_style=None)

  Read CONVERGENT Output data files.

  Parameters: | filenames (`string` or `list` of `strings`) – CONVERGE Output data files to be read. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` to attach the resulting `Dataset`. If `None`, the currently active `Frame` is used and the zones are appended by default. read_data_option (`ReadDataOption`, optional) – Specify how the data is loaded into Tecplot. (default: `ReadDataOption.Append`) Possible values are: `ReadDataOption.ReplaceInActiveFrame` Remove the dataset from the active frame prior to reading in the new dataset. If other frames use the same `DataSet` in the active frame, they will continue to use the old one. `ReadDataOption.Append` Append the new `DataSet` to the dataset to the existing dataset. `ReadDataOption.Replace` Replace the `DataSet` attached to the active frame and to all other frames that use the same `DataSet`. reset_style (`boolean`, optional) – Reset the style for destination `Frame`, if `False`, the `Frame`’s current style is preserved. (default: `True`)
  Returns: | `Dataset` – The `Dataset` holding the loaded data.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

### data.load_fluent()

`tecplot.data.``load_fluent`(case_filenames=None, data_filenames=None, frame=None, append=True, zones=None, variables=None, all_poly_zones=None, average_to_nodes='Arithmetic', time_interval=None, assign_strand_ids=True, add_zones_to_existing_strands=None, include_particle_data=None, include_additional_quantities=True, save_uncompressed_files=None)

  Read Fluent data files.

  Parameters: | case_filenames (`string` or `list` of `strings`, optional) – Case (.cas, .cas.gz) files to be read. Compressed files with extension .gz are supported. (See note below conerning absolute and relative paths.) data_filenames (`string` or `list` of `strings`, optional) – Data (.dat, .xml, .dat.gz, .fdat, .fdat.gz, etc.) files to be read. Compressed files with extension .gz are supported. frame (`Frame`, optional) – The `Frame` to attach the resulting `Dataset`. If `None`, the currently active `Frame` is used and the zones are appended by default. append (`boolean`, optional) – Append the data to the existing `Dataset`. If `False`, the existing data attached to the `Frame` is deleted and replaced. (default: `True`) zones (`string` or `list` of `integers`, optional) – List of zone indexes (zero-based) to load or string specifying the type of zones to load. Possible values are: “CellsAndBoundaries”, “CellsOnly” and “BoundariesOnly”. Specifying one of these options is mutually exclusive with the `variables` option. (default: “CellsAndBoundaries”) variables (`list` of `strings`, optional) – List of variable names to load. `None` implies loading all variables. (default: `None`) all_poly_zones (`boolean`, optional) – Converts all zones to Tecplot polytope (polyhedral or polygonal) zones. (default: `False`) average_to_nodes (`string`, optional) – Average cell-centered data to grid nodes using the specified method. (Options: `None`, “Arithmetic”, “Laplacian”, default: “Arithmetic”) time_interval (`float`, optional) – Use a constant time interval between each .dat file. If `None`, the flow-data parameter of each solution .dat file is used. (default: `None`) assign_strand_ids (`boolean`, optional) – Assign strand ID’s to zones that have a strand ID of -1. (default: `True`) Note assign_strand_ids only applies if you have also provided a time_interval, otherwise it will be ignored. add_zones_to_existing_strands (`boolean`, optional) – Add the Zones to matching strands, if they exist. Otherwise, if the new data specifies strands, new ones will be created beginning after the last strand in the `Dataset`. (default: `False`) include_particle_data (`boolean`, optional) – Load particle data from the .dat files. If loading particle data from an XML file, the XML file should be included in the `data_filenames` list. (default: `False`) include_additional_quantities (`boolean`, optional) – Load quantities that were derived from the FLUENT’s standard quantities. (default: `True`) New in Tecplot 360 2017 R2. save_uncompressed_files (`boolean`, optional) – Save the uncompressed files to the compressed files’ location.
  Returns: | `Dataset` – The `Dataset` holding the loaded data.
  Raises: | `TecplotSystemError` – Internal error when loading data. `TecplotTypeError` – In-valid input.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

  Notes

  The `zones` option takes either a `list` of zone indexes to be imported or one of “CellsAndBoundaries”, “CellsOnly” or “BoundariesOnly” to indicate the type of zones the user wants to load, however these options are mutually exclusive with the `variables` option:

      >>> import tecplot
      >>> dataset = tecplot.data.load_fluent(['one.cas', 'two.cas'],
      ...     data_filenames=['one.dat', 'two.dat'],
      ...     variables = ['Pressure','Velocity'],
      ...     zones = [0,1,3])

### data.load_fvcom()

`tecplot.data.``load_fvcom`(filenames, frame=None, read_data_option=<ReadDataOption.Append: 1>, reset_style=None, initial_plot_type=None)

  Read FVCOM netCDF data files.

  Parameters: | filenames (`string` or `list` of `strings`) – FVCOM data files to be read. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` to attach the resulting `Dataset`. If `None`, the currently active `Frame` is used and the zones are appended by default. read_data_option (`ReadDataOption`, optional) – Specify how the data is loaded into Tecplot. (default: `ReadDataOption.Append`) Possible values are: `ReadDataOption.ReplaceInActiveFrame` Remove the dataset from the active frame prior to reading in the new dataset. If other frames use the same `DataSet` in the active frame, they will continue to use the old one. `ReadDataOption.Append` Append the new `DataSet` to the dataset to the existing dataset. `ReadDataOption.Replace` Replace the `DataSet` attached to the active frame and to all other frames that use the same `DataSet`. reset_style (`boolean`, optional) – Reset the style for destination `Frame`, if `False`, the `Frame`’s current style is preserved. (default: `True`) initial_plot_type (`PlotType`, optional) – Forces a specific type of plot upon loading of the data. Only used if resetstyle is `True`. To have Tecplot 360 determine the most appropriate plot type for the data, use `PlotType.Automatic`. Possible values are: `PlotType.Automatic` (default), `Cartesian3D`, `Cartesian2D`, `XYLine`, `PlotType.Sketch`, `PolarLine`.
  Returns: | `Dataset` – The `Dataset` holding the loaded data.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

  New in version 2018.2: Loading FVCOM data requires Tecplot 360 2018 R2 or later.

### data.load_plot3d()

`tecplot.data.``load_plot3d`(grid_filenames=None, solution_filenames=None, function_filenames=None, name_filename=None, frame=None, append=True, data_structure=None, is_multi_grid=None, style=None, ascii_is_double=None, ascii_has_blanking=None, uniform_grid=None, assign_strand_ids=True, add_zones_to_existing_strands=True, append_function_variables=None, include_boundaries=True)

  Read Plot3D data files.

  Parameters: | grid_filenames (`list` of `strings`, optional) – One or more grid file names to be read. (See note below conerning absolute and relative paths.) solution_filenames (`list` of `strings`, optional) – One or more solution data file names to be read. function_filenames (`list` of `strings`, optional) – One or more function file names. name_filename (`string`, optional) – Path to the name file. frame (`Frame`, optional) – The `Frame` to attach the resulting `Dataset`. If `None`, the currently active `Frame` is used and the zones are appended by default. append (`boolean`, optional) – Append the data to the existing `Dataset`. If `False`, the existing data attached to the `Frame` is deleted and replaced. (default: `True`) data_structure (`string`, optional) – Specifies the data structure and overrides the automatic detection. Options are: `1D`, `2D`, `3DP`, `3DW`, `UNSTRUCTURED`. Setting this requires `is_multi_grid` and `style` to be set as well. is_multi_grid (`boolean`, optional) – Sets data as multi-grid and overrides the automatic data structure detection. Setting this requires `data_structure` and `style` to be set as well. style (`boolean`, optional) – Specifies the data style and overrides the automatic data structure detection. Options are: `PLOT3DCLASSIC`, `PLOT3DFUNCTION`, `OVERFLOW`. Setting this requires `data_structure` and `is_multi_grid` to be set as well. ascii_is_double (`boolean`, optional) – Indicates that floating-point numbers found in the text data files should be store with 64-bit precision. (default: `False`) ascii_has_blanking (`boolean`, optional) – Indicates that the text data files contain blanking. (default: `False`) uniform_grid (`boolean`, optional) – Indicates the grid structure is the same for all time steps. (default: `True`) assign_strand_ids (`boolean`, optional) – Assign strand ID’s to zones that have a strand ID of -1. (default: `True`) add_zones_to_existing_strands (`boolean`, optional) – Add the Zones to matching strands, if they exist. Otherwise, if the new data specifies strands, new ones will be created beginning after the last strand in the `Dataset`. (default: `True`) append_function_variables (`boolean`, optional) – Append variables in function files to those found in solution files. (default: `False`) include_boundaries (`boolean`, optional) – Loads boundary zones found in the “.g.fvbnd” file located in the same directory as the grid file, if available. (default: `True`)
  Returns: | `Dataset` – The `Dataset` holding the loaded data.
  Raises: | `TecplotSystemError` – Internal error when loading data. `TecplotValueError` – In-valid input.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

  Note

  Data structure is automatically detected by default.

  The options `data_structure`, `is_multi_grid` and `style` must be supplied together or not at all. When all of these are `None`, the data structure is automatically detected.

  The variables from the function files can be appended to the dataset upon loading:

      >>> dataset = tecplot.data.load_plot3d(
      ...     grid_filenames = 'data.g',
      ...     solution_filenames = ['t0.q', 't1.q'],
      ...     function_filenames = ['t0.f', 't1.f'],
      ...     append_function_variables = True)

## Saving Data

- data.save_tecplot_ascii()
- data.save_tecplot_plt()
- data.save_tecplot_szl()

### data.save_tecplot_ascii()

`tecplot.data.``save_tecplot_ascii`(filename, frame=None, dataset=None, zones=None, variables=None, include_text=None, precision=None, include_geom=None, include_data=None, include_data_share_linkage=None, include_autogen_face_neighbors=None, use_point_format=None)

  Write Tecplot ASCII data file.

  Parameters: | filename (`string`) – Name of the data file to write. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` which holds the `Dataset` to be written. If this option and dataset are both `None`, the currently active `Frame` is used. (default: `None`) dataset (`Dataset`, optional) – The `Dataset` to write out. If this and frame are both `None`, the `Dataset` of the currently active `Frame` is used. (default: `None`) include_text (`boolean`, optional) – Write out all text, geometries and custom labels. (default: `True`) include_geom (`boolean`, optional) – Write out all geometries. (default: `True`) include_data (`boolean`, optional) – Write out the data. Set this to `False` if you only want to write out annotations. (default: `True`) include_data_share_linkage (`boolean`, optional) – Conserve space and write the variable and connectivity linkage wherever possible. If `False`, this will write out all data, losing the connectivity sharing linkage for future dataset reads of the file. (default: `True`) include_autogen_face_neighbors (`boolean`, optional) – Save the face neighbor connectivity. This may produce very large data files. (default: `False`) use_point_format (`boolean`, optional) – Write out point format, otherwise use block format. (default: `False`) zones (`list` of Zones, optional) – Zones to write out. Use `None` to write out all Zones. (default: `None`) variables (`list` of `Variables`, optional) – `Variables` to write out. Use `None` to write out all `Variables`. (default: `None`) precision (`integer`, optional) – ASCII decimal precision to use. (default: 12)
  Returns: | `Dataset` – The `Dataset` read from when saving.
  Raises: | `TecplotSystemError` `TecplotLogicError`

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

  Example

  In this example, we load sample data and save the data in Tecplot ASCII format.

      from os import path
      import tecplot
      examples_directory = tecplot.session.tecplot_examples_directory()
      infile = path.join(examples_directory,
                         'OneraM6wing', 'OneraM6_SU2_RANS.plt')
      dataset = tecplot.data.load_tecplot(infile)
      variables_to_save = [dataset.variable(V)
                           for V in ('x','y','z','Pressure_Coefficient')]

      zone_to_save = dataset.zone('WingSurface')
      # write data out to an ascii file
      tecplot.data.save_tecplot_ascii('wing.dat', dataset=dataset,
                                      variables=variables_to_save,
                                      zones=[zone_to_save])

### data.save_tecplot_plt()

`tecplot.data.``save_tecplot_plt`(filename, frame=None, dataset=None, zones=None, variables=None, version=None, include_text=None, include_geom=None, include_data=None, include_data_share_linkage=None, include_autogen_face_neighbors=None, associate_with_layout=None)

  Write Tecplot binary PLT data file.

  Parameters: | filename (`string`) – Name of the data file to write. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` which holds the `Dataset` to be written. If this option and dataset are both `None`, the currently active `Frame` is used. (default: `None`) dataset (`Dataset`, optional) – The `Dataset` to write out. If this and frame are both `None`, the `Dataset` of the currently active `Frame` is used. (default: `None`) zones (`list` of Zones, optional) – Zones to write out. If `None`, all Zones will be saved. variables (`list` of `Variables`, optional) – `Variables` to write out. If `None`, all `Variables` will be saved. include_text (`boolean`, optional) – Write out all text, geometries and custom labels. (default: `True`) include_geom (`boolean`, optional) – Write out all geometries. (default: `True`) include_data (`boolean`, optional) – Write out the data. Set this to `False` if you only want to write out annotations. (default: `True`) include_data_share_linkage (`boolean`, optional) – Conserve space and write the variable and connectivity linkage wherever possible. If `False`, this will write out all data, losing the connectivity sharing linkage for future dataset reads of the file. (default: `True`) include_autogen_face_neighbors (`boolean`, optional) – Save the face neighbor connectivity. This may produce very large data files. (default: `False`) associate_with_layout (`boolean`, optional) – Associate this data file with the current layout. Set to `False` to write the datafile without modifying Tecplot’s current data file to layout association. If version is set to anything other than `BinaryFileVersion.Current`, this association is not possible, and this parameter will be ignored. (default: `True`) version (`BinaryFileVersion`, optional) – Specifies the file version to write. Note that some data may be excluded from the file if it cannot be supported in the specified version. Possible values are: `Tecplot2006`, `Tecplot2008`, `Tecplot2009` and `BinaryFileVersion.Current`. (default: `BinaryFileVersion.Current`)
  Returns: | `Dataset` – The `Dataset` read from when saving.
  Raises: | `TecplotSystemError` `TecplotLogicError`

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

  Example

  In this example, we load sample data and save the data in Tecplot binary PLT format.

      from os import path
      import tecplot
      examples_directory = tecplot.session.tecplot_examples_directory()
      infile = path.join(examples_directory,
                         'OneraM6wing', 'OneraM6_SU2_RANS.plt')
      dataset = tecplot.data.load_tecplot(infile)
      variables_to_save = [dataset.variable(V)
                           for V in ('x', 'y', 'z',
                                     'Pressure_Coefficient')]

      zone_to_save = dataset.zone('WingSurface')
      # write data out to a binary file
      tecplot.data.save_tecplot_plt('wing.plt', dataset=dataset,
                                      variables=variables_to_save,
                                      zones=[zone_to_save])

### data.save_tecplot_szl()

`tecplot.data.``save_tecplot_szl`(filename, frame=None, dataset=None)

  Write Tecplot SZL data file.

  Parameters: | filename (`string`) – Name of the data file to write. (See note below conerning absolute and relative paths.) frame (`Frame`, optional) – The `Frame` which holds the `Dataset` to be written. If this option and dataset are both `None`, the currently active `Frame` is used. (default: `None`) dataset (`Dataset`, optional) – The `Dataset` to write out. If this and frame are both `None`, the `Dataset` of the currently active `Frame` is used. (default: `None`)
  Returns: | `Dataset` – The `Dataset` read from when saving.

  Note

  Absolute and relative paths with PyTecplot

  Relative paths, when used within the PyTecplot API are always from Python’s current working directory which can be obtained by calling `os.getcwd()`. This is true for batch and `connected` modes. One exception to this is paths within a macro command or file which will be relative to the Tecplot Engine’s home directory, which is typically the Tecplot 360 installation directory. Finally, when connected to a remote (non-local) instance of Tecplot 360, only absolute paths are allowed.

  Note that backslashes must be escaped which is especially important for windows paths such as `"C:\\Users"` or `"\\\\server\\path"` which will resolve to `"C:\Users"` and `"\\server\path"` respectively. Alternatively, one may use Python’s raw strings: `r"C:\Users"` and `r"\\server\path"`

  Example

  In this example, we load sample data and save it in Tecplot SZL format.

      from os import path
      import tecplot
      examples_directory = tecplot.session.tecplot_examples_directory()
      infile = path.join(examples_directory,
                         'OneraM6wing', 'OneraM6_SU2_RANS.plt')
      dataset = tecplot.data.load_tecplot(infile)
      tecplot.data.save_tecplot_szl('wing.szplt')

## Data Queries

### data.query.probe_at_position()

`tecplot.data.query.``probe_at_position`(x, y, z=None, nearest=False, starting_cell=None, starting_zone=None, zones=None, dataset=None, frame=None)

  Returns field values at a point in space.

  Note

  The position is taken according to the axis assignments of the `Frame` which may be any of the associated variables in the `Dataset` and not necessarily `(X, Y, Z)`. See: `Cartesian3DFieldAxis.variable`.

  Parameters: | x,y,z (`float`, z is optional) – position to probe for field values. nearest (`bool`) – Returns the values at the nearest node to the given position. Probe position must be inside the volume of the data being queried, otherwise this will return `None`. starting_cell (3-`tuple` of `integers`, optional) – The `(i,j,k)`-index of the cell to start looking for the given position. This must be used with `starting_zone`. starting_zone (Zone, optional) – The first zone to start searching. This is required only when `starting_cell` is specified. zones (`list` of Zones, optional) – Limits the search to the given zones. `None` implies searching all zones. (default: `None`) dataset (`Dataset`, optional) – The `Dataset` to probe. (defaults to the active `Dataset`.) frame (`Frame`, optional) – The `Frame` which determines the spatial variable assignment `(X,Y,Z)`. (defaults to the active `Frame`.)
  Returns: | `namedtuple` – `(data, cell, zone)`: `data` (`list` of `floats`) The values of each variable in the dataset at the given position. `cell` (3-`tuple` of `integers`) `(i,j,k)` of the cell containing the given position. `zone` (Zone) Zone containing the given position

  Note

  Returns `None` if the position can’t be probed.

  This method will return `None` if the position is outside the volume of the data being queried. This means one should capture the results in a single variable and test it against `None` before proceeding:

      result = tp.data.query.probe_at_position(1.0, 2.0, 3.0)
      if result is None:
          print('probe failed.')
      else:
          data, cell, zone = result

  Additionally, with Tecplot 360 versions 2018 R1 and later, this function will raise an exception if Tecplot 360 was interrupted via the GUI during the probe operation.

### data.query.probe_on_surface()

`tecplot.data.query.``probe_on_surface`(positions=((0, ), (0, ), (0, )), zones=None, variables=None, probe_nearest=<ProbeNearest.Position: 0>, obey_blanking=True, num_nearest_nodes=20, tolerance=1e-05, dataset=None, frame=None)

  Returns field values at points on a surface closest the points given.

  Note

  The positions are processed according to the axis assignments of the `Frame` which may be any of the associated variables in the `Dataset` and not necessarily (but usually) `(X, Y, Z)`. See: `Cartesian3DFieldAxis.variable`.

  Parameters: | positions (2D `float` array) – Array of points to probe dimensioned by `(3, N)` where the first dimension corresponds to `(x, y, z)`. A 1D `float` array is accepted for single point probes, however this should be avoided when probing several positions as the internal algorithm is optimized for probing many positions at once. zones (`list` of Zones, optional) – Limits the search to the given zones. `None` implies searching all active relevant surface zones including surfaces of ordered volume zones. To search FE or polygonal volume boundaries, include the volume zones in this list. (default: `None`) variables (`list` of `Variables`, optional) – The variables within the dataset to probe. `None` implies all variables. (default: `None`) probe_nearest (`ProbeNearest`, optional) – Probe at the nodal location (`ProbeNearest.Node`) or interpolate to nearest location on the surface (`ProbeNearest.Position`, default). The return parameter cells_or_nodes will be cells if set to `ProbeNearest.Position` (default), or nodes if set to `ProbeNearest.Node`. obey_blanking (`bool`, optional) – Do not search blanked cells according the frame’s style settings. (default: `True`) num_nearest_nodes (`integer`, optional) – Only consider surface cells that contain one of the closest `N` nodes to the probed position. For highly varying surfaces, the nearest cell may or may not contain the nearest nodes to the probe position and so this value should be increased accordingly, however doing so increases the search-space linearly. (default: 20) tolerance (`float`, optional) – The percentage of the longest cartesian `(x, y, z)` dimension subtended by the polygons of the surface. This is used in several parts of the algorithm to find the nearest position on the surface zones and should be increased when probing imprecise nodal position data. (default: 1e-5) dataset (`Dataset`, optional) – The `Dataset` to probe. (defaults to the active `Dataset`.) frame (`Frame`, optional) – The `Frame` which determines the spatial variable assignment `(X,Y,Z)`. (defaults to the active `Frame`.)
  Returns: | `namedtuple` – `(data, cells_or_nodes, planes, zone)`: `data` (`list` of `floats`) Flattened `float` array which can be reshaped to `(V, N)` where `V` is the number of variables returned (either the number of variables in the dataset or the length of variables input parameter) and `N` is the number of points probed. `cells_or_nodes` (`list` of `integers`) The index to the cells (or nodes if `ProbeNearest.Node` was passed in to probe_nearest) containing the returned positions. `planes` (`list` of `IJKPlanes`) For ordered zones, these are the plane-orientations of the cells for each probed position. `zones` (`list` of Zones) Zones containing the given positions.

  New in version 2018.1: Probe on surface requires Tecplot 360 2018 R1 or later.

  Note

  The frame’s plot type must be set to `PlotType.Cartesian3D`

  Probe on surface requires the spatial variables to be set according to the frame’s style. This can be done by setting the plot type to `PlotType.Cartesian3D`. Example:

      tp.active_frame().plot_type = tp.constant.PlotType.Cartesian3D

  For probing on 2D data, use `probe_at_position()`.

  Note

  Linear zones will always return nearest nodal values.

  If linear zones, which are ignored by default, are included in the zones parameter, the resulting values on that zone will always be nodal and no interpolation on the position will be done.

  Note

  Irregular or jaggged surfaces may behave poorly.

  For performance reasons, this algorithm has the potential to miss the closest position on highly varying surfaces. This can be addressed by first increasing num_nearest_nodes to search more of the zones and then by increasing the tolerance to allow for imprecise position data.

  Example usage:

      >>> from os import path
      >>> import numpy as np
      >>>
      >>> import tecplot as tp
      >>> from tecplot.constant import PlotType
      >>>
      >>> examples = tp.session.tecplot_examples_directory()
      >>> datafile = path.join(examples, 'SimpleData', 'F18.plt')
      >>> ds = tp.data.load_tecplot(datafile)
      >>> fr = tp.active_frame()
      >>> fr.plot_type = PlotType.Cartesian3D
      >>>
      >>> # probe a single point
      >>> res = tp.data.query.probe_on_surface((13.5, 4.0, 0.6 ))
      >>> print(res.data)
      (13.499723788684996, 3.9922783797612795, 0.49241572276992346,
      0.0018958827755862578, 0.07313805429221854, 0.997276718375976,
      0.06335166319722907)
      >>>
      >>> # probe multiple points
      >>> points = np.array([[13.5,  4.0, 0.6],  # just above starboard wing
      >>>                    [13.5, -4.0, 0.6]]) # just above port wing
      >>>
      >>> res = tp.data.query.probe_on_surface(points.transpose())
      >>> values = np.array(res.data).reshape((-1, len(points))).transpose()
      >>>
      >>> # print probed position and the result of the probe
      >>> for pt, v in zip(points, values):
      >>>     print(pt, v)
      [ 13.5   4.    0.6] [  1.34997238e+01   3.99227838e+00   4.92415723e-01
         1.89588278e-03   7.31380543e-02   9.97276718e-01   6.33516632e-02]
      [ 13.5  -4.    0.6] [  1.34997238e+01  -3.99227838e+00   4.92415723e-01
         1.89588278e-03   7.31380543e-02   9.97276718e-01   6.33516632e-02]

## Data Operations

- data.operate.Range()
- data.operate.execute_equation()
- data.operate.interpolate_linear()
- data.operate.interpolate_inverse_distance()
- data.operate.interpolate_kriging()

### data.operate.Range()

`tecplot.data.operate.``Range`(min, max, step)

  Limit the data altered by the `execute_equation` function.

  The Range specification of I,J,K range indices for `execute_equation` follow these rules:

  > - All indices start with 0 and go to some maximum index m.
  > - Negative values represent the indexes starting with the maximum at -1 and continuing back to the beginning of the range.
  > - A step of None, 0 and 1 are all equivalent and mean that no elements are skipped.
  > - A negative step indicates a skip less than the maximum.

  Example

  Add one to variable ‘X’ for a zone ‘Rectangular’ for data points in I Range 1 to max, skipping every three points:

      >>> execute_equation('{X} = {X}+1', i_range=Range(1, None, 3),
      ...                  zone_set='Rectangular')

### data.operate.execute_equation()

`tecplot.data.operate.``execute_equation`(equation, zones=None, i_range=None, j_range=None, k_range=None, value_location=None, variable_data_type=None, ignore_divide_by_zero=None)

  The execute_equation function operates on a data set within the Tecplot Engine using FORTRAN-like equations.

  Parameters: | equation (`string`) – String containing the equation. Multiple equations can be processed by separating each equation with a newline. See Section 20 - 1 “Data Alteration through Equations” in the Tecplot User’s Manual for more information on using equations. Iterable container of Zone objects to operate on. May be a list, set, tuple, or any iterable container. If `None`, the equation will be applied to all zones. Note In the equation string, variable names should be enclosed in curly braces. For example, ‘{X} = {X} + 1’ zones – (Iterable container of Zone objects, optional): Iterable container of Zone objects to operate on. May be a list, set, tuple, or any iterable container. If `None`, the equation will be applied to all zones. i_range (`Range`, optional) – Tuple of integers for I: (min, max, step). If `None`, then the equation will operate on the entire range. Not used for finite element nodal data. j_range (`Range`, optional) – Tuple of integers for J: (min, max, step). If `None`, then the equation will operate on the entire range. Not used for finite element nodal data. k_range (`Range`, optional) – Tuple of integers for K: (min, max, step). If `None`, then the equation will operate on the entire range. Not used for finite element nodal data. value_location (`ValueLocation`, optional) – Variable `ValueLocation` for the variable on the left hand side. This is used only if this variable is being created for the first time. If `None`, Tecplot Engine will choose the location for you. variable_data_type (`FieldDataType`, optional) – Data type for the variable on the left hand side. This is used only if this variable is being created for the first time. If `None`, Tecplot Engine will choose the type for you. ignore_divide_by_zero (`bool`, optional) – `bool` value which instructs Tecplot Engine to ignore divide by zero errors. The result is clamped such that 0/0 is clamped to zero and (+/-N)/0 where N != 0 clamps to +/-maximum value for the given type.

  Warning

  Zero-based Indexing

  It is important to know that all indexing in PyTecplot scripts are zero-based. This is a departure from the macro language which is one-based. This is to keep with the expectations when working in the python language. However, PyTecplot does not modify strings that are passed to the Tecplot Engine. This means that one-based indexing should be used when running macro commands from python or when using `execute_equation()`.

  Add one to variable ‘X’ for zones ‘Rectangular’ and ‘Circular’ for every data point:

      >>> dataset = tecplot.active_frame().dataset
      >>> execute_equation('{X} = {X} + 1', zones=[dataset.zone('Rectangular'),
      >>>                  dataset.zone('Circular')])

  Create a new, double precision variable called DIST:

      >>> execute_equation('{DIST} = SQRT({X}**2 + {Y}**2)',
      ...                  variable_data_type=FieldDataType.Double)

  Set a variable called P to zero along the boundary of an IJ-ordered zone:

      >>> execute_equation('{P} = 0', i_range=Range(step=-1))
      >>> execute_equation('{P} = 0', j_range=Range(step=-1))

### data.operate.interpolate_linear()

`tecplot.data.operate.``interpolate_linear`(destination_zone, source_zones=None, variables=None, fill_value=None, plot=None)

  Linear interpolation onto a destination zone.

  Parameters: | destination_zone (zone or `integer`) – The destination zone (or zone index) for interpolation. source_zones (zones or `integers`, optional) – Zones (or zone indices) used to obtain the field values for interpolation. By default, all zones except the destination_zone will be used. All source zones must be FE-Tetra, FE-Brick or be IJK-ordered when doing linear interpolation in 3D. variables (`variables` or `integers`, optional) – Variables (or variable indices) to interpolate. By default, all variables except those assigned to the axes will be used and is in general dependent on the active plot type of the frame. fill_value (`float`, optional) – Constant value to which all points outside the data field are set. By default, the values outside the field are preserved. plot (Plot, optional) – The plot to use when interpolating which determines the dimensionality and spatial variables. By default, the active plot on the active frame will be used.

  Note

  Cartesian 2D and 3D plots only.

  This interpolation method relies on the coordinates, \((x, y)\) for 2D or \((x, y, z)\) for 3D, set for the active (or given) plot which must be either Cartesian2D or Cartesian3D.

  The following example loads a 2D dataset and uses interpolation to merge information from two independent zones:

      import os
      import numpy as np
      import tecplot as tp
      from tecplot.constant import *

      # Use interpolation to merge information from two independent zones
      examples_dir = tp.session.tecplot_examples_directory()
      datafile = os.path.join(examples_dir, 'SimpleData', 'RainierElevation.plt')
      dataset = tp.data.load_tecplot(datafile)
      # Get list of source zones to use later
      srczones = list(dataset.zones())

      fr = tp.active_frame()
      plot = fr.plot(PlotType.Cartesian2D)
      plot.activate()
      plot.show_contour = True
      plot.show_edge = True

      # Show two section of the plot independently
      plot.contour(0).legend.show = False
      plot.contour(1).legend.show = False
      plot.contour(1).colormap_name = 'Diverging - Blue/Red'
      for scrzone in srczones:
          plot.fieldmap(scrzone).edge.line_thickness = 0.4
      plot.fieldmap(0).contour.flood_contour_group = plot.contour(1)

      # export image of original data
      tp.export.save_png('interpolate_2d_source.png', 600, supersample=3)

      # use the first zone as the source, and get the range of (x, y)
      xvar = plot.axes.x_axis.variable
      yvar = plot.axes.y_axis.variable
      ymin, xmin = 99999,99999
      ymax, xmax = -99999,-99999
      for scrzone in srczones:
          curxmin, curxmax = scrzone.values(xvar.index).minmax()
          curymin, curymax = scrzone.values(yvar.index).minmax()
          ymin = min(curymin,ymin)
          ymax = max(curymax,ymax)
          xmin = min(curxmin,xmin)
          xmax = max(curxmax,xmax)

      # create new zone with a coarse grid
      # onto which we will interpolate from the source zone
      xpoints = 40
      ypoints = 40
      newzone = dataset.add_ordered_zone('Interpolated', (xpoints, ypoints))

      # setup the (x, y) positions of the new grid
      xx = np.linspace(xmin, xmax, xpoints)
      yy = np.linspace(ymin, ymax, ypoints)
      YY, XX = np.meshgrid(yy, xx, indexing='ij')
      newzone.values(xvar.index)[:] = XX.ravel()
      newzone.values(yvar.index)[:] = YY.ravel()

      # perform linear interpolation from the source to the new zone
      tp.data.operate.interpolate_linear(newzone, source_zones=srczones)

      # show the new zone's data, hide the source
      plot.fieldmap(newzone).show = True
      plot.fieldmap(newzone).contour.show = True
      plot.fieldmap(newzone).contour.flood_contour_group = plot.contour(0)
      plot.fieldmap(newzone).edge.show = True
      plot.fieldmap(newzone).edge.line_thickness = .4
      plot.fieldmap(newzone).edge.color = Color.Orange

      for scrzone in srczones:
          plot.fieldmap(scrzone).show = False

      # export image of interpolated data
      tp.export.save_png('interpolate_linear_2d_dest.png', 600, supersample=3)

  Source data.

  Interpolated data.

### data.operate.interpolate_inverse_distance()

`tecplot.data.operate.``interpolate_inverse_distance`(destination_zone, source_zones=None, variables=None, exponent=3.5, min_radius=0.0, point_selection=<PtSelection.OctantN: 2>, num_points=8, plot=None)

  Inverse-Distance interpolation onto a destination zone.

  Parameters: | destination_zone (zone or `integer`) – The destination zone (or zone index) for interpolation. source_zones (zones or `integers`, optional) – Zones (or zone indices) used to obtain the field values for interpolation. By default, all zones except the destination_zone will be used. All source zones must be FE-Tetra, FE-Brick or be IJK-ordered when doing linear interpolation in 3D. variables (`variables` or `integers`, optional) – Variables (or variable indices) to interpolate. By default, all variables except those assigned to the axes will be used and is in general dependent on the active plot type of the frame. exponent (`float`, optional) – Exponent for the inverse-distance weighting. (default: 3.5) num_radius (`float`, optional) – Minimum distance used for the inverse-distance weighting. (default: 0.0) point_selection (`PtSelection`, optional) – Method for determining which source points to consider for each destination data point. Possible values: `PtSelection.OctantN` (default) closest num_points selected by coordinate-system octants, `PtSelection.NearestN` closest num_points to the destination point, `PtSelection.All` all points in the source zone. num_points (`integer`, optional) – Number of source points to consider for each destination data point if point_selection is `PtSelection.OctantN` or `PtSelection.NearestN`. (default: 8) plot (Plot, optional) – The plot to use when interpolating which determines the dimensionality and spatial variables. By default, the active plot on the active frame will be used.

  Note

  Cartesian 2D and 3D plots only.

  This interpolation method relies on the coordinates, \((x, y)\) for 2D or \((x, y, z)\) for 3D, set for the active (or given) plot which must be either Cartesian2D or Cartesian3D.

  The following example loads a 2D dataset and interpolates the first zone to a new one with a larger grid spacing:

      import os
      import numpy as np
      import tecplot as tp
      from tecplot.constant import *

      # Use interpolation to merge information from two independent zones
      examples_dir = tp.session.tecplot_examples_directory()
      datafile = os.path.join(examples_dir, 'SimpleData', 'RainierElevation.plt')
      dataset = tp.data.load_tecplot(datafile)
      # Get list of source zones to use later
      srczones = list(dataset.zones())

      fr = tp.active_frame()
      plot = fr.plot(PlotType.Cartesian2D)
      plot.activate()
      plot.show_contour = True
      plot.show_edge = True

      # Show two section of the plot independently
      plot.contour(0).legend.show = False
      plot.contour(1).legend.show = False
      plot.contour(1).colormap_name = 'Diverging - Blue/Red'
      for scrzone in srczones:
          plot.fieldmap(scrzone).edge.line_thickness = 0.4
      plot.fieldmap(0).contour.flood_contour_group = plot.contour(1)

      # export image of original data
      tp.export.save_png('interpolate_2d_source.png', 600, supersample=3)

      # use the first zone as the source, and get the range of (x, y)
      xvar = plot.axes.x_axis.variable
      yvar = plot.axes.y_axis.variable
      ymin, xmin = 99999,99999
      ymax, xmax = -99999,-99999
      for scrzone in srczones:
          curxmin, curxmax = scrzone.values(xvar.index).minmax()
          curymin, curymax = scrzone.values(yvar.index).minmax()
          ymin = min(curymin,ymin)
          ymax = max(curymax,ymax)
          xmin = min(curxmin,xmin)
          xmax = max(curxmax,xmax)

      # create new zone with a coarse grid
      # onto which we will interpolate from the source zone
      xpoints = 40
      ypoints = 40
      newzone = dataset.add_ordered_zone('Interpolated', (xpoints, ypoints))

      # setup the (x, y) positions of the new grid
      xx = np.linspace(xmin, xmax, xpoints)
      yy = np.linspace(ymin, ymax, ypoints)
      YY, XX = np.meshgrid(yy, xx, indexing='ij')
      newzone.values(xvar.index)[:] = XX.ravel()
      newzone.values(yvar.index)[:] = YY.ravel()

      # perform linear interpolation from the source to the new zone
      tp.data.operate.interpolate_inverse_distance(newzone, source_zones=srczones)

      # show the new zone's data, hide the source
      plot.fieldmap(newzone).show = True
      plot.fieldmap(newzone).contour.show = True
      plot.fieldmap(newzone).contour.flood_contour_group = plot.contour(0)
      plot.fieldmap(newzone).edge.show = True
      plot.fieldmap(newzone).edge.line_thickness = .4
      plot.fieldmap(newzone).edge.color = Color.Orange

      for scrzone in srczones:
          plot.fieldmap(scrzone).show = False

      # export image of interpolated data
      tp.export.save_png('interpolate_invdst_2d_dest.png', 600, supersample=3)

  Source data.

  Interpolated data.

### data.operate.interpolate_kriging()

`tecplot.data.operate.``interpolate_kriging`(destination_zone, source_zones=None, variables=None, krig_range=0.3, zero_value=0.0, drift=<Drift.Linear: 1>, point_selection=<PtSelection.OctantN: 2>, num_points=8, plot=None)

  Kriging interpolation onto a destination zone.

  Parameters: | destination_zone (zone or `integer`) – The destination zone (or zone index) for interpolation. source_zones (zones or `integers`, optional) – Zones (or zone indices) used to obtain the field values for interpolation. By default, all zones except the destination_zone will be used. All source zones must be FE-Tetra, FE-Brick or be IJK-ordered when doing linear interpolation in 3D. variables (`variables` or `integers`, optional) – Variables (or variable indices) to interpolate. By default, all variables except those assigned to the axes will be used and is in general dependent on the active plot type of the frame. krig_range (`float`, optional) – Distance beyond which source points become insignificant. Must be between zero and one, inclusive. (default: 0.3) zero_value (`float`, optional) – Semi-variance at each source data point on a normalized scale from zero to one. (default: 0.0) drift (`Drift`, optional) – Overall trend for the data. Possible values: `Drift.None_` no trend, `Drift.Linear` (default) linear trend, `Drift.Quad` quadratic trend. point_selection (`PtSelection`, optional) – Method for determining which source points to consider for each destination data point. Possible values: `PtSelection.OctantN` (default) closest num_points selected by coordinate-system octants, `PtSelection.NearestN` closest num_points to the destination point, `PtSelection.All` all points in the source zone. num_points (`integer`, optional) – Number of source points to consider for each destination data point if point_selection is `PtSelection.OctantN` or `PtSelection.NearestN`. (default: 8) plot (Plot, optional) – The plot to use when interpolating which determines the dimensionality and spatial variables. By default, the active plot on the active frame will be used.

  Note

  Cartesian 2D and 3D plots only.

  This interpolation method relies on the coordinates, \((x, y)\) for 2D or \((x, y, z)\) for 3D, set for the active (or given) plot which must be either Cartesian2D or Cartesian3D.

  The following example loads a 2D dataset and interpolates the first zone to a new one with a larger grid spacing:

      import os
      import numpy as np
      import tecplot as tp
      from tecplot.constant import *

      # Use interpolation to merge information from two independent zones
      examples_dir = tp.session.tecplot_examples_directory()
      datafile = os.path.join(examples_dir, 'SimpleData',
                              'RainierElevation.plt')
      dataset = tp.data.load_tecplot(datafile)
      # Get list of source zones to use later
      srczones = list(dataset.zones())

      fr = tp.active_frame()
      plot = fr.plot(PlotType.Cartesian2D)
      plot.activate()
      plot.show_contour = True
      plot.show_edge = True

      # Show two section of the plot independently
      plot.contour(0).legend.show = False
      plot.contour(1).legend.show = False
      plot.contour(1).colormap_name = 'Diverging - Blue/Red'
      for scrzone in srczones:
          plot.fieldmap(scrzone).edge.line_thickness = 0.4
      plot.fieldmap(0).contour.flood_contour_group = plot.contour(1)

      # export image of original data
      tp.export.save_png('interpolate_2d_source.png', 600, supersample=3)

      # use the first zone as the source, and get the range of (x, y)
      xvar = plot.axes.x_axis.variable
      yvar = plot.axes.y_axis.variable
      ymin, xmin = 99999,99999
      ymax, xmax = -99999,-99999
      for scrzone in srczones:
          curxmin, curxmax = scrzone.values(xvar.index).minmax()
          curymin, curymax = scrzone.values(yvar.index).minmax()
          ymin = min(curymin,ymin)
          ymax = max(curymax,ymax)
          xmin = min(curxmin,xmin)
          xmax = max(curxmax,xmax)

      # create new zone with a coarse grid
      # onto which we will interpolate from the source zone
      xpoints = 20
      ypoints = 20
      newzone = dataset.add_ordered_zone('Interpolated', (xpoints, ypoints))

      # setup the (x, y) positions of the new grid
      xx = np.linspace(xmin, xmax, xpoints)
      yy = np.linspace(ymin, ymax, ypoints)
      YY, XX = np.meshgrid(yy, xx, indexing='ij')
      newzone.values(xvar.index)[:] = XX.ravel()
      newzone.values(yvar.index)[:] = YY.ravel()

      # perform linear interpolation from the source to the new zone
      tp.data.operate.interpolate_kriging(newzone, source_zones=srczones,
                                          drift=Drift.None_, num_points=1)

      # show the new zone's data, hide the source
      plot.fieldmap(newzone).show = True
      plot.fieldmap(newzone).contour.show = True
      plot.fieldmap(newzone).contour.flood_contour_group = plot.contour(0)
      plot.fieldmap(newzone).edge.show = True
      plot.fieldmap(newzone).edge.line_thickness = .4
      plot.fieldmap(newzone).edge.color = Color.Orange

      for scrzone in srczones:
          plot.fieldmap(scrzone).show = False

      # export image of interpolated data
      tp.export.save_png('interpolate_krig_2d_dest.png', 600, supersample=3)

  Source data.

  Interpolated data.

## Data Extractions

### data.extract.extract_line()

`tecplot.data.extract.``extract_line`(points, num_points=None, frame=None, dataset=None)

  Create new zone from a line in the dataset.

  Parameters: | points (`2D numeric array`) – The points defining the line in two or three dimensions. This array must be of the shape (N, D) where N is the number points and D is the number of dimensions. That is, it must take the form `[(x0, y0, z0), (x1, y1, z1) ...]`. Points that do not lie within the dataset volume will be removed from the resulting zone. num_points (`integer`, optional) – The number of points to evenly distribute along the polyline. (default: length of points or N) frame (`Frame`, optional) – A `Frame` that holds the `Dataset` to operate on which must match dataset if given. (default: currently active `Frame`) dataset (`Dataset`, optional) – The `Dataset` to operate on which must be attached to frame if given. (default: currently active `Dataset`)
  Returns: | A 1D `OrderedZone` representing a line through the data. Points outside of the dataset will be removed from the extracted zone resulting in fewer points than input.

  Warning

  Line extraction is only available when the plot type is set to `Cartesian2D` or `Cartesian3D`:

      >>> from tecplot.constant import PlotType
      >>> frame.plot_type = PlotType.Cartesian3D

  This example shows how to extract a zone along a line, overlaying the result in a new frame:

      import numpy as np
      from os import path

      import tecplot as tp
      from tecplot.constant import *

      examples_dir = tp.session.tecplot_examples_directory()
      datafile = path.join(examples_dir, 'SimpleData', 'VortexShedding.plt')
      dataset = tp.data.load_tecplot(datafile)

      frame = tp.active_frame()
      frame.activate()
      plot = frame.plot()
      plot.contour(0).variable = dataset.variable("P(N/M2)")
      plot.show_contour = True
      plot.contour(0).levels.reset(num_levels=11)
      plot.contour(0).colormap_name = 'Sequential - Yellow/Green/Blue'

      plot.axes.y_axis.min = -0.01
      plot.axes.y_axis.max = 0.01
      plot.axes.x_axis.min = -0.005
      plot.axes.x_axis.max = 0.015

      xx = np.linspace(0, 0.01, 100)
      yy = np.zeros(100)
      line = tp.data.extract.extract_line(zip(xx, yy))

      plot.show_mesh = True
      plot.fieldmap(0).mesh.show = False

      frame = tp.active_page().add_frame()
      frame.position = (3.0, 0.5)
      frame.height = 2
      frame.width = 4
      plot = tp.active_frame().plot(PlotType.XYLine)
      plot.activate()

      plot.delete_linemaps()
      lmap = plot.add_linemap('data', line, x=dataset.variable('P(N/M2)'),
                              y=dataset.variable('T(K)'))
      lmap.line.line_thickness = 2.0
      plot.axes.x_axis(0).title.font.size = 10
      plot.axes.y_axis(0).title.font.size = 10
      plot.axes.viewport.left = 20
      plot.axes.viewport.bottom = 20
      plot.view.fit()

      tp.export.save_png("extract_line.png", region=ExportRegion.AllFrames,
                         width=600, supersample=3)

### data.extract.extract_slice()

`tecplot.data.extract.``extract_slice`(origin=(0, 0, 0), normal=(0, 0, 1), source=None, multiple_zones=None, copy_cell_centers=None, assign_strand_ids=None, frame=None, dataset=None)

  Create new zone from a plane in the dataset.

  Parameters: | origin (array of three `floats`) – Point in space, \((x, y, z)\), that lies on the slice plane. normal (array of three `floats`) – Vector direction, \((x, y, z)\), indicating the normal of the slice plane. source (`SliceSource`) – Source zone types to consider when extracting the slice. Possible values: `SliceSource.LinearZones`, `SliceSource.SurfaceZones`, `SliceSource.SurfacesOfVolumeZones`, `SliceSource.VolumeZones` (default). multiple_zones (`boolean`) – If `True`, this allows the extracted slice to consist of one zone per contiguous region. By default, only a single zone is created. (default: `False`) copy_cell_centers (`boolean`) – If `True`, cell-center values will be copied when possible to the extracted slice plane. Cell-centers are copied when a variable is cell-centered for all the source zones through which the slice passes. Otherwise, extracted planes use node-centered data, which is calculated by interpolation. (default: `False`) assign_strand_ids (`boolean`) – automatically assign strand IDs to the data extracted from transient sources. This is only available if multiple_zones is `False`. (default: `True`) frame (`Frame`, optional) – A `Frame` that holds the `Dataset` to operate on which must match dataset if given. (default: currently active `Frame`) dataset (`Dataset`, optional) – The `Dataset` to operate on which must be attached to frame if given. (default: currently active `Dataset`)
  Returns: | One or a `list` of Zones representing a planar slice.

  Warning

  Slicing is only available when the plot type is set to 3D:

      >>> from tecplot.constant import PlotType
      >>> frame.plot_type = PlotType.Cartesian3D

  Note

  This function returns a list of zones if multiple_zones is set to `True`. Otherwise, a single zone is returned.

  This example shows extracting a slice zone from the surface a wing:

      import os
      import tecplot as tp
      from tecplot.constant import PlotType, SliceSource

      examples_dir = tp.session.tecplot_examples_directory()
      datafile = os.path.join(examples_dir, 'OneraM6wing',
                              'OneraM6_SU2_RANS.plt')
      dataset = tp.data.load_tecplot(datafile)

      frame = tp.active_frame()
      frame.plot_type = PlotType.Cartesian3D

      # set active plot to 3D and extract
      # an arbitrary slice from the surface
      # data on the wing
      extracted_slice = tp.data.extract.extract_slice(
          origin=(0, 0.25, 0),
          normal=(0, 1, 0),
          source=SliceSource.SurfaceZones,
          dataset=dataset)

      # switch plot type in current frame, clear plot
      plot = frame.plot(PlotType.XYLine)
      plot.activate()
      plot.delete_linemaps()

      # create line plot from extracted zone data
      cp_linemap = plot.add_linemap(
          name='Quarter-chord C_p',
          zone=extracted_slice,
          x=dataset.variable('x'),
          y=dataset.variable('Pressure_Coefficient'))

      # set style of linemap plot and
      # update axes limits to show data
      cp_linemap.line.color = tp.constant.Color.Blue
      cp_linemap.line.line_thickness = 0.8
      cp_linemap.y_axis.reverse = True
      plot.view.fit()

      # export image of pressure coefficient as a function of x
      tp.export.save_png('wing_slice_pressure_coeff.png', 600, supersample=3)

## Data Access

- Dataset
- Variable
- Zones
  - tecplot.data.zone
  - OrderedZone
  - ClassicFEZone
  - PolyFEZone
- Array
- Nodemap
- Facemap
- FaceNeighbors

### Dataset

class `tecplot.data.``Dataset`(uid, frame)

  Table of `Arrays` identified by Zone and `Variable`.

  This is the primary data container within the Tecplot Engine. A `Dataset` can be shared among several `Frames`, though any particular `Dataset` object will have a handle to at least one of them. Any modification of a shared `Dataset` will be reflected in all `Frames` that use it.

  Though a `Dataset` is usually attached to a `Frame` and the plot style associated with that, it can be thought of as independent from any style or plotting representation. Each `Dataset` consists of a list of `Variables` which are used by one or more of a list of Zones. The `Variable` determines the data type, while the Zone determines the layout such as shape and ordered vs unordered.

  The actual data are found at the intersection of a Zone and `Variable` and the resulting object is an `Array`. The data array can be obtained using either path:

      >>> # These two lines obtain the same object "x"
      >>> x = dataset.zone('My Zone').values('X')
      >>> x = dataset.variable('X').values('My Zone')

  A `Dataset` is the object returned by most data-loading operations in PyTecplot:

      >>> dataset = tecplot.data.load_tecplot('my_data.plt')

  Under `Dataset`, there are a number methods to create and delete Zones and `variables`.

  Attributes

  `VariablesNamedTuple` | A `collections.namedtuple` object using variable names.
  `aux_data` | Auxiliary data for this dataset.
  `num_solution_times` | Number of solution times for all zones in the dataset.
  `num_variables` | Number of `Variables` in this `Dataset`.
  `num_zones` | Number of Zones in this `Dataset`.
  `solution_times` | `List` of solution times for all zones in the dataset.
  `title` | Title of this `Dataset`.

  Methods

  `add_fe_zone`(zone_type, name, num_points, …) | Add a single finite-element Zone to this `Dataset`.
  `add_ordered_zone`(name, shape, **kwargs) | Add a single ordered Zone to this `Dataset`.
  `add_poly_zone`(zone_type, name, num_points, …) | Add a single polygonal Zone to this `Dataset`.
  `add_variable`(name[, dtypes, locations]) | Add a single `Variable` to the active `Dataset`.
  `add_zone`(zone_type, name, shape[, dtypes, …]) | Add a single Zone to this `Dataset`.
  `branch_connectivity`(zones) | Breaks connectivity sharing between zones.
  `branch_variables`(zones, variables[, copy_data]) | Breaks data sharing between zones.
  `copy_zones`(*zones, **kwargs) | Copies Zones within this `Dataset`.
  `delete_variables`(*variables) | Remove `Variables` from this `Dataset`.
  `delete_zones`(*zones) | Remove Zones from this `Dataset`.
  `share_connectivity`(source_zone, …) | Share connectivity between zones.
  `share_variables`(source_zone, …) | Share field data between zones.
  `variable`(pattern) | Returns the `Variable` by index or string pattern.
  `variables`([pattern]) | Yields all `Variables` matching a pattern.
  `zone`(pattern) | Returns Zone by index or string pattern.
  `zones`([pattern]) | Yields all Zones matching a pattern.

`Dataset.``VariablesNamedTuple`

  A `collections.namedtuple` object using variable names.

  The variable names are transformed to be unique, valid identifiers suitable for use as the key-list for a `collections.namedtuple`. This means that all invalid characters such as spaces and dashes are converted to underscores, Python keywords are appended by an underscore, leading numbers or empty names are prepended with a “v” and duplicate variable names are indexed starting with zero, padded left with zeros variable names duplicated more than nine times. The following table gives some specific examples:

  > Variable names | Resulting namedtuple fields
  > --- | ---
  > `'x', 'y'` | `'x', 'y'`
  > `'x', 'x'` | `'x0', 'x1'`
  > `'X', 'Y=f(X)'` | `'X', 'Y_f_X_'`
  > `'x 2', '_', '_'` | `'x_2', 'v0', 'v1'`
  > `'def', 'if'` | `'def_', 'if_'`
  > `'1', '2', '3'` | `'v1', 'v2', 'v3'`

  This example shows how one can use this n-tuple type with the result from a call to `tecplot.data.query.probe_at_position`:

      >>> from os import path
      >>> import tecplot as tp
      >>> examples_dir = tp.session.tecplot_examples_directory()
      >>> datafile = path.join(examples_dir,'SimpleData','DownDraft.plt')
      >>> dataset = tp.data.load_tecplot(datafile)
      >>> result = tp.data.query.probe_at_position(0,0.1,0.3)
      >>> data = dataset.VariablesNamedTuple(*result.data)
      >>> msg = '(RHO, E) = ({:.2f}, {:.2f})'
      >>> print(msg.format(data.RHO, data.E))
      (RHO, E) = (1.17, 252930.37)

`Dataset.``add_fe_zone`(zone_type, name, num_points, num_elements, **kwargs)

  Add a single finite-element Zone to this `Dataset`.

  Parameters: | zone_type (`ZoneType`) – The type of Zone to be created. Possible values are: `FETriangle`, `FEQuad`, `FETetra`, `FEBrick` and `FELineSeg`. name (`string`) – Name of the new Zone. This does not have to be unique. num_points (`integer`) – Number of points (nodes) in this zone. num_elements (`integer`) – Number of elements in this zone. The nodemap will have the shape (num_points, num_elements). **kwargs – These arguments are passed to `Dataset.add_zone`.

  See also

  `Dataset.add_zone`

  Keyword arguments are passed to the parent zone creation method `Dataset.add_zone`.

  Warning

  When connected to a running instance of Tecplot 360 using the TecUtil Server, care must be taken to ensure that the GUI does not try to render the data between the creation of the zone and the setting of the connectivity, through the `Facemap` or `Nodemap` objects. This can be achieved by setting the plot type of the frame(s) holding on to the dataset to `PlotType.Sketch` before creating the zone and only going to `PlotType.Cartesian3D` after the connectivity is set. Tecplot 360 may get into a bad state, corrupting loaded data, if it attempts to render (especially polytope) data without connectivity.

  Note

  When performing many data-manipulation operations including adding zones, adding variables, modifying field data or connectivity, and especially in connected mode, it is recommended to do this all with the `tecplot.session.suspend()`. This will prevent the Tecplot engine from trying to “keep up” with the changes. Tecplot will be notified of all changes made upon exit of this context. This may result in significant performance gains for long operations. See the documentation for `tecplot.session.suspend()` for more information.

  The number of points (also known as nodes) per finite-element is determined from the `zone_type` parameter. The follow table shows the number of points per element for the available zone types along with the resulting shape of the nodemap based on the number of points specified (\(N\)):

  > Zone Type | Points/Element | Nodemap Shape
  > --- | --- | ---
  > `FELineSeg` | 2 | (\(N\), \(2 N\))
  > `FETriangle` | 3 | (\(N\), \(3 N\))
  > `FEQuad` | 4 | (\(N\), \(4 N\))
  > `FETetra` | 4 | (\(N\), \(4 N\))
  > `FEBrick` | 8 | (\(N\), \(8 N\))

  For more details, see the “working with datasets” examples shipped with PyTecplot in the Tecplot 360 distribution.

`Dataset.``add_ordered_zone`(name, shape, **kwargs)

  Add a single ordered Zone to this `Dataset`.

  Parameters: | name (`string`) – Name of the new Zone. This does not have to be unique. shape (`integer` or `list` of `integers`) – Specifies the length and dimension (i, j, k) of the new Zone. A 1D Zone is assumed if a single `int` is given. **kwargs – These arguments are passed to `Dataset.add_zone`.

  See also

  `Dataset.add_zone`

  Keyword arguments are passed to the parent zone creation method `Dataset.add_zone`.

  Note

  When performing many data-manipulation operations including adding zones, adding variables, modifying field data or connectivity, and especially in connected mode, it is recommended to do this all with the `tecplot.session.suspend()`. This will prevent the Tecplot engine from trying to “keep up” with the changes. Tecplot will be notified of all changes made upon exit of this context. This may result in significant performance gains for long operations. See the documentation for `tecplot.session.suspend()` for more information.

  This example creates a 10x10x10 ordered zone of double-precision floating-point numbers:

      >>> from tecplot.constant import FieldDataType
      >>> my_zone = dataset.add_zone('My Zone', (10, 10, 10),
      ...                            dtype=FieldDataType.Double)

  Here is a full example:

      import numpy as np
      import tecplot as tp
      from tecplot.constant import PlotType, Color

      # Generate data
      x = np.linspace(-4, 4, 100)

      # Setup Tecplot dataset
      dataset = tp.active_frame().create_dataset('Data', ['x', 'y'])

      # Create a zone
      zone = dataset.add_ordered_zone('sin(x)', len(x))
      zone.values('x')[:] = x
      zone.values('y')[:] = np.sin(x)

      # Create another zone
      zone = dataset.add_ordered_zone('cos(x)', len(x))
      zone.values('x')[:] = x
      zone.values('y')[:] = np.cos(x)

      # And one more zone
      zone = dataset.add_ordered_zone('tan(x)', len(x))
      zone.values('x')[:] = x
      zone.values('y')[:] = np.tan(x)

      # Set plot type to XYLine
      plot = tp.active_frame().plot(PlotType.XYLine)
      plot.activate()

      # Show all linemaps and make the lines a bit thicker
      for lmap in plot.linemaps():
          lmap.show = True
          lmap.line.line_thickness = 0.6

      plot.legend.show = True

      tp.export.save_png('add_ordered_zones.png', 600, supersample=3)

`Dataset.``add_poly_zone`(zone_type, name, num_points, num_elements, num_faces, **kwargs)

  Add a single polygonal Zone to this `Dataset`.

  Parameters: | zone_type (`ZoneType`) – The type of Zone to be created. Possible values are: `FEPolyhedron` and `FEPolygon`. name (`string`) – Name of the new Zone. This does not have to be unique. num_points (`integer`) – Number of points in this zone. num_elements (`integer`) – Number of elements in this zone. num_faces (`integer`) – Number of faces in this zone. **kwargs – These arguments are passed to `Dataset.add_zone`.

  See also

  `Dataset.add_zone`

  Keyword arguments are passed to the parent zone creation method `Dataset.add_zone`.

  Warning

  When connected to a running instance of Tecplot 360 using the TecUtil Server, care must be taken to ensure that the GUI does not try to render the data between the creation of the zone and the setting of the connectivity, through the `Facemap` or `Nodemap` objects. This can be achieved by setting the plot type of the frame(s) holding on to the dataset to `PlotType.Sketch` before creating the zone and only going to `PlotType.Cartesian3D` after the connectivity is set. Tecplot 360 may get into a bad state, corrupting loaded data, if it attempts to render (especially polytope) data without connectivity.

  Note

  When performing many data-manipulation operations including adding zones, adding variables, modifying field data or connectivity, and especially in connected mode, it is recommended to do this all with the `tecplot.session.suspend()`. This will prevent the Tecplot engine from trying to “keep up” with the changes. Tecplot will be notified of all changes made upon exit of this context. This may result in significant performance gains for long operations. See the documentation for `tecplot.session.suspend()` for more information.

  Note

  The num_faces is the number of unique faces.

  The number of unique faces, given an element map can be obtained using the following function for polygon data:

      def num_unique_faces(elementmap):
          return len(set( tuple(sorted([e[i], e[(i+1)%len(e)]]))
                      for e in elementmap for i in range(len(e)) ))

  This function creates a unique set of node pairs (edges around the polygons) and counts them. For polyhedron data, the following can be used:

      def num_unique_faces(elementmap):
          return len(set( tuple(sorted(f)) for e in elementmap
                                           for f in e ))

  which merely counts the number of unique faces defined in the element map.

  For more details, see the “working with datasets” examples shipped with PyTecplot in the Tecplot 360 distribution.

`Dataset.``add_variable`(name, dtypes=None, locations=None)

  Add a single `Variable` to the active `Dataset`.

  Parameters: | name (`string`) – The name of the new `Variable`. This does not have to be unique. dtypes (`FieldDataType` or `list` of `FieldDataType`, optional) – Data types of this `Variable` for each Zone in the currently active `Dataset`. Options are: `FieldDataType.Float`, `Double`, `Int32`, `Int16`, `Byte` and `Bit`. If a single value, this will be duplicated for all Zones. (default: `None`) locations (`ValueLocation` or `list` of `ValueLocation`, optional) – Point locations of this `Variable` for each Zone in the currently active `Dataset`. Options are: `Nodal` and `CellCentered`. If a single value, this will be duplicated for all Zones. (default: `None`)
  Returns: | `Variable`

  Note

  When performing many data-manipulation operations including adding zones, adding variables, modifying field data or connectivity, and especially in connected mode, it is recommended to do this all with the `tecplot.session.suspend()`. This will prevent the Tecplot engine from trying to “keep up” with the changes. Tecplot will be notified of all changes made upon exit of this context. This may result in significant performance gains for long operations. See the documentation for `tecplot.session.suspend()` for more information.

  The added `Variable` will be available for use in each Zone of the dataset. This method should be used in conjunction with other data creation methods such as `Dataset.add_zone`:

      import math
      import tecplot as tp
      from tecplot.constant import PlotType

      # Setup Tecplot dataset
      dataset = tp.active_frame().create_dataset('Data')
      dataset.add_variable('x')
      dataset.add_variable('s')
      zone = dataset.add_ordered_zone('Zone', 100)

      # Fill the dataset
      x = [0.1 * i for i in range(100)]
      zone.values('x')[:] = x
      zone.values('s')[:] = [math.sin(i) for i in x]

      # Set plot type to XYLine
      tp.active_frame().plot(PlotType.XYLine).activate()

      tp.export.save_png('add_variables.png', 600, supersample=3)

`Dataset.``add_zone`(zone_type, name, shape, dtypes=None, locations=None, face_neighbor_mode=None, parent_zone=None, solution_time=None, strand_id=None, index=None)

  Add a single Zone to this `Dataset`.

  Parameters: | zone_type (`ZoneType`) – The type of Zone to be created. Possible values are: `Ordered`, `FETriangle`, `FEQuad`, `FETetra`, `FEBrick`, `FELineSeg`, `FEPolyhedron` and `FEPolygon`. name (`string`) – Name of the new Zone. This does not have to be unique. shape (`integer` or `list` of `integers`) – Specifies the length and dimension (up to three) of the new Zone. A 1D Zone is assumed if a single `int` is given. This is (i, j, k) for ordered Zones, (num_points, num_elements) for finite-element Zones and (num_points, num_elements, num_faces) for polytope Zones where the number of faces is known. dtypes (`FieldDataType`, `list` of `FieldDataType`, optional) – Data types of this Zone for each `Variable` in the currently active `Dataset`. Options are: `Float`, `Double`, `Int32`, `Int16`, `Byte` and `Bit`. If a single value, this will be duplicated for all `Variables`. If `None` then the type of the first `Variable`, defaulting to `FieldDataType.Float`, is used for all. (default: `None`) locations (`ValueLocation`, `list` of `ValueLocation`, optional) – Point locations of this Zone for each `Variable` in the currently active `Dataset`. Options are: `Nodal` and `CellCentered`. If a single value, this will be duplicated for all `Variables`. If `None` then the type of the first `Variable`, defaulting to `Nodal`, is used for all. (default: `None`) face_neighbor_mode (`FaceNeighborMode`, optional) – Specifies the face-neighbor mode for this zone. Options are: `FaceNeighborMode.LocalOneToOne` (default), `FaceNeighborMode.LocalOneToMany`, `FaceNeighborMode.GlobalOneToOne` or `FaceNeighborMode.GlobalOneToMany`. parent_zone (Zone, optional) – A parent Zone to be used when generating surface-restricted streamtraces. solution_time (`float`, optional) – Solution time for this zone. (default: 0) strand_id (`integer`, optional) – Associate this new Zone with a particular strand. index (`integer`, optional) – Number of the zone to add or replace. If omitted or set to `None`, the new zone will be appended to the dataset. This value can be set to the number of a zone that already exists thereby replacing the existing zone. (default: `None`)
  Returns: | Zone

  Warning

  When connected to a running instance of Tecplot 360 using the TecUtil Server, care must be taken to ensure that the GUI does not try to render the data between the creation of the zone and the setting of the connectivity, through the `Facemap` or `Nodemap` objects. This can be achieved by setting the plot type of the frame(s) holding on to the dataset to `PlotType.Sketch` before creating the zone and only going to `PlotType.Cartesian3D` after the connectivity is set. Tecplot 360 may get into a bad state, corrupting loaded data, if it attempts to render (especially polytope) data without connectivity.

  Note

  When performing many data-manipulation operations including adding zones, adding variables, modifying field data or connectivity, and especially in connected mode, it is recommended to do this all with the `tecplot.session.suspend()`. This will prevent the Tecplot engine from trying to “keep up” with the changes. Tecplot will be notified of all changes made upon exit of this context. This may result in significant performance gains for long operations. See the documentation for `tecplot.session.suspend()` for more information.

  The added Zone will be able to use all `Variables` defined in the dataset. This method should be used in conjunction with other data creation methods such as `Frame.create_dataset`. Example usage:

      >>> from tecplot.constant import ZoneType
      >>> zone = dataset.add_zone(ZoneType.Ordered, 'Zone', (10, 10, 10))

  Note

  The relationship and meaning of this method’s parameters change depending on the type of zone being created. Therefore, it is recommended to use the more specific zone creation methods:

  > - `Dataset.add_ordered_zone`
  > - `Dataset.add_fe_zone`
  > - `Dataset.add_poly_zone`

`Dataset.``aux_data`

  Auxiliary data for this dataset.

  Returns: | `AuxData`

  This is the auxiliary data attached to the dataset. Such data is written to the layout file by default and can be retrieved later. Example usage:

      >>> frame = tp.active_frame()
      >>> aux = frame.dataset.aux_data
      >>> aux['Result'] = '3.14159'
      >>> print(aux['Result'])
      3.14159

`Dataset.``branch_connectivity`(zones)

  Breaks connectivity sharing between zones.

  Parameters: | zones (`list` of Zones) – Zones to be branched.

  See also

  `Dataset.share_connectivity()`

  Example usage:

      >>> z = dataset.zone('My Zone')
      >>> zcopy = z.copy()
      >>> print([zn.index for zn in z.shared_connectivity])
      [0,1]
      >>> dataset.branch_connectivity(zcopy)
      >>> print([zn.index for zn in z.shared_connectivity])
      []

`Dataset.``branch_variables`(zones, variables, copy_data=True)

  Breaks data sharing between zones.

  Parameters: | zones (`list` of Zones) – Zones to be branched. variables (`list` of `Variables`) – Variables to be branched. copy_data (`bool`, optional) – Allocate space for the branched values and copy the data. If `False`, the new variables will be passive. (default: `True`)

  See also

  `Dataset.share_variables()`

  Example usage:

      >>> z = dataset.zone('My Zone')
      >>> zcopy = z.copy(share_variables=True)
      >>> print([zn.index for zn in z.values(0).shared_zones])
      [0,1]
      >>> dataset.branch_variables(zcopy,dataset.variable(0))
      >>> print([zn.index for zn in z.values(0).shared_zones])
      []
      >>> print([zn.index for zn in z.values(1).shared_zones])
      [0,1]

`Dataset.``copy_zones`(*zones, **kwargs)

  Copies Zones within this `Dataset`.

  Parameters: | *zones (Zone, optional) – Specific Zones to copy. All zones will be copied if none are supplied. shared_variables (`bool` or `list` of `Variables`) – Variables to be shared between original and generated zones. (default: `False`)
  Returns: | `list` of the newly created Zones.

  Note

  When performing many data-manipulation operations including adding zones, adding variables, modifying field data or connectivity, and especially in connected mode, it is recommended to do this all with the `tecplot.session.suspend()`. This will prevent the Tecplot engine from trying to “keep up” with the changes. Tecplot will be notified of all changes made upon exit of this context. This may result in significant performance gains for long operations. See the documentation for `tecplot.session.suspend()` for more information.

  Example usage:

      >>> new_zones = dataset.copy_zones()

`Dataset.``delete_variables`(*variables)

  Remove `Variables` from this `Dataset`.

  Parameters: | *variables (`Variable` or index `integer`) – Variables to remove from this dataset.

      >>> print([v.name for v in dataset.variables()])
      ['X','Y','Z']
      >>> dataset.delete_variables(dataset.variable('Z'))
      >>> print([v.name for v in dataset.variables()])
      ['X','Y']

  Warning

  Deleting `Variables` invalidates iterators referencing them in the containing `Dataset` such as those obtained from `Dataset.variables()`. It is recommended to create a list of the `Variables` you want to delete and to pass that into a single call to `Dataset.delete_variables()`

  Notes

  Multiple `Variables` can be deleted at once, though the last `Variable` can not be deleted. The following example deletes all but the first `Variable` in the `Dataset` (usually `X`):

      >>> # Try to delete all variables:
      >>> dataset.delete_variables(dataset.variables())
      >>> # Dataset requires at least one variable to
      >>> # exist, so it leaves the first one:
      >>> print([v.name for v in dataset.variables()])
      ['X']

`Dataset.``delete_zones`(*zones)

  Remove Zones from this `Dataset`.

  Parameters: | *zones (Zones or index `integers`) – Zones to remove from this dataset.

      >>> print([z.name for z in dataset.zones()])
      ['Zone 1', 'Zone 2']
      >>> dataset.delete_zones(dataset.zone('Zone 2'))
      >>> print([z.name for z in dataset.zones()])
      ['Zone 1']

  Warning

  Deleting Zones invalidates iterators referencing them in the containing `Dataset` such as those obtained from `Dataset.zones()`. It is recommended to create a list of the Zones you want to delete and to pass that into a single call to `Dataset.delete_zones()`

  Notes

  Multiple Zones can be deleted at once, though the last Zone can not be deleted. The following example deletes all but the first Zone in the `Dataset`:

      >>> dataset.delete_zones(dataset.zones())

`Dataset.``num_solution_times`

  Number of solution times for all zones in the dataset.

  Type: | `int` (read-only)

  Example usage:

      >>> print(dataset.num_solution_times)
      10

  New in version 2017.3: Solution time manipulation requires Tecplot 360 2017 R3 or later.

`Dataset.``num_variables`

  Number of `Variables` in this `Dataset`.

  Type: | `integer`

  This count includes disabled variables which were skipped when the data was loaded. Example usage:

      >>> for i in range(dataset.num_variables):
      ...     variable = dataset.variable(i)

`Dataset.``num_zones`

  Number of Zones in this `Dataset`.

  Type: | `integer`

  This count includes disabled zones which were skipped when loading the data. Example usage:

      >>> for i in range(dataset.num_zones):
      ...     zone = dataset.zone(i)

`Dataset.``share_connectivity`(source_zone, destination_zones)

  Share connectivity between zones.

  This method links the connectivity (`nodemap` or `facemap`) of the destination zones to the connectivity of the source zone. Modifying the connectivity of one zone will affect all others in this group.

  Parameters: | source_zone (Zone) – Zone which provides data to be shared. destination_zones (`list` of Zones) – Zones where connectivity list will be overwritten.

  See also

  `Dataset.branch_connectivity()`

  Example usage:

      >>> z = dataset.zone('My Zone')
      >>> zcopy = z.copy()
      >>> print([zn.index for zn in z.shared_connectivity])
      [0,1]
      >>> dataset.branch_connectivity(zcopy)
      >>> print([zn.index for zn in z.shared_connectivity])
      []
      >>> dataset.share_connectivity(z,zcopy)
      >>> print([zn.index for zn in z.shared_connectivity])
      [0,1]

`Dataset.``share_variables`(source_zone, destination_zones, variables)

  Share field data between zones.

  This method links the underlying data `arrays` of the destination zones to the data of the source zone. Modifying the array data of one zone will affect all others in this group.

  Parameters: | source_zone (Zone) – Zone which provides data to be shared. destination_zones (`list` of Zones) – Zones where data will be overwritten. variables (`list` of `Variables`) – Variables to be branched.

  See also

  `Dataset.branch_variables()`

  Example usage:

      >>> z = dataset.zone('My Zone')
      >>> zcopy = z.copy(share_variables=False)
      >>> print([zn.index for zn in z.values(0).shared_zones])
      []
      >>> dataset.share_variables(zcopy,[z],[dataset.variable(0)])
      >>> print([zn.index for zn in z.values(0).shared_zones])
      [0,1]
      >>> print([zn.index for zn in z.values(1).shared_zones])
      []

`Dataset.``solution_times`

  `List` of solution times for all zones in the dataset.

  Type: | `list` of `floats` (read-only)

  Example usage:

      >>> print(dataset.solution_times)
      [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]

  New in version 2017.3: Solution time manipulation requires Tecplot 360 2017 R3 or later.

`Dataset.``title`

  Title of this `Dataset`.

  Type: | `string`

  Example usage:

      >>> dataset.title = 'My Data'

  Changed in version 2017.3: of Tecplot 360 The dataset title property requires Tecplot 360 2017 R3 or later.

`Dataset.``variable`(pattern)

  Returns the `Variable` by index or string pattern.

  Parameters: | pattern (`integer` or `string`) – Zero-based index or `glob-style pattern` in which case, the first match is returned.
  Raises: | `TecplotIndexError`

  The `Variable.name` attribute is used to match the pattern to the desired `Variable` though this is not necessarily unique:

      >>> ds = frame.dataset
      >>> print(ds)
      Dataset:
        Zones: ['Rectangular zone']
        Variables: ['x', 'y', 'z']
      >>> x = ds.variable('x')
      >>> x == ds.variable(0)
      True

`Dataset.``variables`(pattern=None)

  Yields all `Variables` matching a pattern.

  Parameters: | pattern (`string` pattern, optional) – `glob-style pattern` used to match variable names or `None` which will return all variables. (default: `None`)

  Example usage:

      >>> for variable in dataset.variables('A*'):
      ...     array = variable.values('My Zone')

`Dataset.``zone`(pattern)

  Returns Zone by index or string pattern.

  Parameters: | pattern (`integer` or `string`) – Zero-based index or `glob-style pattern` in which case, the first match is returned.
  Returns: | `OrderedZone`, `ClassicFEZone` or `PolyFEZone` depending on the zone type.
  Raises: | `TecplotIndexError`

  The `Zone.name` attribute is used to match the pattern to the desired Zone though this is not necessarily unique:

      >>> ds = frame.dataset
      >>> print(ds)
      Dataset:
        Zones: ['Rectangular zone']
        Variables: ['x', 'y', 'z']
      >>> rectzone = ds.zone('Rectangular zone')
      >>> rectzone == ds.zone(0)
      True

`Dataset.``zones`(pattern=None)

  Yields all Zones matching a pattern.

  Parameters: | pattern (`string` pattern, optional) – `glob-style pattern` used to match zone names or `None` which will return all zones. (default: `None`)
  Returns: | `OrderedZone`, `ClassicFEZone` or `PolyFEZone` depending on the zone type.

  Example usage:

      >>> for zone in dataset.zones('A*'):
      ...     x_array = zone.variable('X')

  Use list comprehension to construct a list of all zones with ‘Wing’ in the zone name:

      >>> wing_zones = [Z for Z in dataset.zones() if 'Wing' in Z.name]

### Variable

class `tecplot.data.``Variable`(uid, dataset)

  Key value for a data array within a `Dataset`.

  `Variables` can be identified (uniquely) by the index within their parent `Dataset` or (non-uniquely) by name. In general, a Zone must also be selected to access the underlying data array. This object is used by several style controlling classes such as contours and vectors. The following example sets the contour variable for the first contour group to the first variable named ‘S’:

      >>> plot.contour(0).variable = dataset.variable('S')

  Attributes

  `aux_data` | Auxiliary data for this variable.
  `index` | Zero-based position within the parent `Dataset`.
  `name` | Returns or sets the name.
  `num_zones` | Number of Zones in the parent `Dataset`.

  Methods

  `max`() | Upper bound of the values stored in this variable across all zones.
  `min`() | Lower bound of the values stored in this variable across all zones.
  `minmax`() | Limits of the values stored in this variable across all zones.
  `values`(pattern) | Returns `Array` by index or string pattern.

`Variable.``aux_data`

  Auxiliary data for this variable.

  Returns: | `AuxData`

  This is the auxiliary data attached to the variable. Such data is written to the layout file by default and can be retrieved later. Example usage:

      >>> frame = tp.active_frame()
      >>> aux = frame.dataset.variable('X').aux_data
      >>> aux['X_weighted_avg'] = '3.14159'
      >>> print(aux['X_weighted_avg'])
      3.14159

`Variable.``index`

  Zero-based position within the parent `Dataset`.

  Type: | `Index`

  Example usage:

      >>> plot.contour(0).variable_index = dataset.variable('S').index

`Variable.``max`()

  Upper bound of the values stored in this variable across all zones.

  Type: | `float`

  This always returns a `float` regardless of the underlying data type:

      >>> print(dataset.variable('x').max())
      10

`Variable.``min`()

  Lower bound of the values stored in this variable across all zones.

  Type: | `float`

  This always returns a `float` regardless of the underlying data type:

      >>> print(dataset.variable('x').min())
      0

`Variable.``minmax`()

  Limits of the values stored in this variable across all zones.

  Type: | 2-tuple of `floats`

  This always returns `floats` regardless of the underlying data type:

      >>> print(dataset.variable('x').minmax())
      (0, 10)

`Variable.``name`

  Returns or sets the name.

  Type: | `string`

  Example usage:

      >>> print(dataset.variable(0).name)
      X

`Variable.``num_zones`

  Number of Zones in the parent `Dataset`.

  Type: | `integer`

  Example usage, looping over all zones by index:

      >>> for zindex in range(dataset.num_zones):
      ...     zone = dataset.zone(zindex)

`Variable.``values`(pattern)

  Returns `Array` by index or string pattern.

  Parameters: | pattern (`integer` or `string`) – Zero-based index or `glob-style pattern` in which case, the first match is returned, or a Zone object.

  Note

  Data operations can make use of Numpy when installed.

  When doing large data transfers into and out of Tecplot using PyTecplot, it is recommended to install the Python array-processing module Numpy. PyTecplot will automatically use this to optimize data transfers which may result in significant performance gains.

  The `Zone.name` attribute is used to match the pattern to the desired `Array` though this is not necessarily unique:

      >>> ds = frame.dataset
      >>> print(ds)
      Dataset:
        Zones: 'Rectangular zone'
        Variables: 'x', 'y', 'z'
      >>> x = ds.variable('x')
      >>> rectzone = x.values('Rectangular zone')
      >>> rectzone == x.values(0)
      True

### Zones

- tecplot.data.zone
- OrderedZone
- ClassicFEZone
- PolyFEZone

#### tecplot.data.zone

Zones describe the size, shape, element (cell) geometry, connectivity and solution time of arrays in a dataset. Zones created as “ordered,” “classic finite-element,” or “polytopal finite-element” along with the number of nodes and elements which can not be changed (without creating a new zone). Ordered zones are always considered to be logically-rectangular grids of one, two or three dimensions depending on the shape. Classic finite-element zones must use a fixed-type element throughout. This means that each element has the same number of faces and nodes. Polytopal zones can have a varying number of faces and nodes for each element. The connectivity is implied in ordered zones and explicitly provided by the user for finite-element zones.

In PyTecplot, there are three zone class objects: `OrderedZone`, `ClassicFEZone` and `PolyFEZone`. The `OrderedZone` and `ClassicFEZone` classes use the `FaceNeighbors` class to handle “global” face-neighbor connections from one zone to another. The connectivity for the `ClassicFEZone` objects are accessed through the `Nodemap` class. The `PolyFEZone` objects provide element definition and connectivity access through the `Facemap` class.

#### OrderedZone

class `tecplot.data.``OrderedZone`(uid, dataset)

  An ordered `(i, j, k)` zone within a `Dataset`.

  Ordered zones contain nodal or cell-centered arrays where the connectivity is implied by the dimensions and ordering of the data.

  Zones can be identified (uniquely) by the index with their parent `Dataset` or (non-uniquely) by name. In general, a `Variable` must be selected to access the underlying data array. This object is used by fieldmaps and linemaps to apply style to specific zones. Here we obtain the fieldmap associated with the zone named ‘My Zone’:

      >>> fmap = plot.fieldmap(dataset.zone('My Zone'))

  Attributes

  `aux_data` | Auxiliary data for this zone.
  `dimensions` | Nodal dimensions along `(i, j, k)`.
  `face_neighbors` | The face neighbor list for this ordered zone.
  `index` | Zero-based position within the parent `Dataset`.
  `name` | The name of the zone.
  `num_elements` | Number of cells in this zone.
  `num_faces` | Number of faces in this zone.
  `num_faces_per_element` | Number of faces per element in this ordered zone.
  `num_points` | Total number of nodes within this zone.
  `num_points_per_element` | Points per cell for ordered zones.
  `num_variables` | Number of `Variables` in the parent `Dataset`.
  `rank` | Number of dimensions of the data array.
  `solution_time` | The solution time for this zone.
  `strand` | The strand ID number.
  `zone_type` | The `ZoneType` indicating structure of the data contained.

  Methods

  `copy`([share_variables]) | Duplicate this Zone in the parent `Dataset`.
  `values`(pattern) | Returns an `Array` by index or string pattern.

`OrderedZone.``aux_data`

  Auxiliary data for this zone.

  Returns: | `AuxData`

  This is the auxiliary data attached to the zone. Such data is written to the layout file by default and can be retrieved later. Example usage:

      >>> frame = tp.active_frame()
      >>> aux = frame.dataset.zone('My Zone').aux_data
      >>> aux['X_weighted_avg'] = '3.14159'
      >>> print(aux['X_weighted_avg'])
      3.14159

`OrderedZone.``copy`(share_variables=False)

  Duplicate this Zone in the parent `Dataset`.

  The name is also copied but can be changed after duplication.

  Parameters: | share_variables (`bool` or `list` of `Variables`) – Variables to be shared between original and generated zones. If variables are not shared they will be created as passive variables. Default: `False`.
  Returns: | Zone – The newly created zone.

  Example:

      >>> new_zone = dataset.zone('My Zone').copy()
      >>> print(new_zone.name)
      My Zone
      >>> new_zone.name = 'My Zone Copy'
      >>> print(new_zone.name)
      My Zone Copy

`OrderedZone.``dimensions`

  Nodal dimensions along `(i, j, k)`.

  Returns: | `tuple` of `integers` – `(i, j, k)` for ordered data.

  Example usage:

      >>> print(zone.dimensions)
      (128, 128, 128)

`OrderedZone.``face_neighbors`

  The face neighbor list for this ordered zone.

  Type: | `FaceNeighbors`

  Example usage:

      >>> zone = dataset.zone(0)
      >>> print(zone.face_neighbors.mode)
      FaceNeighborMode.LocalOneToOne

`OrderedZone.``index`

  Zero-based position within the parent `Dataset`.

  Type: | `Index`

  This is the value used to obtain a specific zone if you have duplicately named zones in the dataset:

      >>> tp.new_layout()
      >>> frame = tp.active_frame()
      >>> dataset = frame.create_dataset('Dataset', ['x', 'y'])
      >>> dataset.add_ordered_zone('Zone', (10,10,10))
      >>> dataset.add_ordered_zone('Zone', (3,3,3))
      >>> # getting zone by name always returns first match
      >>> print(dataset.zone('Zone').index)
      0
      >>> # use index to get specific zone
      >>> print(dataset.zone(1).dimensions)
      (3, 3, 3)

`OrderedZone.``name`

  The name of the zone.

  Type: | `string`

  Example usage:

      >>> dataset.zone(0).name = 'Zone 0'

`OrderedZone.``num_elements`

  Number of cells in this zone.

  Type: | `integer`

  Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.dimensions)
      (128, 128, 128)
      >>> print(zone.num_elements)
      2048383

`OrderedZone.``num_faces`

  Number of faces in this zone.

  Type: | `integer`

  This is the same as the number of elements times the number of faces per element. Example usage:

      >>> print(dataset.zone('My Zone').num_faces)
      1048576

`OrderedZone.``num_faces_per_element`

  Number of faces per element in this ordered zone.

  Type: | `integer`

  This is determined by the rank of the zone:

  > Rank | Faces Per Element
  > --- | ---
  > 0 | 0
  > 1 | 1
  > 2 | 4
  > 3 | 6

  Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.dimensions)
      (1, 10, 10)
      >>> print(zone.rank)
      2
      >>> print(zone.num_faces_per_element)
      4

`OrderedZone.``num_points`

  Total number of nodes within this zone.

  Type: | `integer`

  This is number of nodes within the zone and is equivalent to the product of the values in `OrderedZone.dimensions`. Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.dimensions)
      (128, 128, 128)
      >>> print(zone.num_points)
      2097152

`OrderedZone.``num_points_per_element`

  Points per cell for ordered zones.

  Type: | `integer`

  For ordered zones, this is \(2^{d}\) where \(d\) is the number of dimensions greater than one:

  > Rank | Faces Per Element
  > --- | ---
  > 0 | 0
  > 1 | 2
  > 2 | 4
  > 3 | 8

  Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.dimensions)
      (10, 10, 1)
      >>> print(zone.rank)
      2
      >>> print(zone.num_points_per_element)
      4

`OrderedZone.``num_variables`

  Number of `Variables` in the parent `Dataset`.

  Type: | `integer`

  Example usage, iterating over all variables by index:

      >>> for i in range(dataset.num_variables):
      ...     variable = dataset.variable(i)

`OrderedZone.``rank`

  Number of dimensions of the data array.

  Type: | `integer`

  This will return the number of dimensions which contain more than one value:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.dimensions)
      (10, 10, 1)
      >>> print(zone.rank)
      2

`OrderedZone.``solution_time`

  The solution time for this zone.

  Type: | `float`

  Example usage:

      >>> dataset.zone('My Zone').solution_time = 3.14

  Note

  Possible side-effect when connected to Tecplot 360.

  Changing the solution times in the dataset or modifying the active fieldmaps in a frame may trigger a change in the active plot’s solution time by the Tecplot 360 interface. This is done to keep the GUI controls consistent. In batch mode, no such side-effect will take place and the user must take care to set the plot’s solution time with the `plot.solution_time` or `plot.solution_timestep` properties.

`OrderedZone.``strand`

  The strand ID number.

  Type: | `integer`

  Example usage:

      >>> dataset.zone('My Zone').strand = 2

  Note

  Possible side-effect when connected to Tecplot 360.

  Changing the solution times in the dataset or modifying the active fieldmaps in a frame may trigger a change in the active plot’s solution time by the Tecplot 360 interface. This is done to keep the GUI controls consistent. In batch mode, no such side-effect will take place and the user must take care to set the plot’s solution time with the `plot.solution_time` or `plot.solution_timestep` properties.

`OrderedZone.``values`(pattern)

  Returns an `Array` by index or string pattern.

  Parameters: | pattern (`integer` or `string`) – Zero-based index, `glob-style pattern` in which case, the first match is returned, or a `Variable` object.

  Note

  Data operations can make use of Numpy when installed.

  When doing large data transfers into and out of Tecplot using PyTecplot, it is recommended to install the Python array-processing module Numpy. PyTecplot will automatically use this to optimize data transfers which may result in significant performance gains.

  The `Variable.name` attribute is used to match the pattern to the desired `Array` though this is not necessarily unique:

      >>> ds = frame.dataset
      >>> print(ds)
      Dataset:
        Zones: ['Rectangular zone']
        Variables: ['x', 'y', 'z']
      >>> zone = ds.zone('Rectangular zone')
      >>> x = zone.values('x')
      >>> x == zone.values(0)
      True

`OrderedZone.``zone_type`

  The `ZoneType` indicating structure of the data contained.

  Type: | `ZoneType`

  The specific type of zone this object represents:

      >>> print(dataset.zone(0).zone_type)
      ZoneType.Ordered

#### ClassicFEZone

class `tecplot.data.``ClassicFEZone`(uid, dataset)

  A classic finite-element zone within a `Dataset`.

  Classic finite-element zones are arrays of nodes that are connected explicitly into pre-defined geometric shapes called “elements.” The geometry is consistent across the whole zone so that the number of nodes per element is constant.

  Zones can be identified (uniquely) by the index with their parent `Dataset` or (non-uniquely) by name. In general, a `Variable` must be selected to access the underlying data array. This object is used by fieldmaps and linemaps to apply style to specific zones. Here we obtain the fieldmap associated with the zone named ‘My Zone’:

      >>> fmap = plot.fieldmap(dataset.zone('My Zone'))

  Attributes

  `aux_data` | Auxiliary data for this zone.
  `face_neighbors` | The face neighbor list for this finite-element zone.
  `index` | Zero-based position within the parent `Dataset`.
  `name` | The name of the zone.
  `nodemap` | The connectivity `Nodemap` for this classic finite-element zone.
  `num_elements` | Number of cells in this finite-element zone.
  `num_faces` | Number of faces in this zone.
  `num_faces_per_element` | Number of faces per element.
  `num_points` | Total number of nodes within this zone.
  `num_points_per_element` | Points per element for classic finite-element zones.
  `num_variables` | Number of `Variables` in the parent `Dataset`.
  `rank` | Number of dimensions of the data array.
  `shared_connectivity` | `list` of Zones sharing connectivity.
  `solution_time` | The solution time for this zone.
  `strand` | The strand ID number.
  `zone_type` | The `ZoneType` indicating structure of the data contained.

  Methods

  `copy`([share_variables]) | Duplicate this Zone in the parent `Dataset`.
  `values`(pattern) | Returns an `Array` by index or string pattern.

`ClassicFEZone.``aux_data`

  Auxiliary data for this zone.

  Returns: | `AuxData`

  This is the auxiliary data attached to the zone. Such data is written to the layout file by default and can be retrieved later. Example usage:

      >>> frame = tp.active_frame()
      >>> aux = frame.dataset.zone('My Zone').aux_data
      >>> aux['X_weighted_avg'] = '3.14159'
      >>> print(aux['X_weighted_avg'])
      3.14159

`ClassicFEZone.``copy`(share_variables=False)

  Duplicate this Zone in the parent `Dataset`.

  The name is also copied but can be changed after duplication.

  Parameters: | share_variables (`bool` or `list` of `Variables`) – Variables to be shared between original and generated zones. If variables are not shared they will be created as passive variables. Default: `False`.
  Returns: | Zone – The newly created zone.

  Example:

      >>> new_zone = dataset.zone('My Zone').copy()
      >>> print(new_zone.name)
      My Zone
      >>> new_zone.name = 'My Zone Copy'
      >>> print(new_zone.name)
      My Zone Copy

`ClassicFEZone.``face_neighbors`

  The face neighbor list for this finite-element zone.

  Type: | `FaceNeighbors`

  Example usage:

      >>> zone = dataset.zone(0)
      >>> print(zone.face_neighbors.mode)
      FaceNeighborMode.LocalOneToMany

`ClassicFEZone.``index`

  Zero-based position within the parent `Dataset`.

  Type: | `Index`

  This is the value used to obtain a specific zone if you have duplicately named zones in the dataset:

      >>> tp.new_layout()
      >>> frame = tp.active_frame()
      >>> dataset = frame.create_dataset('Dataset', ['x', 'y'])
      >>> dataset.add_ordered_zone('Zone', (10,10,10))
      >>> dataset.add_ordered_zone('Zone', (3,3,3))
      >>> # getting zone by name always returns first match
      >>> print(dataset.zone('Zone').index)
      0
      >>> # use index to get specific zone
      >>> print(dataset.zone(1).dimensions)
      (3, 3, 3)

`ClassicFEZone.``name`

  The name of the zone.

  Type: | `string`

  Example usage:

      >>> dataset.zone(0).name = 'Zone 0'

`ClassicFEZone.``nodemap`

  The connectivity `Nodemap` for this classic finite-element zone.

  Type: | `Nodemap`

  Example usage:

      >>> zone = dataset.zone(0)
      >>> print(zone.nodemap.num_points_per_element)
      4

`ClassicFEZone.``num_elements`

  Number of cells in this finite-element zone.

  Type: | `integer`

  Example usage:

      >>> print(dataset.zone('My Zone').num_elements)
      1048576

`ClassicFEZone.``num_faces`

  Number of faces in this zone.

  Type: | `integer`

  This is the same as the number of elements times the number of faces per element. Example usage:

      >>> print(dataset.zone('My Zone').num_faces)
      1048576

`ClassicFEZone.``num_faces_per_element`

  Number of faces per element.

  Type: | `integer`

  This is dependent on the type of element this zone contains:

  > Zone Type | Faces Per Element
  > --- | ---
  > `FELineSeg` | 1
  > `FETriangle` | 3
  > `FEQuad` | 4
  > `FETetra` | 4
  > `FEBrick` | 6

  Example usage:

      >>> print(dataset.zone('My Zone').num_faces_per_element)
      4

`ClassicFEZone.``num_points`

  Total number of nodes within this zone.

  Type: | `integer`

  This is the total number of nodes in the zone. Example usage:

      >>> print(dataset.zone('My Zone').num_points)
      2048

`ClassicFEZone.``num_points_per_element`

  Points per element for classic finite-element zones.

  Type: | `integer`

  The number of points (also known as nodes) per finite-element is determined from the `zone_type` parameter. The follow table shows the number of points per element for the available zone types along with the resulting shape of the nodemap based on the number of points specified (\(N\)):

  > Zone Type | Points/Element | Nodemap Shape
  > --- | --- | ---
  > `FELineSeg` | 2 | (\(N\), \(2 N\))
  > `FETriangle` | 3 | (\(N\), \(3 N\))
  > `FEQuad` | 4 | (\(N\), \(4 N\))
  > `FETetra` | 4 | (\(N\), \(4 N\))
  > `FEBrick` | 8 | (\(N\), \(8 N\))

  Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.zone_type)
      ZoneType.FETriangle
      >>> print(zone.num_points_per_element)
      3

`ClassicFEZone.``num_variables`

  Number of `Variables` in the parent `Dataset`.

  Type: | `integer`

  Example usage, iterating over all variables by index:

      >>> for i in range(dataset.num_variables):
      ...     variable = dataset.variable(i)

`ClassicFEZone.``rank`

  Number of dimensions of the data array.

  Type: | `integer`

  This indicates the dimensionality of the data and is dependent on the type of element this zone contains:

  > Zone Type | Rank
  > --- | ---
  > `FELineSeg` | 1
  > `FETriangle` | 2
  > `FEQuad` | 2
  > `FETetra` | 3
  > `FEBrick` | 3

  Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.zone_type)
      ZoneType.FEBrick
      >>> print(zone.rank)
      3

`ClassicFEZone.``shared_connectivity`

  `list` of Zones sharing connectivity.

  Type: | `list` of Zones

  Example usage:

      >>> dataset.zone('My Zone').copy()
      >>> for zone in dataset.zone('My Zone').shared_connectivity:
      ...     print(zone.index)
      0
      1

`ClassicFEZone.``solution_time`

  The solution time for this zone.

  Type: | `float`

  Example usage:

      >>> dataset.zone('My Zone').solution_time = 3.14

  Note

  Possible side-effect when connected to Tecplot 360.

  Changing the solution times in the dataset or modifying the active fieldmaps in a frame may trigger a change in the active plot’s solution time by the Tecplot 360 interface. This is done to keep the GUI controls consistent. In batch mode, no such side-effect will take place and the user must take care to set the plot’s solution time with the `plot.solution_time` or `plot.solution_timestep` properties.

`ClassicFEZone.``strand`

  The strand ID number.

  Type: | `integer`

  Example usage:

      >>> dataset.zone('My Zone').strand = 2

  Note

  Possible side-effect when connected to Tecplot 360.

  Changing the solution times in the dataset or modifying the active fieldmaps in a frame may trigger a change in the active plot’s solution time by the Tecplot 360 interface. This is done to keep the GUI controls consistent. In batch mode, no such side-effect will take place and the user must take care to set the plot’s solution time with the `plot.solution_time` or `plot.solution_timestep` properties.

`ClassicFEZone.``values`(pattern)

  Returns an `Array` by index or string pattern.

  Parameters: | pattern (`integer` or `string`) – Zero-based index, `glob-style pattern` in which case, the first match is returned, or a `Variable` object.

  Note

  Data operations can make use of Numpy when installed.

  When doing large data transfers into and out of Tecplot using PyTecplot, it is recommended to install the Python array-processing module Numpy. PyTecplot will automatically use this to optimize data transfers which may result in significant performance gains.

  The `Variable.name` attribute is used to match the pattern to the desired `Array` though this is not necessarily unique:

      >>> ds = frame.dataset
      >>> print(ds)
      Dataset:
        Zones: ['Rectangular zone']
        Variables: ['x', 'y', 'z']
      >>> zone = ds.zone('Rectangular zone')
      >>> x = zone.values('x')
      >>> x == zone.values(0)
      True

`ClassicFEZone.``zone_type`

  The `ZoneType` indicating structure of the data contained.

  Type: | `ZoneType`

  The specific type of zone this object represents:

      >>> print(dataset.zone(0).zone_type)
      ZoneType.FEBrick

#### PolyFEZone

class `tecplot.data.``PolyFEZone`(uid, dataset)

  A polygonal finite-element zone within a `Dataset`.

  A polygonal zone consists of arrays of nodes which are connected explicitly into arbitrary and varying geometric elements. These elements are 2D or 3D in nature and have a number of faces (connections between nodes) which hold the concept of a left and right neighbor.

  Zones can be identified (uniquely) by the index with their parent `Dataset` or (non-uniquely) by name. In general, a `Variable` must be selected to access the underlying data array. This object is used by fieldmaps and linemaps to apply style to specific zones. Here we obtain the fieldmap associated with the zone named ‘My Zone’:

      >>> fmap = plot.fieldmap(dataset.zone('My Zone'))

  Attributes

  `aux_data` | Auxiliary data for this zone.
  `facemap` | The connectivity `Facemap` for this polygonal finite-element zone.
  `index` | Zero-based position within the parent `Dataset`.
  `name` | The name of the zone.
  `num_elements` | Number of cells in this finite-element zone.
  `num_faces` | Number of faces in this finite-element zone.
  `num_points` | Total number of nodes within this zone.
  `num_variables` | Number of `Variables` in the parent `Dataset`.
  `rank` | Number of dimensions of the data array.
  `shared_connectivity` | `list` of Zones sharing connectivity.
  `solution_time` | The solution time for this zone.
  `strand` | The strand ID number.
  `zone_type` | The `ZoneType` indicating structure of the data contained.

  Methods

  `copy`([share_variables]) | Duplicate this Zone in the parent `Dataset`.
  `values`(pattern) | Returns an `Array` by index or string pattern.

`PolyFEZone.``aux_data`

  Auxiliary data for this zone.

  Returns: | `AuxData`

  This is the auxiliary data attached to the zone. Such data is written to the layout file by default and can be retrieved later. Example usage:

      >>> frame = tp.active_frame()
      >>> aux = frame.dataset.zone('My Zone').aux_data
      >>> aux['X_weighted_avg'] = '3.14159'
      >>> print(aux['X_weighted_avg'])
      3.14159

`PolyFEZone.``copy`(share_variables=False)

  Duplicate this Zone in the parent `Dataset`.

  The name is also copied but can be changed after duplication.

  Parameters: | share_variables (`bool` or `list` of `Variables`) – Variables to be shared between original and generated zones. If variables are not shared they will be created as passive variables. Default: `False`.
  Returns: | Zone – The newly created zone.

  Example:

      >>> new_zone = dataset.zone('My Zone').copy()
      >>> print(new_zone.name)
      My Zone
      >>> new_zone.name = 'My Zone Copy'
      >>> print(new_zone.name)
      My Zone Copy

`PolyFEZone.``facemap`

  The connectivity `Facemap` for this polygonal finite-element zone.

  Type: | `Facemap`

  Example usage:

      >>> zone = dataset.zone(0)
      >>> print(zone.facemap.num_faces)
      4500

`PolyFEZone.``index`

  Zero-based position within the parent `Dataset`.

  Type: | `Index`

  This is the value used to obtain a specific zone if you have duplicately named zones in the dataset:

      >>> tp.new_layout()
      >>> frame = tp.active_frame()
      >>> dataset = frame.create_dataset('Dataset', ['x', 'y'])
      >>> dataset.add_ordered_zone('Zone', (10,10,10))
      >>> dataset.add_ordered_zone('Zone', (3,3,3))
      >>> # getting zone by name always returns first match
      >>> print(dataset.zone('Zone').index)
      0
      >>> # use index to get specific zone
      >>> print(dataset.zone(1).dimensions)
      (3, 3, 3)

`PolyFEZone.``name`

  The name of the zone.

  Type: | `string`

  Example usage:

      >>> dataset.zone(0).name = 'Zone 0'

`PolyFEZone.``num_elements`

  Number of cells in this finite-element zone.

  Type: | `integer`

  Example usage:

      >>> print(dataset.zone('My Zone').num_elements)
      1048576

`PolyFEZone.``num_faces`

  Number of faces in this finite-element zone.

  Type: | `integer`

  The number of faces may be `0` if unknown or facemap creation is deferred. Example usage:

      >>> print(dataset.zone('My Zone').num_faces)
      1048576

`PolyFEZone.``num_points`

  Total number of nodes within this zone.

  Type: | `integer`

  This is the total number of nodes in the zone. Example usage:

      >>> print(dataset.zone('My Zone').num_points)
      2048

`PolyFEZone.``num_variables`

  Number of `Variables` in the parent `Dataset`.

  Type: | `integer`

  Example usage, iterating over all variables by index:

      >>> for i in range(dataset.num_variables):
      ...     variable = dataset.variable(i)

`PolyFEZone.``rank`

  Number of dimensions of the data array.

  Type: | `integer`

  This indicates the dimensionality of the data and is dependent on the type of element this zone contains:

  > Zone Type | Rank
  > --- | ---
  > `FEPolygon` | 2
  > `FEPolyhedron` | 3

  Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.zone_type)
      ZoneType.FEPolygon
      >>> print(zone.rank)
      2

`PolyFEZone.``shared_connectivity`

  `list` of Zones sharing connectivity.

  Type: | `list` of Zones

  Example usage:

      >>> dataset.zone('My Zone').copy()
      >>> for zone in dataset.zone('My Zone').shared_connectivity:
      ...     print(zone.index)
      0
      1

`PolyFEZone.``solution_time`

  The solution time for this zone.

  Type: | `float`

  Example usage:

      >>> dataset.zone('My Zone').solution_time = 3.14

  Note

  Possible side-effect when connected to Tecplot 360.

  Changing the solution times in the dataset or modifying the active fieldmaps in a frame may trigger a change in the active plot’s solution time by the Tecplot 360 interface. This is done to keep the GUI controls consistent. In batch mode, no such side-effect will take place and the user must take care to set the plot’s solution time with the `plot.solution_time` or `plot.solution_timestep` properties.

`PolyFEZone.``strand`

  The strand ID number.

  Type: | `integer`

  Example usage:

      >>> dataset.zone('My Zone').strand = 2

  Note

  Possible side-effect when connected to Tecplot 360.

  Changing the solution times in the dataset or modifying the active fieldmaps in a frame may trigger a change in the active plot’s solution time by the Tecplot 360 interface. This is done to keep the GUI controls consistent. In batch mode, no such side-effect will take place and the user must take care to set the plot’s solution time with the `plot.solution_time` or `plot.solution_timestep` properties.

`PolyFEZone.``values`(pattern)

  Returns an `Array` by index or string pattern.

  Parameters: | pattern (`integer` or `string`) – Zero-based index, `glob-style pattern` in which case, the first match is returned, or a `Variable` object.

  Note

  Data operations can make use of Numpy when installed.

  When doing large data transfers into and out of Tecplot using PyTecplot, it is recommended to install the Python array-processing module Numpy. PyTecplot will automatically use this to optimize data transfers which may result in significant performance gains.

  The `Variable.name` attribute is used to match the pattern to the desired `Array` though this is not necessarily unique:

      >>> ds = frame.dataset
      >>> print(ds)
      Dataset:
        Zones: ['Rectangular zone']
        Variables: ['x', 'y', 'z']
      >>> zone = ds.zone('Rectangular zone')
      >>> x = zone.values('x')
      >>> x == zone.values(0)
      True

`PolyFEZone.``zone_type`

  The `ZoneType` indicating structure of the data contained.

  Type: | `ZoneType`

  The specific type of zone this object represents:

      >>> print(dataset.zone(0).zone_type)
      ZoneType.FEPolygon

### Array

class `tecplot.data.``Array`(zone, variable)

  Low-level accessor for underlying data within a `Dataset`.

  Note

  The data manipulation context referred to below is currently being developed and should show up in an up-coming revision.

  This object exposes a list-like interface to the underlying data array. Using it, values can be directly queried and modified. After any modification to the data, the Tecplot Engine will have to be notified of the change. This notification will happen automatically in most cases, but can be turned off using the data manipulation context for a significant performance increase on large datasets.

  Accessing values within an `Array` is done through the standard `[]` syntax:

      >>> print(array[3])
      3.1415

  The numbers passed are interpreted just like Python’s built-in `slice` object:

      >>> # print the values at indices: 5, 7, 9
      >>> print(array[5:10:2])
      [1.0, 1.0, 1.0]

  Elements within an array can be manipulated in-place with the assignment operator:

      >>> array[3] = 5.0
      >>> print(array[3])
      5.0

  Element-by-element access is not guaranteed to be performant and users should avoid writing loops over indices in Python. Instead, whole arrays should be used. This will effectively push the loop down to the underlying native library and will be much faster in virtually all cases.

  Consider this array of 10k elements:

      >>> import tecplot as tp
      >>> ds = tp.active_frame().create_dataset('Dataset', ['x'])
      >>> zn = ds.add_ordered_zone('Zone', 10000)
      >>> array = zn.values('x')

  The following loop, which takes the sine of all values in the array will require several Python function calls per element which is a tremendous overhead:

      >>> import math
      >>> for i in range(len(ar)):
      ...     ar[i] = math.sin(ar[i])

  An immediate improvement on this can be made by looping over the elements in Python only when reading the values, but assigning them using the whole array. This will be several times faster for even modest arrays:

      >>> ar[:] = [math.sin(x) for x in ar]

  But there is still a large performance penalty for looping over elements directly in Python and PyTecplot supports two solutions for large arrays: `tecplot.data.operate.execute_equation` and `tecplot.extension.numpy`. Please refer to these for details. Continuing with the example above, we could accomplish the same thing with either of the following using `execute_equation` (assuming the array is identified by the first zone, first variable):

      >>> from tecplot.data.operate import execute_equation
      >>> execute_equation('V1 = SIN(V1)', zones=[dataset.zone(0)])

  or by using the `numpy` library:

      >>> import numpy as np
      >>> ar[:] = np.sin(ar[:])

  In both of these cases, the calculation of the sine and loop over elements is pushed to the low level library and is much faster.

  Attributes

  `c_type` | `ctypes` compatible data type of this array.
  `data_type` | `FieldDataType` indicating the underlying value type of this array.
  `location` | The location of the data points with respect to the elements.
  `passive` | `Boolean` indicating an unallocated zone-variable combination.
  `shape` | `(i, j, k)` shape for this array.
  `shared_zones` | `list` of all Zones sharing this array.

  Methods

  `as_numpy_array`() |
  `copy`([offset, size]) | Copy the whole or part of the array into a ctypes array.
  `max`() | Upper bound of the values stored in this array.
  `min`() | Lower bound of the values stored in this array.
  `minmax`() | Limits of the values stored in this array.

`Array.``as_numpy_array`()

`Array.``c_type`

  `ctypes` compatible data type of this array.

  This is the `ctypes` equivalent of `Array.data_type` and will return one of the following:

  > - `ctypes.c_float`
  > - `ctypes.c_double`
  > - `ctypes.c_int`
  > - `ctypes.c_int16`
  > - `ctypes.c_int8`

  and can be used to create a `ctypes` array to store a copy of the data:

      import tecplot as tp
      frame = tp.active_frame()
      dataset = frame.create_dataset('Dataset', ['x'])
      dataset.add_ordered_zone('Zone', (3,3,3))
      x = dataset.zone('Zone').values('x')
      # allocate array using Python's ctypes
      x_array = (x.c_type * len(x))()
      # copy values from Dataset into ctypes array
      x_array[:] = x[:]

`Array.``copy`(offset=0, size=None)

  Copy the whole or part of the array into a ctypes array.

  Parameters: | offset (`integer`, optional) – Zero-based offset for starting index to copy. (default: 0) size (`integer`, optional) – Number of values to copy into the resulting array. A value of `None` will copy to the end of the array. (default: `None`)

  Here we will copy out chunks of the data, do some operation and set the values back into the dataset:

      >>> import tecplot as tp
      >>> tp.new_layout()
      >>> frame = tp.active_frame()
      >>> dataset = frame.create_dataset('Dataset', ['x'])
      >>> dataset.add_ordered_zone('Zone', (2, 2, 2))
      >>> x = dataset.zone('Zone').values('x')
      >>> # loop over array copying out 4 values at a time
      >>> for i, offset in enumerate(range(0, len(x), 4)):
      ...     x_array = x.copy(offset, 4)
      ...     x_array[:] = [i] * 4
      ...     x[offset:offset + 4] = x_array
      >>> print(x[:])
      [0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0]

`Array.``data_type`

  `FieldDataType` indicating the underlying value type of this array.

  Type: | `FieldDataType`

  Example usage:

      >>> print(dataset.zone('Zone').values('X').data_type)
      FieldDataType.Float

`Array.``location`

  The location of the data points with respect to the elements.

  Type: | `ValueLocation`

  Possible values are `ValueLocation.CellCentered` and `ValueLocation.Nodal`. Example usage:

      >>> print(dataset.zone(0).values('X').location)
      ValueLocation.Nodal

`Array.``max`()

  Upper bound of the values stored in this array.

  Type: | `float`

  This always returns a `float` regardless of the underlying data type:

      >>> print(dataset.zone('Zone').values('x').max())
      10

`Array.``min`()

  Lower bound of the values stored in this array.

  Type: | `float`

  This always returns a `float` regardless of the underlying data type:

      >>> print(dataset.zone('Zone').values('x').min())
      0

`Array.``minmax`()

  Limits of the values stored in this array.

  Type: | 2-tuple of `floats`

  This always returns `floats` regardless of the underlying data type:

      >>> print(dataset.zone('Zone').values('x').minmax())
      (0, 10)

`Array.``passive`

  `Boolean` indicating an unallocated zone-variable combination.

  Type: | `bool`

  Passive variables are placeholders where no data is defined for a zone variable combination. Passive variables will always return zero when queried.

  Example:

      >>> import tecplot as tp
      >>> ds = tp.active_page().add_frame().create_dataset('D', ['x','y'])
      >>> z = ds.add_ordered_zone('Z1', (3,))
      >>> z.values(0).passive
      False

`Array.``shape`

  `(i, j, k)` shape for this array.

  Type: | `tuple` of `floats`

  This is defined by the parent zone and can be used to reshape arrays. The following example assumes 32-bit floating point array and copies the Tecplot-owned `data` into the `numpy`-owned `array`:

      >>> import numpy as np
      >>> data = dataset.zone('Zone').values('X')
      >>> array = np.empty(data.shape, dtype=np.float32)
      >>> arr_ptr = array.ctypes.data_as(POINTER(data.c_type))
      >>> memmove(arr_ptr, data.copy(), sizeof(data.c_type) * len(data))

  The data array presented is normally one-dimensional. For ordered data, you may wish to reshape the array indexing according to the dimensionality given by the `shape` attribute:

      >>> import numpy as np
      >>> import tecplot as tp
      >>> frame = tp.active_frame()
      >>> dataset = frame.create_dataset('Dataset', ['x'])
      >>> zone = dataset.add_ordered_zone('Zone', shape=(3,3,3))
      >>> x = np.array(zone.values('X')[:])
      >>> print(x)
      [ 0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.
        0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.  0.]
      >>> x.shape = zone.values('X').shape
      >>> print(x)
      [[[ 0.  0.  0.]
        [ 0.  0.  0.]
        [ 0.  0.  0.]]

       [[ 0.  0.  0.]
        [ 0.  0.  0.]
        [ 0.  0.  0.]]

       [[ 0.  0.  0.]
        [ 0.  0.  0.]
        [ 0.  0.  0.]]]

`Array.``shared_zones`

  `list` of all Zones sharing this array.

  Type: | `list` of Zones

  Example usage:

      >>> dataset.zone('My Zone').copy(share_variables=True)
      >>> for z in dataset.zone('My Zone').values(0).shared_zones:
      ...     print(z.index)
      0
      1

### Nodemap

class `tecplot.data.``Nodemap`(zone)

  Connectivity list definition and control for classic FE zones.

  A nodemap holds the connectivity between nodes and elements for classic finite-element zones. It is nominally a two-dimensionaly array of shape \((N_e, N_{npe})\) where \(N_e\) is the number of elements and \(N_{npe}\) is the number of nodes per element. The nodemap interface has flat-array access through the `Nodemap.array` property as well as reverse look-up with `Nodemap.num_elements()` and `Nodemap.element()`.

  The nodemap behaves mostly like a two-dimensional array and can be treated as such:

      >>> nodemap = dataset.zone('My Zone').nodemap
      >>> print('nodes in the first element:', nodemap[0])
      nodes in the first element: [0, 1, 2, 3]
      >>> print(nodemap[:3])
      [[0, 1, 2, 3], [2, 3, 4, 5], [4, 5, 6, 7]]
      >>> nodemap[0] = [6, 7, 8, 9]
      >>> print(nodemap[0])
      [6, 7, 8, 9]

  Just for clarity, the nodemap indexing is by element first, then offset within that element:

      >>> element = 6
      >>> offset = 2
      >>> node = nodemap[element][offset]
      >>> print(node)
      21

  Setting node indices must be done for an entire element because getting values out of the nodemap and into Python always creates a copy. For example, this will not work:

      >>> nodemap = dataset.zone('My Zone').nodemap
      >>> # Trying to set the 3rd node of the element 10
      >>> nodemap[10][2] = 5  # Error: nodemap[10] returns a copy

  To modify a single node in a nodemap, it is neccessary to do a round trip like so:

      nodemap = dataset.zone('My Zone').nodemap
      >>> nodes = nodemap[10]
      >>> nodes[2] = 5
      >>> nodemap[10] = nodes  # OK: setting whole element at a time
      >>> print(nodemap[10])
      [20, 21, 5, 22]

  The following script creates a quad of two triangles from scratch using the PyTecplot low-level data creation interface. The general steps are:

  1. Setup the data
  2. Create the tecplot dataset and variables
  3. Create the zone
  4. Set the node locations and connectivity lists
  5. Set the (scalar) data
  6. Write out data file
  7. Adjust plot style and export image

  The data created looks like this:

      Node positions (x,y,z):

                     (1,1,1)
                    3
                   / \
                  /   \
       (0,1,.5)  2-----1  (1,0,.5)
                  \   /
                   \ /
                    0
                     (0,0,0)

  Breaking up the two triangular elements, the faces look like this. Notice the first element (index: 0) is on the bottom:

      Element 1 Faces:
                         *
         (nodes 3-2)  1 / \ 0  (nodes 1-3)
                       /   \
                      *-----*
                         2
                          (nodes 2-1)

      Element 0 Faces:
                          (nodes 1-2)
                         1
                      *-----*
                       \   /
         (nodes 2-0)  2 \ / 0  (nodes 0-1)
                         *

  The nodes are created as a list of \((x, y, z)\) positions:

      [(x0, y0, z0), (x1, y1, z1)...]

  which are transposed to lists of \(x\), \(y\) and \(z\)-positions:

      [(x0, x1, x2...), (y0, y1, y2...)...]

  and passed to the \((x, y, z)\) arrays. The nodemap, or connectivity list, is given as an array of dimensions \((N, D)\) where \(N\) is the number of elements and \(D\) is the number of nodes per element. The order of the node locations determines the indices used when specifying the connectivity list. The Nodemap can be set individually and separately or all at once as shown here.

      import tecplot as tp
      from tecplot.constant import *

      # (x, y, z) locations of nodes
      nodes = (
          (0, 0, 0  ), # node 0
          (1, 0, 0.5), # node 1
          (0, 1, 0.5), # ...
          (1, 1, 1  ),
          )

      scalar_data = [0, 1, 2, 3]

      # Connectivity list
      # (n0, n1, n2) node indexes which make up the triangles
      conn = (
          (0, 1, 2), # element 0 consisting of faces
                     #     node connections: 0-1, 1-2, 2-0
          (1, 3, 2), # element 1
          )

      # Setup dataset and zone
      ds = tp.active_frame().create_dataset('Data', ['x','y','z','s'])
      z = ds.add_fe_zone(ZoneType.FETriangle,
                         name='FE Triangle Float (4,2) Nodal',
                         num_points=len(nodes), num_elements=len(conn))

      # Fill in node locations
      z.values('x')[:] = [n[0] for n in nodes]
      z.values('y')[:] = [n[1] for n in nodes]
      z.values('z')[:] = [n[2] for n in nodes]

      # Set the nodemap
      z.nodemap[:] = conn

      # Set the scalar data
      z.values('s')[:] = scalar_data

      ### Now we setup a nice view of the data
      plot = tp.active_frame().plot(PlotType.Cartesian3D)
      plot.activate()

      plot.contour(0).colormap_name = 'Sequential - Yellow/Green/Blue'
      plot.contour(0).colormap_filter.distribution = ColorMapDistribution.Continuous

      for ax in plot.axes:
          ax.show = True

      plot.show_mesh = False
      plot.show_contour = True
      plot.show_edge = True
      plot.use_translucency = True

      fmap = plot.fieldmap(z)
      fmap.surfaces.surfaces_to_plot = SurfacesToPlot.All
      fmap.effects.surface_translucency = 40

      # View parameters obtained interactively from Tecplot 360
      plot.view.distance = 10
      plot.view.width = 2
      plot.view.psi = 80
      plot.view.theta = 30
      plot.view.alpha = 0
      plot.view.position = (-4.2, -8.0, 2.3)

      # Showing mesh, we can see all the individual triangles
      plot.show_mesh = True
      plot.fieldmap(z).mesh.line_pattern = LinePattern.Dashed

      tp.export.save_png('fe_triangles1.png', 600, supersample=3)

  Attributes

  `array` | Flattened array accessor for this nodemap.
  `c_type` | The underlying data type for this nodemap.
  `num_points_per_element` | Points per element for classic finite-element zones.
  `shape` | Shape of the nodemap array.
  `size` | Total number of nodes stored in the nodemap array.

  Methods

  `assignment`() | Context manager for assigning to the nodemap.
  `element`(node, offset) | The element containing a given node.
  `num_elements`(node) | The number of elements that use a given node.

`Nodemap.``array`

  Flattened array accessor for this nodemap.

  Type: | 1D view of the nodemap.

  The nodemap is normally dimensioned by \((N_e, N_{npe})\) where \(N_e\) is the number of elements and \(N_{npe}\) is the number of nodes per element. This property represents a flattened view into the array which is of length \(N_e \times N_{npe}\). This may be more convenient than flattening the array in your script using a looping construct.

  Standard Python list slicing works for both fetching values and assignments. Example usage:

      >>> nmap = dataset.zone('My Zone').nodemap
      >>> nmap.array[:] = mydata
      >>> print(nmap.array[:10])
      [1, 10, 8, 0, 5, 18, 6, 12, 18, 11]

`Nodemap.``assignment`()

  Context manager for assigning to the nodemap.

  When setting values to the nodemap, a State Changes is emitted to the engine after every statement. This can degrade performance if in the script the nodemap is being set many times. This context provides a way to suspend the state change notification until all assignments have been completed. In the following example, the state change is emitted only after the `nodemap.assignment()` context exits:

      >>> nodemap = dataset.zone('My Zone').nodemap
      >>> with nodemap.assignment():
      ...     for elem, nodes in enumerate(mydata):
      ...         nodemap[elem] = nodes

`Nodemap.``c_type`

  The underlying data type for this nodemap.

  Type: | One of: `ctypes.c_int32`, `ctypes.c_int64`

  Note

  This property is read-only.

  This is the `ctypes` integer type used by the Tecplot Engine to store the nodemap data. This is used internally and is not normally needed for simple nodemap access.

`Nodemap.``element`(node, offset)

  The element containing a given node.

  Parameters: | node (`integer`) – Zero-based index of a node. offset (`integer`) – Zero-based index of the element that uses the given node.
  Returns: | `integer` - Zero-based index of the element.

  Example usage:

      >>> nodemap = dataset.zone('My Zone').nodemap
      >>> print(nodemap.element(3, 7))
      324

`Nodemap.``num_elements`(node)

  The number of elements that use a given node.

  Parameters: | node – (`integer`): Zero-based index of a node.
  Returns: | `integer` - The number of elements that use this node.

  Example usage:

      >>> nodemap = dataset.zone('My Zone').nodemap
      >>> nodemap.num_elements(3)
      8

`Nodemap.``num_points_per_element`

  Points per element for classic finite-element zones.

  Type: | `integer`

  Note

  This property is read-only.

  The number of points (also known as nodes) per finite-element is determined from the `zone_type` parameter. The following table shows the number of points per element for the available zone types along with the resulting shape of the nodemap based on the number of points specified (\(N\)):

  > Zone Type | Points/Element | Nodemap Shape
  > --- | --- | ---
  > `FELineSeg` | 2 | \((N, 2 N)\)
  > `FETriangle` | 3 | \((N, 3 N)\)
  > `FEQuad` | 4 | \((N, 4 N)\)
  > `FETetra` | 4 | \((N, 4 N)\)
  > `FEBrick` | 8 | \((N, 8 N)\)

  Example usage:

      >>> zone = dataset.zone('My Zone')
      >>> print(zone.zone_type)
      ZoneType.FETriangle
      >>> print(zone.nodemap.num_points_per_element)
      3

`Nodemap.``shape`

  Shape of the nodemap array.

  Type: | `tuple` of `integers`

  Note

  This property is read-only.

  This is defined by the zone type and is equal to \((N_e, N_{npe})\) where \(N_e\) is the number of elements and \(N_{npe}\) is the number of nodes per element. Example usage:

      >>> print(dataset.zone(0).nodemap.shape)
      (1024, 4)

`Nodemap.``size`

  Total number of nodes stored in the nodemap array.

  Type: | `integer`

  Note

  This property is read-only.

  This is defined by the zone type and is equal to \(N_e \times N_{npe}\) where \(N_e\) is the number of elements and \(N_{npe}\) is the number of nodes per element. Example usage:

      >>> print(dataset.zone(0).nodemap.shape)
      (1024, 4)
      >>> print(dataset.zone(0).nodemap.size)
      4096

### Facemap

class `tecplot.data.``Facemap`(zone)

  Connectivity list definition and control.

  A facemap holds the connectivity for a polytopal finite-element zone. This includes node-to-element and element-to-element connections. The following script creates a quad of two triangles from scratch using the PyTecplot low-level data creation interface. The data created looks like this:

      Node positions (x,y,z):

                     (1,1,1)
                    3
                   / \
                  /   \
       (0,1,.5)  2-----1  (1,0,.5)
                  \   /
                   \ /
                    0
                     (0,0,0)

  Element indices are used when identifying the left and right of each face, where \(-1\) is used to indicate no element:

          *
      -1 / \ -1
        / 1 \
       *-----*
        \ 0 /
      -1 \ / -1
          *

      import tecplot as tp
      from tecplot.constant import *

      nodes = ((0, 0, 0  ),
               (1, 0, 0.5),
               (0, 1, 0.5),
               (1, 1, 1  ))
      faces = ((0, 1),
               (1, 2),
               (2, 0),
               (1, 3),
               (3, 2))
      elements = (( 0, 0,  0,  1,  1),  # elements to the left of each face
                  (-1, 1, -1, -1, -1))  # elements to the right of each face
      num_elements = 2
      scalar_data = (0, 1, 2, 3)

      ds = tp.active_frame().create_dataset('Data', ['x','y','z','s'])
      z = ds.add_poly_zone(ZoneType.FEPolygon,
                           name='FE Polygon Float (4,2,5) Nodal',
                           num_points=len(nodes),
                           num_elements=num_elements,
                           num_faces=len(faces))

      z.values('x')[:] = [n[0] for n in nodes]
      z.values('y')[:] = [n[1] for n in nodes]
      z.values('z')[:] = [n[2] for n in nodes]
      z.facemap.set_mapping(faces, elements)
      z.values('s')[:] = scalar_data

      ### setup a view of the data
      plot = tp.active_frame().plot(PlotType.Cartesian3D)
      plot.activate()

      cont = plot.contour(0)
      cont.colormap_name = 'Sequential - Yellow/Green/Blue'
      cont.colormap_filter.distribution = ColorMapDistribution.Continuous

      for ax in plot.axes:
          ax.show = True

      plot.show_mesh = False
      plot.show_contour = True
      plot.show_edge = True
      plot.use_translucency = True

      fmap = plot.fieldmap(z)
      fmap.surfaces.surfaces_to_plot = SurfacesToPlot.All
      fmap.effects.surface_translucency = 40

      # View parameters obtained interactively from Tecplot 360
      plot.view.distance = 10
      plot.view.width = 2
      plot.view.psi = 80
      plot.view.theta = 30
      plot.view.alpha = 0
      plot.view.position = (-4.2, -8.0, 2.3)

      # Turning on mesh, we can see all the individual triangles
      plot.show_mesh = True
      plot.fieldmap(z).mesh.line_pattern = LinePattern.Dashed
      tp.export.save_png('polygons1.png', 600, supersample=3)

  Two triangle polygons showing edge and mesh lines.

  Attributes

  `element_c_type` | The data type of the element indices.
  `node_c_type` | The data type of the node indices.
  `num_unique_nodes` | The number of unique nodes in this `Facemap`.

  Methods

  `alloc`(face_nodes[, boundary_faces, …]) | Allocate space for the facemap.
  `assignment`() | Context manager for assigning facemap connections.
  `boundary_connection`(face, offset[, element]) | The connected element and zone along a boundary face.
  `face`(element, offset) | Face index on a specific element.
  `left_element`(face[, element]) | The element to the left of a specific face.
  `node`(face, offset[, element]) | The node index along a specific face.
  `num_boundary_connections`([face, element]) | The number of boundary connections for a given face.
  `num_faces`([element]) | The number of faces of an element in this `Facemap`.
  `num_nodes`([face, element]) | The number nodes for a given face in this `Facemap`.
  `right_element`(face[, element]) | The element to the right of a specific face.
  `set_boundary_connections`(elements, zones) | Set the boundary connections.
  `set_elementmap`(elementmap) | Define connectivity per element.
  `set_elements`(left_elements, right_elements) | Sets the polytope connectivity.
  `set_mapping`(facemap, elements[, …]) | Set the node and element connectivity for this polytope zone.
  `set_nodes`(facemap) | Sets the polytope connectivity.

`Facemap.``alloc`(face_nodes, boundary_faces=0, boundary_connections=0)

  Allocate space for the facemap.

  Parameters: | face_nodes (`int`) – Total number of nodes for all faces. This is not the number of unique nodes but the total number. For example if a facemap defines two triangle polygons that share a common face, `faces` would be 5 and `face_nodes` would be 6, not 4. boundary_faces (`int`, optional) – Total number of boundary faces. (default: 0) boundary_connections (`int`, optional) – Total number of boundary face elements or boundary face element/zone pairs. (default: 0)
  Returns: | `Facemap`

  This is called when using the `Facemap.set_mapping()` method which is the preferred method for filling the connectivity of polytope zones. If the zone does not already have space allocated for a facemap and if you wish to use the `Facemap.set_nodes()` and `Facemap.set_elements()` methods to fill in the connectivity, then this must be called first:

      >>> facemap = zone.facemap.alloc(400, 25, 50)

  Note

  Tecplot version 2017.2 or later.

  Setting the boundary faces and boundary connections using PyTecplot requires Tecplot version 2017.2 or later.

`Facemap.``assignment`()

  Context manager for assigning facemap connections.

  This context ensures the proper book keeping is done when setting the connectivity list and must be used with `Facemap.set_nodes()`, `Facemap.set_elements()` and `Facemap.set_boundary_connections()`, which are used to define the connectivity of the zone.

`Facemap.``boundary_connection`(face, offset, element=None)

  The connected element and zone along a boundary face.

  Parameters: | face (`integer`) – The zero-based index of the face. offset (`integer`) – The zero-based index of the node being requested. element (`integer`, optional) – Zero-based index of an element. If given, face will be locally indexed within this element, otherwise face is globally indexed over the whole zone.
  Returns: | `namedtuple` – `(element, zone)`: `element` The zero-based index of the neighboring element. `zone` The zone holding the neighboring element.

  Example usage:

      >>> bconn = zone.facemap.boundary_connection(0, 2)
      >>> print(bconn.element)
      128
      >>> print(bconn.zone.index)
      2

`Facemap.``element_c_type`

  The data type of the element indices.

  Possible values: `ctypes.c_int32`, `ctypes.c_int64`

  Note

  This property is read-only.

`Facemap.``face`(element, offset)

  Face index on a specific element.

  Parameters: | element (`integer`) – The zero-based index of the element. offset (`integer`) – The zero-based index of the face being requested.
  Returns: | `integer` Zero-based index of the face at the specified location.

  Example usage:

      >>> print(zone.facemap.face(0, 2))
      128

`Facemap.``left_element`(face, element=None)

  The element to the left of a specific face.

  Parameters: | face (`integer`) – The zero-based index of the face. element (`integer`, optional) – Zero-based index of an element. If given, face will be locally indexed within this element, otherwise face is globally indexed over the whole zone.
  Returns: | `integer`

  A negative number indicates there is no element to the left of this face. Example usage:

      >>> print(zone.facemap.left_element(0))
      128

`Facemap.``node`(face, offset, element=None)

  The node index along a specific face.

  Parameters: | face (`integer`) – The zero-based index of the face. offset (`integer`) – The zero-based index of the node being requested. element (`integer`, optional) – Zero-based index of an element. If given, face will be locally indexed within this element, otherwise face is globally indexed over the whole zone.
  Returns: | `integer` The node at the specified location.

  Example usage:

      >>> print(zone.facemap.face_node(0, 2))
      128

`Facemap.``node_c_type`

  The data type of the node indices.

  Possible values: `ctypes.c_int32`, `ctypes.c_int64`

  Note

  This property is read-only.

`Facemap.``num_boundary_connections`(face=None, element=None)

  The number of boundary connections for a given face.

  Parameters: | face (`integer`, required if no element is given) – The zero-based index of the face. element (`integer`, optional) – Zero-based index of an element. If given, face will be locally indexed within this element, otherwise face is globally indexed over the whole zone.
  Returns: | `integer` The number of boundary connections.

  Example usage:

      >>> print(zone.facemap.num_boundary_connections(1))
      1

`Facemap.``num_faces`(element=None)

  The number of faces of an element in this `Facemap`.

  Parameters: | element (`integer`, optional) – Zero-based index of an element. If no element is given, the total number of faces in the map are returned.
  Returns: | `integer`

  Example usage:

      >>> print(zone.facemap.num_faces())
      1048576

`Facemap.``num_nodes`(face=None, element=None)

  The number nodes for a given face in this `Facemap`.

  Parameters: | face (`integer`, required if no element is given) – The zero-based index of the face either within the given element or globally. If no face is given, the number of nodes on the given element are returned. element (`integer`, required if no face is given) – The zero-based index of an element. If no element is given, then face is globally indexed from zero over the whole zone.
  Returns: | `integer` The number of nodes.

  Example usage:

      >>> print(zone.facemap.num_nodes(face=1))
      4

`Facemap.``num_unique_nodes`

  The number of unique nodes in this `Facemap`.

  Type: | `integer`

  Note

  This property is read-only.

  Example usage:

      >>> print(zone.facemap.num_unique_nodes)
      4194304

`Facemap.``right_element`(face, element=None)

  The element to the right of a specific face.

  Parameters: | face (`integer`) – The zero-based index of the face. element (`integer`, optional) – Zero-based index of an element. If given, face will be locally indexed within this element, otherwise face is globally indexed over the whole zone.
  Returns: | `integer`

  A negative number indicates there is no element to the right of this face. Example usage:

      >>> print(zone.facemap.right_element(0))
      -1

`Facemap.``set_boundary_connections`(elements, zones)

  Set the boundary connections.

  Parameters: | elements (2D array of `integers`) – Zero-based indices of the connected elements. This is a “ragged” array of dimension \((N,E_i)\) where \(N\) is the number of boundary faces and \(E_i\) is the number of boundary connected elements for the \(i^{th}\) face. zones (2D array of `integers`) – Zero-based indices of the zones for each entry given in elements. This must be the same shape as elements.

  The facemap must first be allocated with `Facemap.alloc()` and must be called from within a `Facemap.assignment()` context, and should follow calls to `Facemap.set_nodes()` and `Facemap.set_elements()` to complete the connectivity map information needed for rendering. Using `Facemap.set_mapping()` is recommended, which does all the required book keeping.

`Facemap.``set_elementmap`(elementmap)

  Define connectivity per element.

  Parameters: | elementmap (`integers`) – Zero-based indices of the nodes that make up each face of each element. For polygons, the map is a list of elements, each made of up a list of nodes. For polyhedrons, this is a list of elements, made up a list of faces, each made up of a list of nodes.

  Warning

  This method is mutually exclusive with the `Facemap.set_mapping()` and `Facemap.assignment()`, `Facemap.set_nodes()`, `Facemap.set_elements()` and `Facemap.set_boundary_connections()` family of methods. The size of the underlying arrays are calculated based on the elementmap given and a call to `Facemap.alloc()` is made which will override any previous allocation.

  This may be a more convenient way to describe the connectivity of a polytope zone, however it does not support boundary face connections to other zones (see `Facemap.set_mapping()`).

  Here is an example of an elementmap for two triangles (polygons):

      nodes = ((0, 0, 0  ),
               (1, 0, 0.5),
               (0, 1, 0.5),
               (1, 1, 1  ))
      elementmap = ((0, 1, 2),  # polygon 0, 3 faces
                    (1, 3, 2))  # polygon 1, 3 faces

  This is an example of an elementmap for two tetrahedrons (polyhedrons):

      nodes = ((0, 0, 0),
               (1, 1, 0),
               (1, 0, 1),
               (0, 1, 1),
               (0, 0, 1))
      elementmap = (((0, 1, 2),  # polyhedron 0, 4 faces
                     (0, 1, 3),
                     (1, 3, 2),
                     (0, 2, 3)),
                    ((0, 2, 3),  # polyhedron 1, 4 faces
                     (2, 3, 4),
                     (0, 2, 4),
                     (0, 4, 3)))

`Facemap.``set_elements`(left_elements, right_elements)

  Sets the polytope connectivity.

  Parameters: | left_elements (array of zero-based `integers`) – This is an array of the elements to the left of each face in the facemap and must be the same length as the number of faces. right_elements (array of zero-based `integers`) – Same as left_elements for the right side of each face.

  The facemap must first be allocated with `Facemap.alloc()` and must be called from within a `Facemap.assignment()` context and should follow a call to `Facemap.set_nodes()` to complete the connectivity map information needed for rendering. Using `Facemap.set_mapping()` is recommended, which does all the required book keeping.

`Facemap.``set_mapping`(facemap, elements, boundary_elements=None, boundary_zones=None)

  Set the node and element connectivity for this polytope zone.

  Parameters: | facemap (2D array of zero-based `integers`) – The `list` of `lists` which need not all be the same length, defining the individual elements by their nodes. elements (2D array of zero-based `integers`) – This is a \((2,N)\) array where \(N\) is the number of faces and the items are a list of the elements to the left and right of the face respectively. boundary_elements (2D array of `integers`, optional) – Zero-based indices of the connected elements. This is a “ragged” array of dimension \((N, E_i)\) where \(N\) is the number of boundary faces and \(E_i\) is the number of boundary connected elements for the \(i^{th}\) face. boundary_zones (2D array of `integers`, optional) – Zero-based indices of the zones for each entry given in elements. This must be the same shape as elements.

  See the code example for the `Facemap` class object for details.

`Facemap.``set_nodes`(facemap)

  Sets the polytope connectivity.

  Parameters: | facemap (2D array of zero-based `integers`) – The `list` of `lists` which need not all be the same length, defining the individual elements by their nodes.

  The facemap must first be allocated with `Facemap.alloc()` and must be called from within a `Facemap.assignment()` context and should be followed by a call to `Facemap.set_elements()` to complete the connectivity map information needed for rendering. It is recomended to use the `Facemap.set_mapping()` which does all the required book keeping.

### FaceNeighbors

class `tecplot.data.``FaceNeighbors`(zone)

  Face neighbor definition and control.

  Face neighbors are used when the face of an element overlaps with another face from another element. Specifying these two (or more) overlapping faces as “face neighbors” indicates element connections outside the implicit faces of the nodemap. By specifying face neighbors it ensures that plot elements like shading, creases and edges are treated continously even if there is a zone or cell boundry.

  The neighbors can be completely “local”, within a single zone, or “global” conntecting two or more zones together. Furthermore, the connections made can be one-to-one meaning there any given face can only neighbor one other face, or one-to-many where a single face can neighbor several other faces.

  This example creates two triangles in two different zones. Global one-to-one face neighbors are then used to stitch the two triangles into a quad. The data created looks like this:

      Node positions (x,y,z):

                     (1,1,1)
                    *
                   / \
                  /   \
       (0,1,.5)  *-----*  (1,0,.5)
                  \   /
                   \ /
                    *
                     (0,0,0)

  The two triangles will have separate nodes at the shared locations:

      Nodes:
                         2
          Zone 1:       / \
                       /   \
                      1-----0
                      2-----1
                       \   /
          Zone 0:       \ /
                         0

      import tecplot as tp
      from tecplot.constant import *

      # Triangle 0
      nodes0 = (
          (0, 0, 0  ),
          (1, 0, 0.5),
          (0, 1, 0.5))
      scalar_data0 = (0, 1, 2)
      conn0 = ((0, 1, 2),)
      neighbors0 = ((None, 0, None),)
      neighbor_zones0 = ((None, 1, None),)

      # Triangle 1
      nodes1 = (
          (1, 0, 0.5),
          (0, 1, 0.5),
          (1, 1, 1  ))
      scalar_data1 = (1, 2, 3)
      conn1 = ((0, 1, 2),)
      neighbors1 = ((0, None, None),)
      neighbor_zones1 = ((0, None, None),)

      # Create the dataset and zones
      ds = tp.active_frame().create_dataset('Data', ['x','y','z','s'])
      z0 = ds.add_fe_zone(ZoneType.FETriangle,
                          name='FE Triangle Float (3,1) Nodal 0',
                          num_points=len(nodes0), num_elements=len(conn0),
                          face_neighbor_mode=FaceNeighborMode.GlobalOneToOne)
      z1 = ds.add_fe_zone(ZoneType.FETriangle,
                          name='FE Triangle Float (3,1) Nodal 1',
                          num_points=len(nodes1), num_elements=len(conn1),
                          face_neighbor_mode=FaceNeighborMode.GlobalOneToOne)

      # Fill in and connect first triangle
      z0.values('x')[:] = [n[0] for n in nodes0]
      z0.values('y')[:] = [n[1] for n in nodes0]
      z0.values('z')[:] = [n[2] for n in nodes0]
      z0.nodemap[:] = conn0
      z0.values('s')[:] = scalar_data0

      # Fill in and connect second triangle
      z1.values('x')[:] = [n[0] for n in nodes1]
      z1.values('y')[:] = [n[1] for n in nodes1]
      z1.values('z')[:] = [n[2] for n in nodes1]
      z1.nodemap[:] = conn1
      z1.values('s')[:] = scalar_data1

      # Set face neighbors
      z0.face_neighbors.set_neighbors(neighbors0, neighbor_zones0, obscures=True)
      z1.face_neighbors.set_neighbors(neighbors1, neighbor_zones1, obscures=True)

      ### Setup a view of the data
      plot = tp.active_frame().plot(PlotType.Cartesian3D)
      plot.activate()

      plot.contour(0).colormap_name = 'Sequential - Yellow/Green/Blue'
      plot.contour(0).colormap_filter.distribution = ColorMapDistribution.Continuous

      for ax in plot.axes:
          ax.show = True

      plot.show_mesh = False
      plot.show_contour = True
      plot.show_edge = True
      plot.use_translucency = True

      # View parameters obtained interactively from Tecplot 360
      plot.view.distance = 10
      plot.view.width = 2
      plot.view.psi = 80
      plot.view.theta = 30
      plot.view.alpha = 0
      plot.view.position = (-4.2, -8.0, 2.3)

      for fmap in plot.fieldmaps():
          fmap.surfaces.surfaces_to_plot = SurfacesToPlot.All
          fmap.effects.surface_translucency = 40

      # Turning on mesh, we can see all the individual triangles
      plot.show_mesh = True
      for fmap in plot.fieldmaps():
          fmap.mesh.line_pattern = LinePattern.Dashed
      tp.export.save_png('fe_triangles1.png', 600, supersample=3)

  Two triangles in two separate zones, stitched together using global face neighbors, showing the edge and mesh.

  Attributes

  `c_type` | Underlying storage type used by the Tecplot Engine.
  `mode` | `FaceNeighborMode` of this zone.

  Methods

  `add_local_neighbors`(neighbors[, offset]) | Assign all local one-to-one face neighbors at once.
  `add_neighbors`(element, face, neighbors[, …]) | Connect boundary of an element’s face to a neighboring face.
  `assignment`() | Context manager for assigning face neighbors.
  `is_obscured`(element, face[, active_zones]) | Obscuration of the specified face.
  `neighbors`(element, face) | Get the neighboring elements and zones of a specific face.
  `set_neighbors`(neighbors[, zones, obscures]) | Clear and set face neighbors from the given array.

`FaceNeighbors.``add_local_neighbors`(neighbors, offset=0)

  Assign all local one-to-one face neighbors at once.

  Parameters: | neighbors (2D array of `integers`) – \((E,F)\) Array of the face neighbors where \(E\) is the number of elements and \(F\) is the number of faces per element. offset (`integer`, optional) – Offset in Tecplot’s face neighbor array to begin assigning the supplied neighbor elements. (default: 0)

  This method must be called from within a `FaceNeighbors.assignment()` context which will clear any previously existing face neighbor data:

      >>> with zone.face_neighbors.assigment():
      ...     zone.face_neighbors.add_local_neighbors(neighbors)

  See the example code for `FaceNeighbors` class object for more details on how to set up user-defined face neighbors.

`FaceNeighbors.``add_neighbors`(element, face, neighbors, zones=None, obscure=False)

  Connect boundary of an element’s face to a neighboring face.

  This sets the boundary connection face neighbors within an open face neighbor assignment sequence for the specified element and face.

  Parameters: | element (`int`) – The element number (zero-based). face (`int`) – The face number on the element (zero-based). neighbors (`list` of `integers` or `None`) – List of zero-based indices of the neighboring faces. zones (`list` of zone objects, optional) – List of zones for global neighbors. This must be the same length as `neighbors`. Use `None` to indicate these are local neighbors. (default: `None`) obscure (`boolean`, optional) – Indicates that the neighbors completely obscure the face. (default: `False`)

  This method must be called from within a `FaceNeighbors.assignment()` context which will clear any previously existing face neighbor data:

      >>> with zone.face_neighbors.assigment():
      ...     for elem, face, neighbors, zn in face_neighbor_data:
      ...         zone.face_neighbors.add_neighbors(elem, face,
      ...                                           neighbors, zn)

  See the example code for `FaceNeighbors` class object for more details on how to set up user-defined face neighbors.

`FaceNeighbors.``assignment`()

  Context manager for assigning face neighbors.

  This context ensures the proper book keeping is done when setting face neighbors. After the face neighbors are specified, this context will valid the connections and make appropriate changes to the zone metadata. It must be used with the `FaceNeighbors.add_local_neighbors()` and/or `FaceNeighbors.add_neighbors()` methods. See the `FaceNeighbors` example code for more details on how to set up user-defined face neighbors.

`FaceNeighbors.``c_type`

  Underlying storage type used by the Tecplot Engine.

  Possible values: `ctypes.c_int32`, ctypes.c_int64`.

  Note

  This property is read-only.

`FaceNeighbors.``is_obscured`(element, face, active_zones=None)

  Obscuration of the specified face.

  Parameters: | element (`integer`) – The zero-based index of the element. face (`integer`) – The zero-based index of the face on the element. active_zones (`list` of Zones) – List of zones to consider when global face neighbors are present. If `None`, the active zones of the dataset’s parent frame will be used.
  Returns: | `boolean`

  Note

  Because datasets can be shared between frames, the default frame used to identify the active zones may not be the one you want. In this case, you can use the `Frame.active_zones()` method to provide the active zones for a specific frame. Furthermore, the plot type of the frame must have the concept of active zones - i.e. it must not be in “sketch” mode.

  Example usage:

      >>> zone.face_neighbors.is_obscured(element=0, face=1)
      True

`FaceNeighbors.``mode`

  `FaceNeighborMode` of this zone.

  Type: | `FaceNeighborMode`

  Possible values: `FaceNeighborMode.LocalOneToOne`,
    `FaceNeighborMode.LocalOneToMany`, `FaceNeighborMode.GlobalOneToOne`, `FaceNeighborMode.GlobalOneToMany`.

  Note

  This property is read-only.

  Face neighbors are used when the face of an element overlaps with another face from another element. The neighbors can be completely “local”, within a single zone, or “global” conntecting two or more zones together. Furthermore, the connections made can be one-to-one meaning there any given face can only neighbor one other face, or one-to-many where a single face can neighbor several other faces. The face neighbor mode is set on zone creation and can not be changed afterwards:

      >>> zone = dataset.add_fe_zone(ZoneType.FETriangle, 'Zone', 4, 2,
      ...    face_neighbor_mode=FaceNeighborMode.LocalOneToMany)
      >>> print(zone.face_neighbors.mode)
      FaceNeighborMode.LocalOneToMany

`FaceNeighbors.``neighbors`(element, face)

  Get the neighboring elements and zones of a specific face.

  Parameters: | element (`integer`) – The zero-based index of the element. face (`integer`) – The zero-based index of the face on this element.
  Returns: | `list` of `namedtuples` – `(element, zone)`: `element`: The zero-based index of the neighboring element. `zone`: The zone holding the neighboring element. A value of `None` indicates this is a local (intra-zone) neighbor connection.

  Example getting the neighboring faces of a zone’s first element, second face:

      >>> neighbors = zone.face_neighbors.neighbors(element=0, face=1)
      >>> for neighbor in neighbors:
      ...     elem, zn = neighbor
      ...     print(elem, zn.index)
      21 2

`FaceNeighbors.``set_neighbors`(neighbors, zones=None, obscures=False)

  Clear and set face neighbors from the given array.

  Parameters: | neighbors (array of `integers`) – Zero-based Element indices of the neighbors for each face in the zone. A value of \(-1\) or `None` indicates no neighbor. zones (array of Zones, optional) – This parameter is only used when the face neighbor mode is global one-to-one or global one-to-many. (default: `None`) obscures (array of `booleans`, optional) – Indicates that the neighbors completely obscure the face. (default: `False`)

  This method uses the `FaceNeighbors.assignment()` context internally to ensure the proper book keeping is done. See the example code for `FaceNeighbors` class object for details on how to use this method.

## Auxiliary Data

### AuxData

class `tecplot.session.``AuxData`(parent, object_type, object_index=None)

  Auxiliary data.

  The Tecplot Engine can hold auxiliary data attached to one of the following objects:

  > - `Layout`
  > - `Page`
  > - `Frame`
  > - `Dataset`
  > - `Variable`
  > - `Zone`
  > - `Linemap`

  Auxiliary data is an ordered key-value pair that behaves like an ordered dictionary, or `OrderedDict`. Keys are strings which are ordered alphabetically and values can additionally be access by index. The keys must be alphanumeric (special characters “.” and “_” are allowed), must not contain spaces, and must begin with a non-numeric character or underscore. Values, on the other hand, are arbitrary strings and can contain anything except the null character. In this example, we query the auxiliary data attached to the dataset and add some information to it. Notice that the stored order is alphabetical:

      >>> import tecplot as tp
      >>> aux = tp.active_frame().aux_data
      >>> aux['info'] = 'Here is some information.'
      >>> aux['Xavg'] = 3.14159
      >>> aux['note'] = 'Aux data values are always converted to strings.'
      >>> for k, v in aux.items():
      ...     print('{}: {}'.format(k,v))
      info: Here is some information.
      note: Aux data values are always converted to strings.
      Xavg: 3.14159

  Methods

  `as_dict`() | Returns a Python dict of the Aux Data attached to the parent.
  `clear`() | Deletes all Aux Data from the associated object.
  `index`(key) | Returns the zero-based index of the element based on key.
  `items`() | Yields all key/value pairs of the Aux Data attached to the parent.
  `key`(index) | Returns the key at a specific zero-based index.
  `keys`() | Yields all keys of the Aux Data attached to the parent.
  `update`(*other, **kwargs) | Update Aux Data with key/value pairs from another Aux Data or dict.
  `values`() | Yields all values of the Aux Data attached to the parent.

`AuxData.``as_dict`()

  Returns a Python dict of the Aux Data attached to the parent.

  Note that this will remove the alphabetical ordering guarantee that Aux Data has since Python dict objects are unordered. Example usage:

      >>> frame = tp.active_frame()
      >>> frame.aux_data['result'] = '3.1415'
      >>> frame.aux_data['other_info'] = '128'
      >>> aux = frame.aux_data.as_dict()
      >>> print(aux)
      {'result': '3.1415', 'other_info': '128'}

`AuxData.``clear`()

  Deletes all Aux Data from the associated object.

  Example usage:

      >>> print(frame.aux_data)
      {'bb': 'test bb', 'cc': 'test cc', 'aa': 'test aa'}
      >>> frame.aux_data.clear()
      >>> print(frame.aux_data)
      {}

`AuxData.``index`(key)

  Returns the zero-based index of the element based on key.

  Example usage:

      >>> frame = tp.active_frame()
      >>> frame.aux_data['result'] = '3.1415'
      >>> frame.aux_data['other_info'] = '128'
      >>> print(frame.aux_data.index('other_info'))
      0
      >>> print(frame.aux_data.index('result'))
      1

`AuxData.``items`()

  Yields all key/value pairs of the Aux Data attached to the parent.

  Elements are always ordered alphabetically by the keys. Example usage:

      >>> frame = tp.active_frame()
      >>> frame.aux_data['result'] = '3.1415'
      >>> frame.aux_data['other_info'] = '128'
      >>> for key, value in frame.aux_data.items():
      ...     print(key, value)
      other_info 128
      result 3.1415

`AuxData.``key`(index)

  Returns the key at a specific zero-based index.

  Example usage:

      >>> frame = tp.active_frame()
      >>> frame.aux_data['result'] = '3.1415'
      >>> frame.aux_data['other_info'] = '128'
      >>> print(frame.aux_data.key(0))
      other_info
      >>> print(frame.aux_data.key(1))
      result

`AuxData.``keys`()

  Yields all keys of the Aux Data attached to the parent.

  Elements are always ordered alphabetically by the keys. Example usage:

      >>> frame = tp.active_frame()
      >>> frame.aux_data['result'] = '3.1415'
      >>> frame.aux_data['other_info'] = '128'
      >>> for value in frame.aux_data.keys():
      ...     print(value)
      other_info
      result

`AuxData.``update`(*other, **kwargs)

  Update Aux Data with key/value pairs from another Aux Data or dict.

  Example usage:

      >>> frame = tp.active_frame()
      >>> frame.aux_data.update({'result': '3.1415', 'other_info': '128'})
      >>> print(frame.aux_data)
      {'result': '3.1415', 'other_info': '128'}

`AuxData.``values`()

  Yields all values of the Aux Data attached to the parent.

  Elements are always ordered alphabetically by the keys. Example usage:

      >>> frame = tp.active_frame()
      >>> frame.aux_data['result'] = '3.1415'
      >>> frame.aux_data['other_info'] = '128'
      >>> for value in frame.aux_data.values():
      ...     print(value)
      128
      3.1415