[gdal-dev] netcdf to geotiff and aaigrid
Jeff Van Dorn
vandorn at atmosresearch.com
Tue Jan 22 12:08:53 EST 2008
On Jan 21, 2008, at 7:59 PM, Frank Warmerdam wrote:
> Jeff Van Dorn wrote:
>> 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".
> ...
>> 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.
>
> Jeff,
>
> I tried translating this file with my linux build of GDAL and the
> output
> AAIGRID header looks like:
>
> ncols 110
> nrows 80
> xllcorner -80.750000000000
> yllcorner 38.000000000000
> cellsize 0.125000000000
> NODATA_value -999
>
> I'm not at all sure why you get a yllcorner of 28 when I get 38. I
> displayed the file directly, and the output aaigrid file and both
> seemed
> "right side up" and otherwise normal.
Frank,
Thanks for the reply.
That is certainly strange that you get 38.0. I just built version
1.5.0 from scratch, but I still don't get 38.0 (here's my session):
jvandorn at temagami:~/public_html/gdal> gdal_translate --version
GDAL 1.5.0, released 2007/12/18
jvandorn at temagami:~/public_html/gdal> gdal_translate -of AAIGrid
NE_1961-1990_Yearly_Max_Temp.nc NE_1961-1990_Yearly_Max_Temp.ASC
Warning 1: No UNIDATA NC_GLOBAL:Conventions attribute
Input file size is 110, 80
0...10...20...30...40...50...60...70...80...90...100 - done.
jvandorn at temagami:~/public_html/gdal> head -n 5
NE_1961-1990_Yearly_Max_Temp.ASC
ncols 110
nrows 80
xllcorner -80.750000000000
yllcorner 28.000000000000
cellsize 0.125000000000
Are you doing anything other than just gdal_translate -of AAIGrid,
when converting that file? I wouldn't really care all that much if I
was just needing to convert this one file, as it's easy enough to
manually change, but as I literally have thousands of files to
convert to both AAIGrid and GTiff (with lots of different domains),
it'd be nice to have it done automatically.
I don't know if this could be related to what Joaquim said, in that
the appearing upside-down is a known issue with the netCDF driver.
So, yours truly was not upside down? A gif image of the data is
here: http://temagami.tosm.ttu.edu/~jvandorn/gdal/
NE_1961-1990_Yearly_Max_Temp.gif
>> 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.
>
> I suspect this has more to do with the software you are displaying
> the GeoTIFF file with than the actual data. Many software packages
> don't do particularly savvy autoscaling of floating point image data.
>
> Have you tried displaying it in OpenEV?
I'm not having any luck with OpenEV, just seg faults on me (using the
FWTools version) when I attempt to open an image.
I've tried opening the generated GeoTiffs in ESRI's ArcMap. I've
been successful in opening other sample GeoTiffs with that program,
but not the Tiff's I created (I also just get the black rectangle for
GIF/JPEGs if that helps to diagnose at all).
>
> BTW, were you using the linux or win32 version of FWTools.
Using the linux version, and I've tried both OpenEV and
gdal_translate on 2 different machines:
machine 1) Linux temagami 2.6.11.4-21.15-smp #1 SMP Tue Nov 28
13:39:58 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
machine 2) Linux linuxlt 2.6.5-7.252-smp #1 SMP Tue Feb 14 11:11:04
UTC 2006 i686 i686 i386 GNU/Linux
I built the latest GDAL code today on both machines. I had to do --
without-libtool on the 64bit version, but otherwise, didn't specify
anything when I ran configure on either machine.
Thanks for the help,
Jeff
>
> 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 OSGeo, http://
> osgeo.org
>
More information about the gdal-dev
mailing list