[gdal-dev] netcdf to geotiff and aaigrid

Jeff Van Dorn vandorn at atmosresearch.com
Mon Jan 21 17:39:50 EST 2008


Hello,

I'm hoping someone can set me straight in how to go about converting  
a bunch of netCDF files I have into both GTiff and AAIGrid formats,  
as my initial attempts have failed.  I'm using gdal version "GDAL  
1.6.0dev, FWTools 2.0.4, released 2007/12/21".

The netCDF data is on a 0.125 x 0.125 degree regular lat/lon grid  
(sample file at: http://temagami.tosm.ttu.edu/~jvandorn/gdal/ 
NE_1961-1990_Yearly_Max_Temp.nc).  I create this netCDF file from  
some ASCII data, and the ncdump is at bottom of email, which includes  
an abbreviated list of lat/lons.  It opens/displays fine in GrADS, so  
it seems to be a valid netCDF file; however, I'm not sure if there  
are any other data descriptors that I need to include in the file to  
allow the proper creation of GTiff or AAIGrid files.

I do seem to be able to create a mostly valid AAIGrid file by simply  
doing:  gdal_translate -of AAIGrid, BUT it appears upside-down when  
putting into something that can read that format, even though the  
header info seems MOSTLY correct (I'd think yll should really be  
38.0000 (min of latitudes in netCDF file - 1/2 grid size, (or 38.0625  
- 0.0625)):

ncols        110
nrows        80
xllcorner    -80.750000000000
yllcorner    28.000000000000
cellsize     0.125000000000

But, overall the image appears to be correct, other than inverted in  
the y direction, which I'm not really sure how to correct.

When I try to convert to the GTiff, from either the AAIGrid or netCDF  
format, all I get is a black rectangle as an image.  When going from  
netCDF to GTiff, I've tried -a_srs NAD83 and 27 (although I honestly  
don't know what exact projection it's on, other than it's just a  
regular lat/lon grid), but neither seem to help.  I'm not really sure  
what other settings to attempt to play with when converting to GTiff  
from either format.

Here's the gdalinfo from the AAIGrid to GTiff attempt:
-----------------------  start of data ------------------------------
Driver: GTiff/GeoTIFF
Files: aaigrid_to_gtiff.tif
Size is 110, 80
Coordinate System is `'
Origin = (-80.750000000000000,38.000000000000000)
Pixel Size = (0.125000000000000,-0.125000000000000)
Image Structure Metadata:
   INTERLEAVE=BAND
Corner Coordinates:
Upper Left  ( -80.7500000,  38.0000000)
Lower Left  ( -80.7500000,  28.0000000)
Upper Right ( -67.0000000,  38.0000000)
Lower Right ( -67.0000000,  28.0000000)
Center      ( -73.8750000,  33.0000000)
Band 1 Block=110x18 Type=Float32, ColorInterp=Gray
   NoData Value=-999
-----------------------  end of data ------------------------------

Basically, I'm looking for any suggestions that people have to offer.

Thanks for any suggestions.
Jeff


------------  ncdump of NE_1961-1990_Yearly_Max_Temp.nc --------------
netcdf NE_1961-1990_Yearly_Max_Temp {
dimensions:
         lat = 80 ;
         lon = 110 ;
variables:
         float lat(lat) ;
                 lat:units = "degrees_north" ;
         float lon(lon) ;
                 lon:units = "degrees_east" ;
         float tmax(lat, lon) ;
                 tmax:units = "degrees C" ;
                 tmax:long_name = "Maximum Air Temperature" ;
                 tmax:_FillValue = -999.f ;

// global attributes:
                 :title = "1961-1990 Yearly Averaged 1/8 degree by  
1/8 degree Downscaled Data" ;
                 :creation_date = "Mon Jan 21 13:24:35 CST 2008" ;

data:

  lat = 38.0625, 38.1875, 38.3125, 38.4375, 38.5625, 38.6875, 38.8125,
     ...removed some lines...
     47.9375 ;

  lon = -80.6875, -80.5625, -80.4375, -80.3125, -80.1875, -80.0625,  
-79.9375,
     ...removed some lines
     -67.5625, -67.4375, -67.3125, -67.1875, -67.0625 ;


}





More information about the gdal-dev mailing list