-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use compression on input/output netcdfs #95
Comments
These are some notes from a different project, but they are relevant to the task at hand: Creating archivesWhen saving data to disk you usually want to use compression.
When creating new archives (netcdf/zarr/whatever)
encoding = dict(
SID={"zlib": True, "complevel": 1}
time={"zlib": True, "complevel": 1}
lat={"zlib": True, "complevel": 1}
lon={"zlib": True, "complevel": 1}
)
ds.to_netcdf(path="/path/to/foo.nc", encoding=encoding) |
@pmav99 We do have the option to use compression in the |
I would keep on using netcdfs for now AFAIK it should be possible to use zarr to store meshes, too, because zarr is pretty much a container format like XML and you can store anything you want inside it, but you would have to come up with a suitable mesh representation on your own. A couple of relevant links: |
I tested this patch: diff --git a/pyposeidon/schism.py b/pyposeidon/schism.py
index 0a491ae..62368cc 100644
--- a/pyposeidon/schism.py
+++ b/pyposeidon/schism.py
@@ -382,7 +382,9 @@ class Schism:
filename = kwargs.get("filename", "sflux/sflux_air_{}.0001.nc".format(m_index))
- sout.to_netcdf(path + filename)
+ encoding = {name: {"zlib": True, "complevel": 1} for name in sout.data_vars}
+ sout.to_netcdf(path + filename, encoding=encoding)
+ logger.info("Finished writing meteo files ..\n")
# ============================================================================================
# DEM with this script: import logging
import pyposeidon.meteo as pmeteo
logger = logging.basicConfig(
level=10,
style="{",
datefmt="%I:%M:%S",
format="{asctime:s}; {name:<25s} {funcName:<15s} {lineno:4d}; {message:s}",
)
meteo = pmeteo.Meteo(
meteo_source="20220725.00.tropical_cyclone.grib",
)
meteo.to_output(solver_name='schism', rpath='./test_c1/') The initial size of the GRIB is 5.4GB. The uncompressed netcdf is 25GB and the compressed netcdf (with If schism can read files created with |
I tried compressing the uncompressed netcdf file with
|
We should try to use compression in our input/output netcdfs.
The text was updated successfully, but these errors were encountered: