schism-dev / pyschism

Python interface for handling the SCHISM model.
https://schism-dev.github.io/schism/master/getting-started/pre-processing-with-pyschism/overview.html
Apache License 2.0
23 stars 18 forks source link

Fixed path issue when specifying tpxo inputs using environment variab… #119

Closed tomdurrant closed 5 months ago

tomdurrant commented 5 months ago

…les. Fixes #118

cuill commented 5 months ago

@tomdurrant In this commit, when os.getenv('TPXO_ELEVATION') is None, pathlib.Path() will return a TypeError. I would suggest seperate os.getenv and pathlib.Path as following:

if self._h_file is None:
    self._h_file = os.getenv('TPXO_ELEVATION')
    if self._h_file is None:
        self._h_file = pathlib.Path(appdirs.user_data_dir('tpxo')) / TPXO_ELEVATION
    elif type(self._h_file) is str:
        self._h_file = pathlib.Path(self._h_file)

Same thing as TPXO_VELOCITY. Thanks.

tomdurrant commented 5 months ago

@cuill I have pushed a fix, but looks like you have already fixed it. Sorry for the slow response!

cuill commented 5 months ago

@tomdurrant No worries. I am going to close this PR since it was resolved. Thanks for your contribution.