[Gdal-dev] Problem using gdal_translate on netcdf file

Chase, Andrew achase at mbari.org
Fri Jan 19 21:58:10 EST 2007


Hi All,

I'm trying to convert a netcdf file to some an image format that I can use with imagemagick (tiff, jpg, png, anything will do). Unfortunately, I'm having some troubles getting the job done. When I try gdal_translate with any format other than Gtiff I get a completely black image. When I use the Gtiff format, I get a weird grayscale mutated version of my source file, with strange grainy vertical bands. When I open the netcdf file in OpenEV it looks perfectly normal, and I use the netcdf file for a lot of different data processing, so I feel confident that the data itself is good (if not the formatting of the data).

I've placed a subsetted version of the translated image online to show what the resulting geotiff looks like, it's here:
http://www.mbari.org/staff/achase/vdm/hrbath.tif
Maybe someone else has seen this same type of image problem?

Here's the gdalinfo output:

C:\workspace\vdm\resources\grids>gdalinfo NETCDF:"hrbath.nc":elevation
Driver: netCDF/Network Common Data Format
Size is 5001, 4001
Coordinate System is `'
Origin = (-125.000000000000000,38.000999999999998)
Pixel Size = (0.000999800039992,-0.000999750062484)
Metadata:
  NC_GLOBAL#creationDate=01/19/2007
  NC_GLOBAL#lastModified=01/19/2007
  NC_GLOBAL#Conventions=CF-1.0
  NC_GLOBAL#CreatedBy=VARS Data Mining Software - MBARI
  NC_GLOBAL#title=DEM Grid from hrbath.asc
  NC_GLOBAL#institution=MBARI
  NC_GLOBAL#creator_name=Andrew Chase
  NC_GLOBAL#keywords=dem bathymetry grid
  elevation#positive=up
  elevation#long_name=Elevation
  elevation#missing_value=-9.999900e+004
  elevation#units=meters
  latitude#units=degrees_north (+N/-S)
  longitude#units=degrees_east (+E/-W)
Corner Coordinates:
Upper Left  (-125.0000000,  38.0010000)
Lower Left  (-125.0000000,  34.0010000)
Upper Right (-120.0000000,  38.0010000)
Lower Right (-120.0000000,  34.0010000)
Center      (-122.5000000,  36.0010000)
Band 1 Block=5001x1 Type=Float32, ColorInterp=Undefined
  NoData Value=-99999
  Metadata:
    NETCDF_VARNAME=elevation
----------------------------------------------------------------------------------------------------------

And here's the translation I'm trying:

C:\workspace\vdm\resources\grids>gdal_translate -of GTiff -a_nodata -99999 NETCD
F:"hrbath.nc":elevation hrbath.tif
Input file size is 5001, 4001
0...10...20...30...40...50...60...70...80...90...100 - done.
----------------------------------------------------------------------------------------------------------

And the resulting gdalinfo output:

C:\workspace\vdm\resources\grids>gdalinfo hrbath.tif
Driver: GTiff/GeoTIFF
Size is 5001, 4001
Coordinate System is `'
Origin = (-125.000000000000000,38.000999999999998)
Pixel Size = (0.000999800039992,-0.000999750062484)
Metadata:
  NC_GLOBAL#creationDate=01/19/2007
  NC_GLOBAL#lastModified=01/19/2007
  NC_GLOBAL#Conventions=CF-1.0
  NC_GLOBAL#CreatedBy=VARS Data Mining Software - MBARI
  NC_GLOBAL#title=DEM Grid from hrbath.asc
  NC_GLOBAL#institution=MBARI
  NC_GLOBAL#creator_name=Andrew Chase
  NC_GLOBAL#keywords=dem bathymetry grid
  elevation#positive=up
  elevation#long_name=Elevation
  elevation#missing_value=-9.999900e+004
  elevation#units=meters
  latitude#units=degrees_north (+N/-S)
  longitude#units=degrees_east (+E/-W)
Corner Coordinates:
Upper Left  (-125.0000000,  38.0010000)
Lower Left  (-125.0000000,  34.0010000)
Upper Right (-120.0000000,  38.0010000)
Lower Right (-120.0000000,  34.0010000)
Center      (-122.5000000,  36.0010000)
Band 1 Block=5001x1 Type=Float32, ColorInterp=Gray
  NoData Value=-99999
  Metadata:
    NETCDF_VARNAME=elevation



Any ideas of what to try would be appreciated.

-Andrew


Andrew C. Chase
Software Engineer
Monterey Bay Aquarium Research Institute
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20070119/f7795c6d/attachment.html


More information about the Gdal-dev mailing list