[GRASS-user] r.colors

Background

We generate a precipitation graphic that is based on the mean of an ensemble of models. Because it goes out 16 days, we can have a wide variety of amounts…sometimes it can be as little as 2 inches other times it can be as great as 6 or 7. This variability can cause some issues with users when our color scale always changes relative to the amounts. For example Day 1, 1 inch is yellow and 3 inches is purple…Day 2, 2 inches is yellow and 6 inches is purple.

Is there a way to categorize amounts, say 0-1, 1-2, 2-3, 4-5, 5-6, 7+ so that purple will always represent 7+ and yellow will always be 0-1, etc…I’ve looked at the r.colors wiki page but I can’t seem to get the rules to work correctly. I need a consistent color scheme for the graphic that communicates the level of concern properly to the user.

Any examples would be greatly appreciated…Thanks.

Nathan Barber

Hydrologist

NOAA National Weather Service
Ohio River Forecast Center
1901 S State Rt 134
Wilmington, OH 45177
(937) 383-0528

On 28/03/2013 14:54, Nathan Barber - NOAA Federal wrote:

Background

We generate a precipitation graphic that is based on the mean of an ensemble of models. Because it goes out 16 days, we can have a wide variety of amounts...sometimes it can be as little as 2 inches other times it can be as great as 6 or 7. This variability can cause some issues with users when our color scale always changes relative to the amounts. For example Day 1, 1 inch is yellow and 3 inches is purple....Day 2, 2 inches is yellow and 6 inches is purple.

Is there a way to categorize amounts, say 0-1, 1-2, 2-3, 4-5, 5-6, 7+ so that purple will always represent 7+ and yellow will always be 0-1, etc...I've looked at the r.colors wiki page but I can't seem to get the rules to work correctly. I need a consistent color scheme for the graphic that communicates the level of concern properly to the user.

Any examples would be greatly appreciated...Thanks.

Sure, just create a single rules file (say "standard_precip_colors.txt" )of the format:
1 yellow
3 orange
5 red
7 blue
100% purple
end

Now apply this rules file to each new precipitation raster with
r.colors map=<new raster> rules=standard_precip_colors.txt

HTH

--
Nathan Barber
Hydrologist
NOAA National Weather Service
Ohio River Forecast Center <http://www.erh.noaa.gov/ohrfc/&gt;
1901 S State Rt 134
Wilmington, OH 45177
(937) 383-0528

This mail was received via Mail-SeCure System.

_______________________________________________
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.

--
Micha Silver
GIS Consulting
052-3665918
http://www.surfaces.co.il

Micha,

Thanks for the help!

···

On Thu, Mar 28, 2013 at 9:11 AM, Micha Silver <micha@arava.co.il> wrote:

On 28/03/2013 14:54, Nathan Barber - NOAA Federal wrote:

Background

We generate a precipitation graphic that is based on the mean of an ensemble of models. Because it goes out 16 days, we can have a wide variety of amounts…sometimes it can be as little as 2 inches other times it can be as great as 6 or 7. This variability can cause some issues with users when our color scale always changes relative to the amounts. For example Day 1, 1 inch is yellow and 3 inches is purple…Day 2, 2 inches is yellow and 6 inches is purple.

Is there a way to categorize amounts, say 0-1, 1-2, 2-3, 4-5, 5-6, 7+ so that purple will always represent 7+ and yellow will always be 0-1, etc…I’ve looked at the r.colors wiki page but I can’t seem to get the rules to work correctly. I need a consistent color scheme for the graphic that communicates the level of concern properly to the user.

Any examples would be greatly appreciated…Thanks.

Sure, just create a single rules file (say “standard_precip_colors.txt” )of the format:
1 yellow
3 orange
5 red
7 blue
100% purple
end

Now apply this rules file to each new precipitation raster with
r.colors map= rules=standard_precip_colors.txt

HTH


Nathan Barber
Hydrologist
NOAA National Weather Service

Ohio River Forecast Center <http://www.erh.noaa.gov/ohrfc/>

1901 S State Rt 134
Wilmington, OH 45177
(937) 383-0528

This mail was received via Mail-SeCure System.


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

This mail was received via Mail-SeCure System.


Micha Silver
GIS Consulting
052-3665918
http://www.surfaces.co.il

Nathan Barber

Hydrologist

NOAA National Weather Service
Ohio River Forecast Center
1901 S State Rt 134
Wilmington, OH 45177
(937) 383-0528

You can do this with a couple of different interfaces, including a text file, which might work better in your case. The syntax is the same, however. It involves giving a cut point for the raster values and a color at that cut point. GRASS then will shade between the cut points. For example:

0 red
10 blue

…will make a 0 value red (255:0:0 in RGB), a value of 10 blue (0:0:255 in RGB) and grade from red to blue for all intermediate values.

You can express the same thing with RGB values (note the colons separating the color values)

0 255:0:0
10 0:0:255

If you’re values vary but you always want them to scale between red and blue, you can also express this as

0% red
100% blue

You can mix and match raw values and percents, named colors and RGB values.

In your particular case, you could do…

0 yellow
1 yellow
7 purple
100% purple

This makes 0-1 yellow, 7 purple, and everything above 7 purple. The other values will always grade between yellow and purple. If you want to put in some other cut points to make sure that particular values have particular colors, you can do so.

0 yellow
1 yellow
3 green
5 red
7 purple
100% purple

The result is…

0-1 is yellow
1-3 grades between yellow and green
3 is green
3-5 grades between green and red
5 is red
5-7 grades between red and purple
7 on up is purple

Hope this makes the r.colors less mysterious.

Cheers
Michael


C. Michael Barton
Director, Center for Social Dynamics & Complexity
Professor of Anthropology, School of Human Evolution & Social Change
Arizona State University
Tempe, AZ 85287-2402
USA

voice: 480-965-6262 (SHESC), 480-727-9746 (CSDC)
fax: 480-965-7671(SHESC), 480-727-0709 (CSDC)
www: http://csdc.asu.edu, http://shesc.asu.edu
http://www.public.asu.edu/~cmbarton

On Mar 28, 2013, at 5:54 AM, Nathan Barber - NOAA Federal <nathan.barber@noaa.gov> wrote:

Background

We generate a precipitation graphic that is based on the mean of an ensemble of models. Because it goes out 16 days, we can have a wide variety of amounts…sometimes it can be as little as 2 inches other times it can be as great as 6 or 7. This variability can cause some issues with users when our color scale always changes relative to the amounts. For example Day 1, 1 inch is yellow and 3 inches is purple…Day 2, 2 inches is yellow and 6 inches is purple.

Is there a way to categorize amounts, say 0-1, 1-2, 2-3, 4-5, 5-6, 7+ so that purple will always represent 7+ and yellow will always be 0-1, etc…I’ve looked at the r.colors wiki page but I can’t seem to get the rules to work correctly. I need a consistent color scheme for the graphic that communicates the level of concern properly to the user.

Any examples would be greatly appreciated…Thanks.

Nathan Barber

Hydrologist

NOAA National Weather Service
Ohio River Forecast Center
1901 S State Rt 134
Wilmington, OH 45177
(937) 383-0528