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

Ethan Alpert ealpert at digitalglobe.com
Mon Apr 10 13:46:22 EDT 2006



You could reformat the netCDF. Perhaps there's something in the netCDF
operators (http://nco.sourceforge.net/). You could use NCL from NCAR to
load the data reorder and write netcdf (http://www.ncl.ucar.edu/)

-e

-----Original Message-----
From: gdal-dev-bounces at lists.maptools.org
[mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Matthew Perry
Sent: Monday, April 10, 2006 11:17 AM
To: Gdal-Dev
Subject: [Gdal-dev] NetCDF.. the world turned upside-down

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 Perry
perrygeo at gmail.com
http://www.perrygeo.net

_______________________________________________
Gdal-dev mailing list
Gdal-dev at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/gdal-dev




More information about the Gdal-dev mailing list