[Gdal-dev] Re: NetCDF.. the world turned upside-down
Emilio Mayorga
emiliomayorga at gmail.com
Tue Apr 11 02:28:21 EDT 2006
"Reversed" y-axis datasets are quite common in netcdf (Ferret, for
example, pretty much expects that convention -- or at least it did a
couple of years ago...). It's not required, but it's probably the
dominant convention. I think it boils down to the common use of matrix
math in geophysics; the y-axis is seen as positive-up. Unlike the
GIS/imagery/"raster" world, where the vertical dimension is
interpreted as increasing from the top down.
Having gdal_translate and other gdal utilities interpret flipped
netcdf y-axis automatically (or providing an optional argument) would
be very useful.
My 2 cents.
-Emilio Mayorga
> From: Frank Warmerdam <warmerdam at pobox.com>
> To: Matthew Perry <perrygeo at gmail.com>
> Date: Mon, 10 Apr 2006 13:38:17 -0400
> Subject: Re: [Gdal-dev] NetCDF.. the world turned upside-down
> 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