Skip to content

Commit b5580fa

Browse files
committed
Fix path for links and improve output messages
1 parent 158bc0d commit b5580fa

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

bdschism/bdschism/uv3d.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,11 @@ def uv3d(
118118

119119
# fg_dir
120120
if fg_dir is None:
121+
print("`fg_dir` is not specified. Setting it to `bg_dir`.")
121122
fg_dir = bg_dir
122123

124+
fg_dir = os.path.abspath(fg_dir)
125+
123126
#
124127
# Make sure "interpolate_variables.in" is present
125128
#
@@ -170,10 +173,16 @@ def uv3d(
170173
#
171174
# Create symbolic links
172175
#
173-
config.create_link(os.path.join(bg_dir, hgrid_bg), os.path.join(interp_dir, "bg.gr3"))
174-
config.create_link(os.path.join(bg_dir, hgrid_fg), os.path.join(interp_dir, "fg.gr3"))
175-
config.create_link(os.path.join(bg_dir, vgrid_bg), os.path.join(interp_dir, "vgrid.bg"))
176-
config.create_link(os.path.join(bg_dir, vgrid_fg), os.path.join(interp_dir, "vgrid.fg"))
176+
print("\nFiles linked:")
177+
print(f"{os.path.join(bg_dir, hgrid_bg)} -> {os.path.join(interp_dir, 'bg.gr3')}")
178+
print(f"{os.path.join(fg_dir, hgrid_fg)} -> {os.path.join(interp_dir, 'fg.gr3')}")
179+
print(f"{os.path.join(bg_dir, vgrid_bg)} -> {os.path.join(interp_dir, 'vgrid.bg')}")
180+
print(f"{os.path.join(fg_dir, vgrid_fg)} -> {os.path.join(interp_dir, 'vgrid.fg')}")
181+
182+
config.create_link(os.path.join(bg_dir, hgrid_bg), os.path.join(interp_dir, 'bg.gr3'))
183+
config.create_link(os.path.join(fg_dir, hgrid_fg), os.path.join(interp_dir, 'fg.gr3'))
184+
config.create_link(os.path.join(bg_dir, vgrid_bg), os.path.join(interp_dir, 'vgrid.bg'))
185+
config.create_link(os.path.join(fg_dir, vgrid_fg), os.path.join(interp_dir, 'vgrid.fg'))
177186

178187
"""
179188
#
@@ -188,8 +197,8 @@ def uv3d(
188197
if write_clinic == True:
189198
shutil.move(os.path.join(interp_dir, "uv3D.th.nc"), os.path.join(bg_dir, "uv3D.th.nc"))
190199
"""
191-
print(f"Running `interpolate_variables8` in {bg_output_dir}")
192-
os.chdir(bg_output_dir)
200+
print(f"Running `interpolate_variables8` in {os.path.abspath(os.path.join(bg_dir,bg_output_dir))}")
201+
os.chdir(os.path.abspath(os.path.join(bg_dir,bg_output_dir)))
193202
command = "module load intel/2024.0 hmpt/2.29 hdf5/1.14.3 netcdf-c/4.9.2 netcdf-fortran/4.6.1 schism/5.11.1 \n interpolate_variables8"
194203
os.system(command)
195204

0 commit comments

Comments
 (0)