4

I can create a NetCDF file (using the Python netCDF4 library) and load it in QGIS. However, as the size of these files gets sometimes quite big, I try to compress my data. This works very well using

createVariable(h, 'float32', ("y","x"), zlib=True,complevel=3,chunksizes=(1,len(x)),fill_value=np.nan)

However, playing around a bit showed that chunking both dimensions (e.g. chunksizes=(100,100) or chunksizes=(len(y),len(x))) reduced the resulting file size by more than 50%. Unfortunately, in this case I am not able any more to load this grid correctly to QGIS. The only chunksize that works is chunking only the rightmost variable (1,len(x)). I guess, this has something to do with the GDAL. About QGIS says:

QGIS version 2.14.12-Essen

Compiled against GDAL/OGR 1.10.1

Running against GDAL/OGR 1.11.2

I'm working on Ubuntu14.04 and installed QGIS via the debian-ltr PPA. Is there any way to make other chunksizes work too? Would an update to QGIS 2.18 help or is this an issue with GDAL?

1
  • 2
    It looks like the UbuntuGIS gdal build includes support for netcdf4/hdf5 which is required for chunked files. Try adding the ubuntugis-unstable ppa and switching your qgis repo from debian-ltr to the release with ubuntugis dependencies qgis.org/ubuntugis-ltr – user2856 Mar 4 '17 at 19:05
2

Great, with the UbuntuGIS repositories, it works! Big chunk sizes in secondary dimensions need very long to load in QGIS, but small chunk sizes (I use 100 now) are nicely fast and still reduce the NetCDF file size remarkably. Thanks, Luke!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.