Skip to content
Snippets Groups Projects
Commit 783cbdc0 authored by Frisinghelli Daniel's avatar Frisinghelli Daniel
Browse files

Added NetCDF file compression.

parent 71533523
No related branches found
No related tags found
No related merge requests found
......@@ -179,9 +179,14 @@ if __name__ == '__main__':
# set encoding of time: calendar
ds.time.encoding = ds.time_bnds.encoding
# set NetCDF file compression for each variable
for _, var in ds.data_vars.items():
var.encoding['zlib'] = True
var.encoding['complevel'] = 5
# save aggregated netcdf file
LOGGER.info('Saving aggregated NetCDF: {}'.format(filename))
ds.to_netcdf(filename)
LOGGER.info('Compressing NetCDF: {}'.format(filename))
ds.to_netcdf(filename, engine='h5netcdf')
# remove single netcdf files from disk
if args.remove:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment