Skip to content

Commit

Permalink
adding compression
Browse files Browse the repository at this point in the history
  • Loading branch information
BaptisteVandecrux committed Sep 11, 2024
1 parent ad05dbc commit ec15a39
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/pypromice/process/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ def writeCSV(outfile, Lx, csv_order):


def writeNC(outfile, Lx, col_names=None):
"""Write data product to NetCDF file
"""Write data product to NetCDF file with compression
Parameters
----------
Expand All @@ -187,7 +187,10 @@ def writeNC(outfile, Lx, col_names=None):
else:
names = list(Lx.keys())

Lx[names].to_netcdf(outfile, mode="w", format="NETCDF4", compute=True)
comp = dict(zlib=True, complevel=4)
encoding = {var: comp for var in names}

Lx[names].to_netcdf(outfile, mode="w", format="NETCDF4", compute=True, encoding=encoding)


def getColNames(vars_df, ds, remove_nan_fields=False):
Expand Down

0 comments on commit ec15a39

Please sign in to comment.