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 4df4dbc9 authored by Camilla Dodge Koslowsky Harris's avatar Camilla Dodge Koslowsky Harris
Browse files

Formatting. added a check to make sure we actually read any points out of a trajectory file.

parent 1bf99c1d
...@@ -88,7 +88,7 @@ def apply_equations(eqn_path: str, verbose: bool = False) -> None: ...@@ -88,7 +88,7 @@ def apply_equations(eqn_path: str, verbose: bool = False) -> None:
print('Successfully applied equations.') print('Successfully applied equations.')
def _shell_geometry(geometry_params:dict) -> dict: def _shell_geometry(geometry_params: dict) -> dict:
"""Returns a dict containing points for the described shell geometry. """Returns a dict containing points for the described shell geometry.
""" """
npoints = geometry_params['npoints'][0]*geometry_params['npoints'][1] npoints = geometry_params['npoints'][0]*geometry_params['npoints'][1]
...@@ -98,7 +98,7 @@ def _shell_geometry(geometry_params:dict) -> dict: ...@@ -98,7 +98,7 @@ def _shell_geometry(geometry_params:dict) -> dict:
return geometry_points return geometry_points
def _line_geometry(geometry_params:dict) -> dict: def _line_geometry(geometry_params: dict) -> dict:
"""Returns a dict containing points for the described line geometry. """Returns a dict containing points for the described line geometry.
""" """
geometry_points = { geometry_points = {
...@@ -119,7 +119,7 @@ def _line_geometry(geometry_params:dict) -> dict: ...@@ -119,7 +119,7 @@ def _line_geometry(geometry_params:dict) -> dict:
return geometry_points return geometry_points
def _rectprism_geometry(geometry_params:dict) -> dict: def _rectprism_geometry(geometry_params: dict) -> dict:
"""Returns a dict containing points for the described rectprism geometry. """Returns a dict containing points for the described rectprism geometry.
""" """
npoints = (geometry_params['npoints'][0] npoints = (geometry_params['npoints'][0]
...@@ -131,7 +131,7 @@ def _rectprism_geometry(geometry_params:dict) -> dict: ...@@ -131,7 +131,7 @@ def _rectprism_geometry(geometry_params:dict) -> dict:
return geometry_points return geometry_points
def _trajectory_geometry(geometry_params:dict) -> dict: def _trajectory_geometry(geometry_params: dict) -> dict:
"""Returns a dict containing points for the described trajectory geometry. """Returns a dict containing points for the described trajectory geometry.
Assumes format of trajectory file after SWMF SATELLITE command. Assumes format of trajectory file after SWMF SATELLITE command.
...@@ -147,6 +147,13 @@ def _trajectory_geometry(geometry_params:dict) -> dict: ...@@ -147,6 +147,13 @@ def _trajectory_geometry(geometry_params:dict) -> dict:
do_read = False do_read = False
elif '#START' in line: elif '#START' in line:
do_read = True do_read = True
try:
assert len(trajectory_data) >= 1
except:
raise ValueError(
'No points could be read from the trajectory file. Consult the '
'SWMF documentation for advice on trajectory format.'
)
geometry_points = { geometry_points = {
'npoints': len(trajectory_data), 'npoints': len(trajectory_data),
'X': [float(trajectory_point[7]) 'X': [float(trajectory_point[7])
......
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