Skip to content
This repository was archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
Adjusted how read_param works. Only reads initial conditions if also …
Browse files Browse the repository at this point in the history
…reading data
  • Loading branch information
daminton committed Jan 16, 2023
1 parent 852b645 commit ef909c7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion python/swiftest/swiftest/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ def str2bool(input_str):
raise ValueError(f"{input_str} is not recognized as boolean")



def real2float(realstr):
"""
Converts a Fortran-generated ASCII string of a real value into a numpy float type. Handles cases where double precision
Expand Down Expand Up @@ -199,6 +198,7 @@ def read_swiftest_param(param_file_name, param, verbose=True):
print(f"{param_file_name} not found.")
return param


def reorder_dims(ds):

# Re-order dimension coordinates so that they are in the same order as the Fortran side
Expand All @@ -212,6 +212,8 @@ def reorder_dims(ds):
idx = {index_name: idx[index_name] for index_name in dim_order}
ds = ds.reindex(idx)
return ds


def read_swifter_param(param_file_name, verbose=True):
"""
Reads in a Swifter param.in file and saves it as a dictionary
Expand Down
2 changes: 1 addition & 1 deletion python/swiftest/swiftest/simulation_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def __init__(self,read_param: bool = False, read_data: bool = False, simdir: os.
# If the file doesn't exist, flag it for now so we know to create it
param_file_found = False
if read_param or read_data:
if self.read_param(read_init_cond = not read_data):
if self.read_param(read_init_cond = read_data):
# We will add the parameter file to the kwarg list. This will keep the set_parameter method from
# overriding everything with defaults when there are no arguments passed to Simulation()
kwargs['param_file'] = self.param_file
Expand Down

0 comments on commit ef909c7

Please sign in to comment.