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

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
daminton committed Sep 15, 2022
2 parents 6af8656 + 0c595c4 commit 39ae072
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/swiftest/swiftest/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -887,7 +887,7 @@ def select_active_from_frame(ds, param, framenum=-1):

return frame

def swiftest_xr2infile(ds, param, infile_name=None,framenum=-1):
def swiftest_xr2infile(ds, param, in_type="NETCDF_DOUBLE", infile_name=None,framenum=-1):
"""
Writes a set of Swiftest input files from a single frame of a Swiftest xarray dataset
Expand All @@ -906,7 +906,7 @@ def swiftest_xr2infile(ds, param, infile_name=None,framenum=-1):
"""
frame = select_active_from_frame(ds, param, framenum)

if param['IN_TYPE'] == "NETCDF_DOUBLE" or param['IN_TYPE'] == "NETCDF_FLOAT":
if in_type == "NETCDF_DOUBLE" or in_type == "NETCDF_FLOAT":
# Convert strings back to byte form and save the NetCDF file
# Note: xarray will call the character array dimension string32. The Fortran code
# will rename this after reading
Expand Down Expand Up @@ -937,7 +937,7 @@ def swiftest_xr2infile(ds, param, infile_name=None,framenum=-1):
rotzcb = np.double(cb['rotz'])
cbid = int(0)

if param['IN_TYPE'] == 'ASCII':
if in_type == 'ASCII':
# Swiftest Central body file
cbfile = open(param['CB_IN'], 'w')
print(cbname, file=cbfile)
Expand Down Expand Up @@ -988,7 +988,7 @@ def swiftest_xr2infile(ds, param, infile_name=None,framenum=-1):
else:
print(f"{param['IN_FORM']} is not a valid input format type.")
tpfile.close()
elif param['IN_TYPE'] == 'REAL8':
elif in_type == 'REAL8':
# Now make Swiftest files
cbfile = FortranFile(param['CB_IN'], 'w')
cbfile.write_record(cbid)
Expand Down Expand Up @@ -1078,7 +1078,7 @@ def swiftest_xr2infile(ds, param, infile_name=None,framenum=-1):
tpfile.write_record(v5)
tpfile.write_record(v6)
else:
print(f"{param['IN_TYPE']} is an unknown file type")
print(f"{in_type} is an unknown file type")


def swifter_xr2infile(ds, param, framenum=-1):
Expand Down

0 comments on commit 39ae072

Please sign in to comment.