Skip to content

Commit

Permalink
Make temp directory an absolute path if it is supplied
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Sep 5, 2020
1 parent 69da3bc commit 63ef928
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions conda_package/mpas_tools/mesh/conversion.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ def convert(dsIn, graphInfoFileName=None, logger=None, dir=None):
dsOut : ``xarray.Dataset``
The MPAS mesh
"""
if dir is not None:
dir = os.path.abspath(dir)
with TemporaryDirectory(dir=dir) as tempdir:
inFileName = '{}/mesh_in.nc'.format(tempdir)
write_netcdf(dsIn, inFileName)
Expand Down Expand Up @@ -108,7 +110,8 @@ def cull(dsIn, dsMask=None, dsInverse=None, dsPreserve=None,
The culled mesh
"""

if dir is not None:
dir = os.path.abspath(dir)
with TemporaryDirectory(dir=dir) as tempdir:
inFileName = '{}/ds_in.nc'.format(tempdir)
write_netcdf(dsIn, inFileName)
Expand Down Expand Up @@ -193,7 +196,8 @@ def mask(dsMesh, fcMask=None, fcSeed=None, positiveLon=False, logger=None,
The masks
"""

if dir is not None:
dir = os.path.abspath(dir)
with TemporaryDirectory(dir=dir) as tempdir:
inFileName = '{}/mesh_in.nc'.format(tempdir)
write_netcdf(dsMesh, inFileName)
Expand Down

0 comments on commit 63ef928

Please sign in to comment.