[STATSGRASS] rast.put & colors
Bodo Ahrens
Bodo.Ahrens at univie.ac.at
Mon Sep 16 03:45:40 EDT 2002
> > hallo helpers,
> >
> > I try to use rast.put. I am able to put the raster file (floating
> > precission with NA values) into grass.
> >
> > The problem is the color scheme: How can I define breaks and colors?
> >
> > I tried variations of
> >
> > rast.put(G,lname=paste("9",month.fname,day.fname,hour.fname,minute.fname,
> >".",imgtype,sep=""), layer=aust$rimage.3d,
> > title="2dRadarimage",breaks=c(-0.5,0.5,13.5),col=c("red","black"))
> >
> > but grass always applies its default colors.
> >
> > I am trying on
> > LINUX SUSE 8.0
> > GRASS/R 0.1-11
> > R 1.5.1
> > GRASS 5.0.0pre5
> >
> > What is the trick?
>
> This is quite complicated - thanks for pointing out the difficulty. I'll
> be able to respond more fully after the weekend, because I'm at the Grass
> Users' meeting in Trento, which is great, and will lead to improvements in
> the interface.
>
> I think you are getting caught in the conditions which are rather odd. If
> aust$rimage.3d is a numeric vector (what does is.numeric(aust$rimage.3d)
> say?) then I think you would get the behaviour you observe - I think you
> would need to make aust$rimage.3d a factor first with cut(), using the
> same breaks, then not give rast.put() the breaks. I certainly need to give
> examples of how this is meant to happen on the help page, but at a
> distance I'm not sure that this is the right explanation. Please let me
> know if this helps or not, and I'll certainly upgrade the help page.
>
> Roger
Yes: is.numeric(aust$rimage.3d) is TRUE. It is a vector of integers (in my
test case) with values 0,1, ..13 and NA.
I tried
f<-cut(aust$rimage.3d,breaks=c(-0.5,0.5,13.5))
rast.put(G,lname=paste("9",month.fname,day.fname,hour.fname,minute.fname,".",imgtype,sep=""),
layer=f, title="2dRadarimage",col=c("red","black"))
and variations. No real change: grass applies standard color scheme. The
output of d.what.rast is now
Buttons
Left: what's here
Right: quit
-39077.99083333(E) 307902.65416667(N)
909262105.max in bodo, quant (1)
909262105.max in bodo, actual (1.000000)
172364.2425(E) 226346.36416667(N)
909262105.max in bodo, quant (2)
909262105.max in bodo, actual (2.000000)
-276195.3525(E) 351701.4025(N)
909262105.max in bodo, quant (Null)
909262105.max in bodo, actual (Null)no data
for example. Obviously, I have imported now some "factors" (similar to
"categories" in grass?). Honestly, I have not understood the color (and
category) game in grass and actually want to import floatings. Is it possible
to import floatings with R/GRASS and it is when the only possibility to
generate an appropriate color table within grass?
Thanks again,
Bodo
--
Dr. Bodo Ahrens
Institut fuer Meteorologie und Geophysik, Universitaet Wien
A-1090 Wien, Althanstrasse 14, AUSTRIA
Tel.: ++43-1-4277-51917
Fax: ++43-1-4277-9519
E-mail: Bodo.Ahrens at univie.ac.at
More information about the grass-stats
mailing list