Note: The default ITS GitLab runner is a shared resource and is subject to slowdowns during heavy usage.
You can run your own GitLab runner that is dedicated just to your group if you need to avoid processing delays.

Commit 64582d45 authored by Camilla Dodge Koslowsky Harris's avatar Camilla Dodge Koslowsky Harris
Browse files

fixed a bug with default behavior for variables

parent 65c6402f
...@@ -277,7 +277,8 @@ def bracketify(variable_name: str) -> str: ...@@ -277,7 +277,8 @@ def bracketify(variable_name: str) -> str:
def write_zone( def write_zone(
tecplot_zone tecplot_dataset
, tecplot_zone
, write_as: str , write_as: str
, filename: str , filename: str
, variables=None , variables=None
...@@ -286,6 +287,7 @@ def write_zone( ...@@ -286,6 +287,7 @@ def write_zone(
"""Writes a tecplot zone to various formats. """Writes a tecplot zone to various formats.
Args: Args:
tecplot_dataset (): The dataset to save.
tecplot_zone (): The zone to save. tecplot_zone (): The zone to save.
write_as (str): Type of file to write to. Supported options are 'hdf5', write_as (str): Type of file to write to. Supported options are 'hdf5',
'csv', 'tecplot_ascii', and 'tecplot_plt'. 'csv', 'tecplot_ascii', and 'tecplot_plt'.
...@@ -295,7 +297,7 @@ def write_zone( ...@@ -295,7 +297,7 @@ def write_zone(
behavior is to save all variables. behavior is to save all variables.
verbose: (Optional) Print diagnostic information. Defaults to False. verbose: (Optional) Print diagnostic information. Defaults to False.
""" """
if verbose: if verbose and variables:
print('Saving variables:') print('Saving variables:')
for var in variables: for var in variables:
print(var.name) print(var.name)
...@@ -309,6 +311,8 @@ def write_zone( ...@@ -309,6 +311,8 @@ def write_zone(
if 'hdf5' in write_as: if 'hdf5' in write_as:
if verbose: if verbose:
print('hdf5') print('hdf5')
if not variables:
variables = list(tecplot_dataset.variables())
_save_hdf5( _save_hdf5(
filename, filename,
aux_data, aux_data,
...@@ -316,6 +320,8 @@ def write_zone( ...@@ -316,6 +320,8 @@ def write_zone(
variables variables
) )
elif 'csv' in write_as: elif 'csv' in write_as:
if not variables:
variables = list(tecplot_dataset.variables())
_save_csv( _save_csv(
filename, filename,
aux_data, aux_data,
...@@ -475,7 +481,7 @@ def interpolate_zone_to_geometry( ...@@ -475,7 +481,7 @@ def interpolate_zone_to_geometry(
geometry_points[direction][:] geometry_points[direction][:]
## interpolate variables on to the geometry ## interpolate variables on to the geometry
if verbose: if verbose and variables:
print('Interpolating variables:') print('Interpolating variables:')
for var in variables: for var in variables:
print(var.name) print(var.name)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment