[gdal-dev] reading multidimension netCDF using gdal
Giuseppe Amatulli
giuseppe.amatulli at gmail.com
Thu Apr 14 14:33:32 PDT 2016
Hi,
I'm trying to merge this 3 tif files having different pixel resolution in
one single file.
wget https://dl.dropboxusercontent.com/u/29337496/nc/tpi_max_km10.tif
wget https://dl.dropboxusercontent.com/u/29337496/nc/tpi_max_km50.tif
wget https://dl.dropboxusercontent.com/u/29337496/nc/tpi_max_km100.tif
According to my understanding the only raster format that support
different pixel resolution are HDF & NetCDF.
I opt for the NetCDF format and I wrote the following script that, change
the format from tif to nc, change some internal parameters using NCO and in
the end merge (grupping - in NCO terminology) the *.nc together.
longname=Topographic_position_index
VAR=tpi_max_km
for km in 10 50 100 ; do
if [ $km -eq 10 ] ; then b=1 ; fi
if [ $km -eq 50 ] ; then b=2 ; fi
if [ $km -eq 100 ] ; then b=3 ; fi
gdal_translate -of netCDF -co ZLEVEL=9 -co COMPRESS=DEFLATE -co
FORMAT=NC4C $VAR$km.tif $VAR$km.nc
### Change some parameters
ncatted -O -a long_name,Band1,o,c,${longname} $VAR$km.nc -h
ncatted -O -a long_name,lon,o,c,Longitude $VAR$km.nc -h
ncatted -O -a long_name,lat,o,c,Latitude $VAR$km.nc -h
ncatted -O -a _FillValue,Band1,o,i,-9999 $VAR$km.nc -h
ncrename -v Band1,${VAR}${km} $VAR$km.nc -h
done
# create multi-dimension nc
ncecat --gag tpi_max_km10.nc tpi_max_km50.nc tpi_max_km100.nc out.nc
The problem comes when I want read the output using gdal.
gdalinfo out.nc
Warning 1: out.nc is a netCDF file, but not in GMT configuration.
gdalinfo failed - unable to open 'out.nc'.
Is gdal 1.10.0 able to read multidimensional NetCDF ?
Can I do "ncecat --gag" (grouping) operation using gdal?
Any ideas?
Thanks
--
Giuseppe Amatulli, Ph.D.
Department of Ecology and Evolutionary Biology, Yale University.
Jetz Lab, OML Room 405
P.O. Box 208106
165 PROSPECT ST
New Haven, CT 06520-8106
Teaching: spatial-ecology.net
Work: http://sbsc.yale.edu/giuseppe-amatulli
<http://www.spatial-ecology.net>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20160414/26a50248/attachment.html>
More information about the gdal-dev
mailing list