[Gdal-dev] Problem using gdal_translate on netcdf file

Chase, Andrew achase at mbari.org
Mon Jan 22 13:24:19 EST 2007


Thanks for the suggestion Hernán, I've already tried this (and tried it again just now to double check). When I set "-ot Byte" I still get a black image, this time in all formats including Gtiff, whereas before I got the vertical banding in Gtiff.

Still searching...

-Andrew


________________________________

	From: gdal-dev-bounces at lists.maptools.org [mailto:gdal-dev-bounces at lists.maptools.org] On Behalf Of Hernán De Angelis
	Sent: Saturday, January 20, 2007 1:21 AM
	To: gdal-dev at lists.maptools.org
	Subject: Re: [Gdal-dev] Problem using gdal_translate on netcdf file
	
	
	Your files are in Float32 format, try rescaling them to 8bit:   gdal_translate -ot Byte
	
	
	2007/1/20, Chase, Andrew <achase at mbari.org>: 

		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 <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 


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




	-- 
	
	Hernán De Angelis
	Linux user # 397217 





More information about the Gdal-dev mailing list