Skip to content

Commit

Permalink
Write combined file as NETCDF3_64BIT_DATA
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Jan 10, 2025
1 parent 7733960 commit c1bf043
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions compass/ocean/tests/utility/combine_topo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,8 @@ def _combine(self):
combined[field] = combined[field].where(valid, fill_val)

# Save combined bathy to NetCDF
_write_netcdf_with_fill_values(combined, self.outputs[1])
_write_netcdf_with_fill_values(combined, self.outputs[1],
format='NETCDF3_64BIT_DATA')

logger.info(' Done.')

Expand All @@ -670,7 +671,7 @@ def _cleanup(self):
logger.info(' Done.')


def _write_netcdf_with_fill_values(ds, filename):
def _write_netcdf_with_fill_values(ds, filename, format='NETCDF4'):
""" Write an xarray Dataset with NetCDF4 fill values where needed """
fill_values = netCDF4.default_fillvals
encoding = {}
Expand All @@ -687,4 +688,4 @@ def _write_netcdf_with_fill_values(ds, filename):
break
else:
encoding[var_name] = {"_FillValue": None}
ds.to_netcdf(filename, encoding=encoding)
ds.to_netcdf(filename, encoding=encoding, format=format)

0 comments on commit c1bf043

Please sign in to comment.