[ncl-talk] text res

Alan Brammer abrammer at albany.edu
Mon Oct 19 12:52:56 MDT 2015


quick response to the first part.
   92   colors = where(((rf.ge.0.1).and.(rf.lt.2.5)),"Blue","   ")  ; This
is a string variable
   93   colors = where(((rf.ge.2.5).and.(rf.lt.7.5)),"Red","   ")   ;;;
This will undo anything set in the line above.


Quick edit below:

colors = new( dimsizes(rf), string)
colors = ""  ; not really necessary.

colors = where(((rf.ge.0.1).and.(rf.lt.2.5)),"Blue",colors)
colors = where(((rf.ge.2.5).and.(rf.lt.7.5)),"Red",colors)  ;;; now
anything set on the first line won't be unset on this line. continue
as necessary.
colors = where(((rf.ge.7.5).and.(rf.lt.15.5)),"Yellow", colors)

print(rf+"     "+ colors)   ;;;  look at your data and the output to check
it worked.

;; colorss= stringtoint(colors)    ;; This won't work and shouldn't be
needed.  You'd want something like:
https://www.ncl.ucar.edu/Document/Graphics/Interfaces/namedcolor2rgb.shtml





Alan.





On Mon, Oct 19, 2015 at 1:02 PM, Geeta Geeta <geetag54 at yahoo.com> wrote:

>  Hi Mary.
> I have tried three things for giving a range to the rainfall. Pls see the
> lines 91 to 110 of my script.
>
>
>
> 1.  I tried the following.
>
> 1. print(nrf)
>      92   colors = where(((rf.ge.0.1).and.(rf.lt.2.5)),"Blue","   ")  ;
> This is a string variable
>      93   colors = where(((rf.ge.2.5).and.(rf.lt.7.5)),"Red","   ")
>      94 ;  colors = where(((rf.ge.7.5).and.(rf.lt.15.5)),"Yellow","   ")
>      95 ;  colorss= stringtoint(colors)
>
> 2nd Method in which I have defined the colors as an array. So there is
> error on line 106. Also this will give an individual color to each data.
> Variable: colors
> Type: integer
> Total Size: 16 bytes
>             4 values
> Number of Dimensions: 1
> Dimensions and sizes:    [4]
> Coordinates:
> (0)    1
> (1)    21
> (2)    41
> (3)    61
> fatal:Subscript out of range, error in subscript #0
> fatal:An error occurred reading colors
> fatal:["Execute.c":8578]:Execute: Error occurred at or near line 106 in
> file stn-v3.ncl
>
> aditya at agniilap:~/geeta/ncl$
>
> can U pls suggest???I also tried combining two statements with where but
> that did not work.
>  Geeta.
>
> Geeta.
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20151019/a90746cc/attachment.html 


More information about the ncl-talk mailing list