How can a make a netcdf with subgroups smaller?

المشرف العام

Administrator
طاقم الإدارة
I'm trying to write a test for code that works with hycom netcdf global ocean circulation data. The source file 2 subdatasets:

gdalinfo hycom_glb_911_2015110200_t000_uv3z.nc | grep _NAME SUBDATASET_1_NAME=NETCDF:"hycom_glb_911_2015110200_t000_uv3z.nc":water_u SUBDATASET_2_NAME=NETCDF:"hycom_glb_911_2015110200_t000_uv3z.nc":water_vWith 40 depth bands:

gdalinfo NETCDF:hycom_glb_911_2015110200_t000_uv3z.nc:water_u | grep '^Band' | head -3Band 1 Block=4500x1 Type=Int16, ColorInterp=UndefinedBand 2 Block=4500x1 Type=Int16, ColorInterp=UndefinedBand 3 Block=4500x1 Type=Int16, ColorInterp=UndefinedI've got some code written the does things like calculate the speed in m/s from the UV and creates a geotiff, etc. The original files are much too large for using in unittests. Is there an easy way with gdal, nco or ? to keep the structure and metadata, but create a much smaller file? I'm open to dropping all but the first two bands and writing a constant value into each band + turning on deflate compression.

Trying with GDAL:

gdal_translate --version # At head -> r31584GDAL 2.1.0dev, released 2015/99/99gdal_translate hycom_glb_911_2015110200_t000_uv3z.nc hycom_glb_911_2015110200_t000_uv3z-try2.nc -of netcdf -co compress=deflateInput file contains subdatasets. Please, select one of them for reading.The originals are quite a bit large for tests:

ls -lh hycom_glb_911_2015110200_t000_uv3z.nc-rw-r----- 1 schwehr group 1.4G Nov 19 09:13 hycom_glb_911_2015110200_t000_uv3z.nc

أكثر...
 
أعلى