Skip to content

Commit d04d6f5

Browse files
committed
fix bug with zipping not working by itself
1 parent c6a62ab commit d04d6f5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

nctoolkit/runthis.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,15 @@ def run_this(os_command, self, output="one", out_file=None, suppress=False):
239239

240240
if self._zip and zip_copy and format_it is False:
241241
ff_command = ff_command.replace("cdo ", "cdo -z zip copy ")
242+
# find any -b F32 type commands and move them to before the -z zip copy
243+
# use regex for this
244+
match = re.search(r"-b\s+\w+", ff_command)
245+
if match:
246+
bit_command = match.group(0)
247+
ff_command = ff_command.replace(bit_command, "")
248+
ff_command = ff_command.replace(
249+
"cdo -z zip copy ", f"cdo {bit_command} -z zip copy "
250+
)
242251
else:
243252
if self._zip:
244253
ff_command = ff_command.replace("cdo ", "cdo -z zip ")

0 commit comments

Comments
 (0)