[Gdal-dev] Scaling rasters
Frank Warmerdam
warmerdam at pobox.com
Wed Feb 7 13:30:23 EST 2007
Jose Luis Gomez Dans wrote:
> Hi! I have a raster with value between 1 and 100, and also 0s (these are
> NODATA). I want to set all the pixels with valid values (DN>=1) to a set
> value (let's call it Z), while leaving the rest at 0. I have tried
> gdal_translate -scale 1 100 Z Z, I get something which is half-way there: I
> get Z where Z should be, but (Z-1) where I should have 0. Apart from writing
> a little program that does this, can the gdal standard utility programs be
> used for this?
>
> Thanks! jose
Jose,
I can't think of any way to accomplish this with the commandline utilities.
A small python script using Numeric and GDAL should be able to do the trick,
though I don't see anything too similar in the samples directory.
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