<div dir="ltr"><div class="gmail_default">Geeta,</div><div class="gmail_default"><br></div><div class="gmail_default">For some reason, your messages keep ending up in my spam box. I've had trouble with other <a href="http://yahoo.com">yahoo.com</a> addresses as well.</div><div class="gmail_default"><br></div><div class="gmail_default">I sent you information on how to color markers given a range of values. Did you not try this method?</div><div class="gmail_default"><br></div><div class="gmail_default">You have code that looks like this:</div><div class="gmail_default"><div class="gmail_default"><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> rf0 = ind(rf.eq.0.0)</font></div><div class="gmail_default"><font face="monospace, monospace"> rf_range0 = rf(rf0)</font></div><div class="gmail_default"><font face="monospace, monospace"> nrf_range0 = dimsizes(rf_range0)</font></div><div class="gmail_default"><font face="monospace, monospace">; print("rf0 output of ind(rf) while rf_range0 is actual value of rf"+ " "+rf0+" "+rf_range0) </font></div><div class="gmail_default"><font face="monospace, monospace"> printVarSummary(rf_range0)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> rf1 = ind(rf.ge.0.1.and.rf.lt.2.5)</font></div><div class="gmail_default"><font face="monospace, monospace"> rf_range1 = rf(rf1)</font></div><div class="gmail_default"><font face="monospace, monospace"> nrf_range1 = dimsizes(rf_range1)</font></div><div class="gmail_default"><font face="monospace, monospace">; print("rf1 output of ind(rf) while rf_range1 is actual value of rf"+ " "+rf1+" "+rf_range1) </font></div><div class="gmail_default"><font face="monospace, monospace"> printVarSummary(rf_range1)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace">. . .</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div><div class="gmail_default"><font face="monospace, monospace"> do n = 0, nrf_range1-1</font></div><div class="gmail_default"><font face="monospace, monospace"> res_mark@gsMarkerColor = "red"</font></div><div class="gmail_default"><font face="monospace, monospace"> str = unique_string("polymarker")</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$str$ = gsn_add_polymarker(wks,plot,lon,lat,res_mark)</font></div><div class="gmail_default"><font face="monospace, monospace"> end do</font></div></div></div></div><div class="gmail_default"><br></div><div class="gmail_default">You are looping through the number of index values that you found for each range, but then calling gsn_add_polymarker and passing in the full array of lat/lon points. Each do loop, then, is plotting the same set of markers again, but with whatever color you set it to. </div><div class="gmail_default"><br></div><div class="gmail_default">As I demonstrated in a previous example, you need to <b>subscript</b> lon and lat with the index locations. There's no need to loop:</div><div class="gmail_default"><br></div><div class="gmail_default"><div class="gmail_default"><span style="font-family:monospace,monospace"> res_mark@gsMarkerColor = "blue"</span><br></div></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> str = unique_string("polymarker")</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$str$ = gsn_add_polymarker(wks,plot,lon(rf0),lat(rf0),res_mark)</font></div><div class="gmail_default"><font face="monospace, monospace"><br></font></div></div><div class="gmail_default"><div class="gmail_default"><font face="monospace, monospace"> res_mark@gsMarkerColor = "red"</font></div><div class="gmail_default"><font face="monospace, monospace"> str = unique_string("polymarker")</font></div><div class="gmail_default"><font face="monospace, monospace"> plot@$str$ = gsn_add_polymarker(wks,plot,lon(rf1),lat(rf1),res_mark)</font></div></div><div class="gmail_extra"><font face="arial, helvetica, sans-serif"><br></font></div><div class="gmail_extra"><font face="arial, helvetica, sans-serif"><div class="gmail_default" style="font-size:small;display:inline">Notice how I subscripted your "lat" and "lon" arrays with "rf0" and then "rf1". These are the index values that you got by calling "ind".</div></font></div><div class="gmail_extra"><font face="arial, helvetica, sans-serif"><div class="gmail_default" style="font-size:small;display:inline"></div><br></font></div><div class="gmail_extra"><div class="gmail_default"><font face="arial, helvetica, sans-serif">Please try to understand your code before sending it to ncl-talk. You can always add "print" statements to print out what's happening. For example, you can print the values being sent to the gsn_add_polymarker routine by typing:</font></div><div class="gmail_default"><br></div><div class="gmail_default"><font face="monospace, monospace"> print(lat(rf1) + "/" + lon(rf1))</font></div><div class="gmail_default"></div><div class="gmail_default">Also, if you have a new question, start a new "ncl-talk" thread and don't simply keep tacking on new questions to old email threads. Before you post new questions, however, try to find the answers on your own. You can find some tips here:<br></div><div class="gmail_default"><br></div><a href="http://www.ncl.ucar.edu/Support/posting_guidelines.shtml" target="_blank">http://www.ncl.ucar.edu/Support/posting_guidelines.shtml</a></div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_default" style="font-size:small">--Mary</div><div class="gmail_default" style="font-size:small"></div><br><div class="gmail_quote">On Sat, Oct 24, 2015 at 12:20 PM, Geeta Geeta <span dir="ltr"><<a href="mailto:geetag54@yahoo.com" target="_blank">geetag54@yahoo.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div><div style="color:rgb(0,0,0);font-family:HelveticaNeue,'Helvetica Neue',Helvetica,Arial,'Lucida Grande',sans-serif;font-size:16px;background-color:rgb(255,255,255)"><div dir="ltr"><span>I have a rainfall (1D array) and I had to plot those with diff colours depending on the range that I have defined. <br></span></div><div dir="ltr"><br><span></span></div><div dir="ltr"><span>I have split my orginal array into smaller arrays and Now I am trying to give different COLORS to each array. <br></span></div><div dir="ltr"><span>This is some part of script <br></span></div><div dir="ltr"><span></span></div>;----------Title res<br><br> res@tiMainString = fili<br><br> plot = gsn_csm_map(wks,res)<br>;<br>;<br>;---------Adding Markers & Coloring them according to the RF value<br> nrf = dimsizes(rf)<br>; print(nrf)<br><br> res_mark = True<br> res_mark@gsMarkerIndex = 1 ; 17 predefined markers available<br> res_mark@gsMarkerSizeF = 0.012<br><br>; Breaking up rf array into small arrays depending on their value<br>;<br>; ind fn return INDEX (in this case the line NOs when the below is TRUE)<br>;<br> rf0 = ind(rf.eq.0.0)<br> rf_range0 = rf(rf0)<br> nrf_range0 = dimsizes(rf_range0)<br>; print("rf0 output of ind(rf) while rf_range0 is actual value of rf"+ " "+rf0+" "+rf_range0)<br> printVarSummary(rf_range0)<br><br> rf1 = ind(rf.ge.0.1.and.rf.lt.2.5)<br> rf_range1 = rf(rf1)<br> nrf_range1 = dimsizes(rf_range1)<br>; print("rf1 output of ind(rf) while rf_range1 is actual value of rf"+ " "+rf1+" "+rf_range1)<br> printVarSummary(rf_range1)<br><br> rf2 = ind(rf.ge.2.5.and.rf.lt.7.5)<br> rf_range2 = rf(rf2)<br> nrf_range2 = dimsizes(rf_range2)<br> printVarSummary(rf_range2)<br>; print("rf2 output of ind(rf) while rf_range2 is actual value of rf"+ " "+rf2+" "+rf_range2)<br><br> rf3 = ind(rf.ge.7.5.and.rf.lt.35.5)<br> rf_range3 = rf(rf3)<br> nrf_range3 = dimsizes(rf_range3)<br>; print("rf3 output of ind(rf) while rf_range3 is actual value of rf"+ " "+rf3+" "+rf_range3)<br> printVarSummary(rf_range3)<br><br> rf4 = ind(rf.ge.35.5.and.rf.lt.64.5)<br> rf_range4 = rf(rf4)<br> nrf_range4 = dimsizes(rf_range4)<br>; print("rf4 output of ind(rf) while rf_range4 is actual value of rf"+ " "+rf4+" "+rf_range4)<br> printVarSummary(rf_range4)<br><br><br><div dir="ltr"><br></div><div dir="ltr">do n = 0, nrf_range0-1<br> res_mark@gsMarkerColor = "Blue"<br> str = unique_string("polymarker")<br> plot@$str$ = gsn_add_polymarker(wks,plot,lon,lat,res_mark)<br> end do<br><br> do n = 0, nrf_range1-1<br> res_mark@gsMarkerColor = "red"<br> str = unique_string("polymarker")<br> plot@$str$ = gsn_add_polymarker(wks,plot,lon,lat,res_mark)<br> end do<br><br>draw(plot)</div><div dir="ltr">frame(wks)</div><div dir="ltr"><br></div><div dir="ltr">Following things I m not able to sort out and seek suggestions. <br></div><div dir="ltr">1. I get 227 values corresponding to Range0 (when rf=0.0) plotted in RED. <br></div><div dir="ltr"> Does it has to do it with draw function???</div><div dir="ltr"><br></div><div dir="ltr">2. If I want to show the topography/ height of the region, how can I do that.</div><div dir="ltr"><br></div><div dir="ltr"><br></div><div dir="ltr">thanks</div><div dir="ltr"> <br></div><div dir="ltr"><br></div></div></div><br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>