Skip to content

Commit b81ebae

Browse files
authored
Delete the temporary NETCDF4 file if converting to CDF5
1 parent d0b649b commit b81ebae

File tree

1 file changed

+3
-1
lines changed
  • conda_package/mpas_tools

1 file changed

+3
-1
lines changed

conda_package/mpas_tools/io.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def write_netcdf(
122122

123123
if convert:
124124
basename, extension = os.path.splitext(fileName)
125-
out_filename = f'{basename}.netcdf4{extension}'
125+
out_filename = f'_tmp_{basename}.netcdf4{extension}'
126126
format = 'NETCDF4'
127127
if engine == 'scipy':
128128
# that's not going to work
@@ -151,6 +151,8 @@ def write_netcdf(
151151
)
152152
else:
153153
check_call(args, logger=logger)
154+
# delete the temporary NETCDF4 file
155+
os.remove(out_filename)
154156

155157

156158
def update_history(ds):

0 commit comments

Comments
 (0)