[GRASS-dev] [GRASS GIS] #3265: min and max value options for r.colors

GRASS GIS trac at osgeo.org
Wed Jan 18 08:04:18 PST 2017


#3265: min and max value options for r.colors
--------------------------+-------------------------
  Reporter:  veroandreo   |      Owner:  grass-dev@…
      Type:  enhancement  |     Status:  new
  Priority:  normal       |  Milestone:  7.2.1
 Component:  Raster       |    Version:  unspecified
Resolution:               |   Keywords:  r.colors
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+-------------------------

Comment (by veroandreo):

 Replying to [comment:1 annakrat]:
 > I am not sure I understand, why don't you use color table with absolute
 values in this case?

 Well, that would limit the options in the first place. Besides, the range
 and type of color tables is a pretty hidden information, i.e.: it is not
 in the manual (see ticket #3077 for a related issue, I found it while
 searching if there was already a request similar to mine, just to not
 duplicate).

 IMHO, having min-max value option(s) would be a straightforward way to set
 min and max value for relative color tables and make all the maps
 comparable, without necessarily having to pass a list of maps. Just set
 min and max values of color table after creating each map, as in a loop,
 for example.

 Here, one example:

 {{{
 LST=(Day Night)

 for j in ${LST[*]} ; do
  for i in `seq -w 1 12` ; do

   # monthly climatological counts of valid data
   t.rast.series input=LST_${j}_daily method=count where="strftime('%m',
 start_time)='${i}'" output=LST_${j}_month_count_${i}

   # number of maps per month
   n=`t.rast.list -u input=LST_${j}_daily columns=name
 where="strftime('%m', start_time)='"${i}"'" | wc -l`

   # counts to percentages
   r.mapcalc expression="LST_${j}_month_perc_${i} =
 LST_${j}_month_count_${i}*100.0)/${n}"

   # plots
   d.mon start=cairo output=$HOME/tmp/LST_${j}_month_perc_${i}.png
   d.rast map=LST_${j}_month_perc_${i}
   d.mon stop=cairo
  done
 }}}

 As it is, this gives me maps with different percentage ranges in the
 default color table. To make them comparable, I have to pass the list of
 maps to r.colors once the loop has finished (of course this case is not
 that complicated, or long), and then write a similar loop to make the
 plots. However, with a min-max value option that would be set with
 r.colors inside the loop before plotting and voilà :)

 Hope I explained myself better in this occasion. Thanks for your time :)

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3265#comment:2>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list