[Gdal-dev] NetCDF.. the world turned upside-down

Frank Warmerdam warmerdam at pobox.com
Mon Apr 10 13:38:17 EDT 2006


Matthew Perry wrote:
> Hey folks,
> 
>  I ran into an issue using GDAL to access a NetCDF file;  The lower
> lattitude of the dataset is further north than the upper lattitude!
> 
> $ gdalinfo sstnc.nc
> ...
> Corner Coordinates:
> Upper Left  ( -79.6223913,  31.3360993) ( 79d37'20.61"W, 31d20'9.96"N)
> Lower Left  ( -79.6223913,  36.9168329) ( 79d37'20.61"W, 36d55'0.60"N)
> Upper Right ( -72.8531371,  31.3360993) ( 72d51'11.29"W, 31d20'9.96"N)
> Lower Right ( -72.8531371,  36.9168329) ( 72d51'11.29"W, 36d55'0.60"N)
> Center      ( -76.2377642,  34.1264661) ( 76d14'15.95"W, 34d 7'35.28"N)
> ...
> 
> gdal_translating the image yields an upside-down image as a result.  I
> can get around it by adding ground control points and warping the
> image:
> 
> $ gdal_translate \
>  -gcp 0   0   -79.6223913 31.3360993 \
>  -gcp 512 511 -72.8531371 36.9168329 \
>  -gcp 0   511 -79.6223913 36.9168329 \
>  -gcp 512 0   -72.8531371 31.3360993 \
>   sstnc.nc sstnc_gcp.tif
> $ gdalwarp sstnc_gcp.tif sstnc_good.tif
> 
> While this seems to work OK, the image is now 559x461 whereas the
> original image is 513x512 and the pixel size has been altered
> accordingly which causes alot of unneccesary resampling.
> 
> Is there a way to get gdal utilities to recognize the upside-down
> nature of the image and "flip" it accordingly without
> warping/resampling it?? Or does this call for using the GDAL API?

Matt,

I can't think of any mechanism to deal with this as a user other than
GCPs or perhaps writing out a VRT file and manually editing the
geotransform.

If you can supply the file to Denis Nadeau (denis.nadeau at gmail.com)
he can work on improving the driver to handle it out of the box.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list