[gdal-dev] substitute pixel values

Joaquim Luis jluis at ualg.pt
Wed Jan 9 09:08:47 PST 2013


Sorry to come out so often with GMT solutions in this GDAL list but 
somethings are so trivial there.

If you can trust that all your negative values are (mean)seawater, this 
will do the job

grdclip yourGrid -Sb0/0 -Gclipped_grid.nc

Note, one need the dev GMT5 version to read all grid formats through 
GDAL, otherwise (GMT4) "yourGrid" should be netCDF

Joaquim

> Michael,
>
> I'm not sure if you can do this using one of the existing utilities, 
> you may be able to do this my creating a virtual file (gdalbuildvrt) 
> and modifying it see - http://www.gdal.org/gdal_vrttut.html, but I 
> have not attempted this.  An alternative is to do this using the API 
> and something like numpy to choose and rewrite pixel values.
> See the following for a example in python 
> http://svn.osgeo.org/gdal/trunk/gdal/swig/python/samples/val_repl.py
>
>
>
>
> On 9 January 2013 11:33, Smith, Michael <Michael.Smith at maine.gov 
> <mailto:Michael.Smith at maine.gov>> wrote:
>
>     I have some DEMs that are created from lidar.  For reasons related
>     to seeing currents and wind effect, we did not ask for the water
>     to be flattened, but rather it shows waves.  This is cool, and
>     what we wanted.  BUT of course now we want to create a second set
>     of DEMs with a  nice flat ocean.
>
>     I have numerous pixels out in the ocean which are slightly less
>     than 0.  So how does one select out all pixels < 0 and substitute
>     them with 0 with GDAL?
>
>     ===============================
>     *Michael Smith MS GISP*
>     State GIS Manager, Maine Office of GIS
>     State of Maine, Office of Information Technology
>     michael.smith _at_ maine.gov <http://maine.gov>
>     207-215-5530 <tel:207-215-5530>
>
>     Board Member, Maine GeoLibrary
>     Education Chair, Maine GIS Users Group
>     State Rep, National States Geographic Information Council
>     icons
>
>     ***NOTE NEW ADDRESS***
>
>     State House Station 145
>     51 Commerce Drive
>     Augusta, ME 04333-0145
>     69^o 47' 58.9"W  44^o 21' 54.8"N
>
>
>     _______________________________________________
>     gdal-dev mailing list
>     gdal-dev at lists.osgeo.org <mailto:gdal-dev at lists.osgeo.org>
>     http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130109/03fed3c2/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 198 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130109/03fed3c2/attachment-0001.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 9032 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130109/03fed3c2/attachment-0001.jpe>


More information about the gdal-dev mailing list