I think the logic that is used to handle environment variables are wrong in the following code,
Traceback (most recent call last):
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/ush/test.py", line 12, in <module>
_files = gen_bctides.execute(schism, datetime.strptime(cycle, '%Y-%m-%d %H:%M:%S'), 1, output_dir=rundir)
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/ush/utils/schism/gen_bctides.py", line 447, in execute
bctides.write(
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/python_test/envs/lib/python3.9/site-packages/pyschism/forcing/bctides/bctides.py", line 265, in write
f.write(str(self))
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/python_test/envs/lib/python3.9/site-packages/pyschism/forcing/bctides/bctides.py", line 139, in __str__
amp, phase = self.tides.get_elevation(constituent, vertices)
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/python_test/envs/lib/python3.9/site-packages/pyschism/forcing/bctides/tides.py", line 141, in get_elevation
return self.tidal_database.get_elevation(constituent, vertices)
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/python_test/envs/lib/python3.9/site-packages/pyschism/forcing/bctides/tpxo.py", line 43, in get_elevation
amp = self._get_interpolation(
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/python_test/envs/lib/python3.9/site-packages/pyschism/forcing/bctides/tpxo.py", line 125, in _get_interpolation
ncarray = self.h
File "/work2/noaa/nems/tufuk/COASTAL/ufs-coastal-app/python_test/envs/lib/python3.9/site-packages/pyschism/forcing/bctides/tpxo.py", line 104, in h
if not self._h_file.exists():
AttributeError: 'str' object has no attribute 'exists'
I think the logic that is used to handle environment variables are wrong in the following code,
pyschism/pyschism/forcing/bctides/tpxo.py
Line 100 in ee6d355
I am getting following error in my case,
If you provide absolute path to the
TPXO_ELEVATIONand the file is in there thenself._h_filewould be string andself._h_file.exists()would fail since string has no exists method.. I think same logic is also used in other places and needs to be fixed. This code was working in some Python environment but it is giving error in others. So, I think that some Python versions is able to handle this situation but some others not. It would be nice to fix it.