DrylandEcology / SOILWAT2

An ecosystem water balance simulation model
GNU General Public License v3.0
5 stars 2 forks source link

Option to choose output format as NCZarr or netCDF-4 (if netCDF-based) #403

Open dschlaep opened 1 month ago

dschlaep commented 1 month ago

See https://docs.unidata.ucar.edu/nug/current/nczarr_head.html

As of netcdf-c v4.9.2: "NCZarr currently is not thread-safe. So any attempt to use it with parallelism, including MPIO, is likely to fail."

"Note specifically that there is no NC_NCZARR flag for the mode argument of nc_create or nc_open. In this case, it is indicated by the URL path."

-> Replace "fileName" with "file://fileName#mode=nczarr,file" or "file://fileName#mode=nczarr,zip" for creating with nc_create(fileName, ...) and opening with nc_open(fileName, ...)

dschlaep commented 1 day ago

Example: convert domain.nc into NCZarr

ncdump tests/example/Input_nc/domain.nc > domain.cdl
ncgen -4 -b -o file://domain.nczarr#mode=nczarr,file domain.cdl
ncdump file://domain.nczarr#mode=nczarr,file > domain_nczarr.cdl