<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    OK, looks like [3] for me.  Thanks.<br>
    <br>
    On 7/28/2011 3:01 PM, Chaitanya kumar CH wrote:
    <blockquote
cite="mid:CAMKgpOZqdEo1DqyeLRAKzV9mh+_HCxEosz0yz-O4q2Wtq8HG=Q@mail.gmail.com"
      type="cite">The closest thing you can do without doing any coding
      is to use the gdal_contour utility[1] to create a vector file and
      then use gdal_rasterize [2] to burn them back to a raster. If you
      use appropriate options, all your pixels will be clamped to the
      discrete levels used in gdal_contour. It's straight forward to
      apply a color table to that.<br>
      <br>
      If you want to do this using a script, refer to the gdal API
      tutorial[3]. You'll have to do the classification while you read
      and write the pixels using GDALRasterIO(). You can set the color
      table too.<br>
      <br>
      Note that there may be some differences along the edges of
      classified pixels between these two methods. The lines generated
      by gdal_contour may go through the area of a pixel and could
      change the burn value.<br>
      <br>
      [1]: <a moz-do-not-send="true"
        href="http://www.gdal.org/gdal_contour.html">http://www.gdal.org/gdal_contour.html</a><br>
      [2]: <a moz-do-not-send="true"
        href="http://www.gdal.org/gdal_rasterize.html">http://www.gdal.org/gdal_rasterize.html</a><br>
      [3]: <a moz-do-not-send="true"
        href="http://www.gdal.org/gdal_tutorial.html">http://www.gdal.org/gdal_tutorial.html</a><br>
      <br>
      <div class="gmail_quote">On Fri, Jul 29, 2011 at 12:05 AM, Stephen
        Crawford <span dir="ltr">&lt;<a moz-do-not-send="true"
            href="mailto:src176@psu.edu">src176@psu.edu</a>&gt;</span>
        wrote:<br>
        <blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div bgcolor="#ffffff" text="#000000"> Thanks for the reply. 
            I had looked at these before, and then looked again after
            your note, but I just don't understand how I map the climate
            variable values to different colors in the palette, along
            the lines of:<br>
            <br>
            tmax &lt; 30            |  color1<br>
            30 &lt; tmax &lt; 50   | color2<br>
            tmax &gt; 50            | color3<br>
            <br>
            Thanks,<br>
            Steve
            <div>
              <div class="h5"><br>
                <br>
                On 7/27/2011 1:01 AM, Chaitanya kumar CH wrote:
                <blockquote type="cite">Sorry, here are the links.<br>
                  <br>
                  [1]: <a moz-do-not-send="true"
                    href="http://www.gdal.org/rgb2pct.html"
                    target="_blank">http://www.gdal.org/rgb2pct.html</a><br>
                  <br>
                  [2]: <a moz-do-not-send="true"
                    href="http://www.gdal.org/gdal_vrttut.html"
                    target="_blank">http://www.gdal.org/gdal_vrttut.html</a><br>
                  [3]: <a moz-do-not-send="true"
                    href="http://www.gdal.org/formats_list.html"
                    target="_blank">http://www.gdal.org/formats_list.html</a><br>
                  <br>
                  <div class="gmail_quote">On Wed, Jul 27, 2011 at 10:30
                    AM, Chaitanya kumar CH <span dir="ltr">&lt;<a
                        moz-do-not-send="true"
                        href="http://chaitanya.ch" target="_blank">chaitanya.ch</a>@<a
                        moz-do-not-send="true" href="http://gmail.com"
                        target="_blank">gmail.com</a>&gt;</span> wrote:<br>
                    <blockquote class="gmail_quote" style="margin: 0pt
                      0pt 0pt 0.8ex; border-left: 1px solid rgb(204,
                      204, 204); padding-left: 1ex;">Stephen,<br>
                      <br>
                      The docs for rgb2pct.py script [1] has an example
                      that shows how to convert to a paletted image
                      using hand made VRT file.<br>
                      You can use the "-of PNG" option to set the
                      destination format as png and the -pct option with
                      your VRT file.
                      <div>
                        <div><br>
                          <br>
                          <div class="gmail_quote">On Wed, Jul 27, 2011
                            at 2:42 AM, Stephen Crawford <span
                              dir="ltr">&lt;<a moz-do-not-send="true"
                                href="mailto:src176@psu.edu"
                                target="_blank">src176@psu.edu</a>&gt;</span>
                            wrote:<br>
                            <blockquote class="gmail_quote"
                              style="margin: 0pt 0pt 0pt 0.8ex;
                              border-left: 1px solid rgb(204, 204, 204);
                              padding-left: 1ex;"> Hi All,<br>
                              <br>
                              I have 60 or so asciiGrids of climate data
                              that I would like to tun into PNGs, with
                              the climate values classified by color.  I
                              would like to script this process using
                              Python.  Is there a way to do this with
                              GDAL?  Or if not, is there any other open
                              source way to do this?<br>
                              <br>
                              Thanks,<br>
                              Steve<br>
                              <br>
                              <br>
_______________________________________________<br>
                              gdal-dev mailing list<br>
                              <a moz-do-not-send="true"
                                href="mailto:gdal-dev@lists.osgeo.org"
                                target="_blank">gdal-dev@lists.osgeo.org</a><br>
                              <a moz-do-not-send="true"
                                href="http://lists.osgeo.org/mailman/listinfo/gdal-dev"
                                target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
                            </blockquote>
                          </div>
                          <br>
                          <br clear="all">
                          <br>
                        </div>
                      </div>
                      <font color="#888888">-- <br>
                        Best regards,<br>
                        Chaitanya kumar CH.<br>
                        <br>
                        +91-9494447584<br>
                        17.2416N 80.1426E<br>
                      </font></blockquote>
                  </div>
                  <br>
                  <br clear="all">
                  <br>
                  -- <br>
                  Best regards,<br>
                  Chaitanya kumar CH.<br>
                  <br>
                  +91-9494447584<br>
                  17.2416N 80.1426E<br>
                </blockquote>
                <br>
              </div>
            </div>
            <font color="#888888">
              <pre cols="72">-- 
Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University
<a moz-do-not-send="true" href="mailto:src176@psu.edu" target="_blank">src176@psu.edu</a>
814.865.9905</pre>
            </font></div>
        </blockquote>
      </div>
      <br>
      <br clear="all">
      <br>
      -- <br>
      Best regards,<br>
      Chaitanya kumar CH.<br>
      <br>
      +91-9494447584<br>
      17.2416N 80.1426E<br>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Stephen Crawford
Center for Environmental Informatics
The Pennsylvania State University
<a class="moz-txt-link-abbreviated" href="mailto:src176@psu.edu">src176@psu.edu</a>
814.865.9905</pre>
  </body>
</html>