<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p>Hi Emma,<br>
I think you're trying to do something similar to what I try to do in real-time - maps like: <a href="http://operations.nysmesonet.org/~nbassill/climate/index.php?climate=daily" class="OWAAutoLink" id="LPlnk147513" previewremoved="true"></a><a href="http://operations.nysmesonet.org/~nbassill/climate/index.php?climate=weekly" class="OWAAutoLink" id="LPlnk370108" previewremoved="true">http://operations.nysmesonet.org/~nbassill/climate/index.php?climate=weekly</a><br>
<br>
Skipping to just the relevant parts of that code, it's something like (where delim = ","): </p>
<p><br>
</p>
<p></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">sitefile<span class="Apple-converted-space">
</span>= "weekly.dat"</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">sitedata<span class="Apple-converted-space">
</span>= asciiread(sitefile,-1,"string")</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">sitelats<span class="Apple-converted-space">
</span>= tofloat(str_get_field(sitedata,1,delim))</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">sitelons<span class="Apple-converted-space">
</span>= tofloat(str_get_field(sitedata,2,delim))</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">siteanom<span class="Apple-converted-space">
</span>= tofloat(str_get_field(sitedata,3,delim))</span></p>
<p></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">size = dimsizes(sitelons)</span></p>
<p><br>
</p>
<p><other stuff - maybe put your map stuff here></p>
<p><br>
</p>
<p></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">;;;;;;;;;;;; this part tells the marker what color to be based on the anomaly</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">markercolors = new(size(0),"integer")</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">do n=0,size(0)-1,1</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">
</span>markercolors(n) = round((siteanom(n)*10),3)+127</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">end do</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">markercolors=where((markercolors.lt.17),17,markercolors)</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">markercolors=where((markercolors.gt.255),237,markercolors)</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200); min-height: 13px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">stationmarker = new(size(0),graphic)</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">do n=0,size(0)-1,1</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">mres<span class="Apple-converted-space">
</span>= True <span class="Apple-converted-space"> </span>; marker resources for best track</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">mres@gsMarkerIndex<span class="Apple-converted-space">
</span>= 16 <span class="Apple-converted-space"> </span>; marker style (filled circle)</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">mres@gsMarkerSizeF<span class="Apple-converted-space">
</span>= 23.0<span class="Apple-converted-space"> </span>; marker size</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">mres@gsMarkerColor<span class="Apple-converted-space">
</span>= markercolors(n)<span class="Apple-converted-space"> </span>; marker color</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">mres@tfPolyDrawOrder= "PostDraw"</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200); min-height: 13px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">stationmarker(n) = gsn_add_polymarker(wks,plot,sitelons(n),sitelats(n),mres)</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200); min-height: 13px;">
<span style="font-variant-ligatures: no-common-ligatures;"></span><br>
</p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">tres<span class="Apple-converted-space">
</span>= True<span class="Apple-converted-space"> </span>; text mods desired</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">tres@tfPolyDrawOrder<span class="Apple-converted-space">
</span>= "PostDraw"</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">tres@txFont = "helvetica-bold"</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">tres@txFontHeightF<span class="Apple-converted-space">
</span>= 0.014</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">
</span>if any(siteanom.lt.-9.5)</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">
</span>tres@txFontHeightF<span class="Apple-converted-space"> </span>= 0.011</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;"><span class="Apple-converted-space">
</span>end if</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">stationtext<span class="Apple-converted-space">
</span>= <span class="Apple-converted-space"> </span>gsn_add_text(wks,plot,round(siteanom(n),3),sitelons(n),sitelats(n),tres)</span></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">end do</span></p>
<p><br>
</p>
<p><other stuff, like colorbar, text, etc.></p>
<p><br>
</p>
<p></p>
<p style="margin: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: normal; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(255, 255, 255); background-color: rgb(44, 103, 200);">
<span style="font-variant-ligatures: no-common-ligatures;">draw(plot)</span></p>
<br>
<p></p>
<p><br>
</p>
<p>This loops through and plots a color-coded dot, then adds the raw value on top of it later. Here, there's some trial and error involved when I calculate the markercolor for each station - it's an arbitrary (value*10 + 127), which fits in well with the color
scheme, but it could just as easily be anything else. </p>
<p><br>
</p>
<p><br>
</p>
<div id="Signature">
<div id="divtagdefaultwrapper" style="font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-family: Calibri, Arial, Helvetica, sans-serif, Helvetica, EmojiFont, "Apple Color Emoji", "Segoe UI Emoji", NotoColorEmoji, "Segoe UI Symbol", "Android Emoji", EmojiSymbols;">
<p><span style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">Nick Bassill, PhD</span></p>
<p style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">
Modeler & Meteorologist, New York State Mesonet</p>
<p style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">
LC SB-28, 1400 Washington Ave.,</p>
<p style="color:rgb(0,0,0); font-family:Calibri,Arial,Helvetica,sans-serif; font-size:16px">
SUNY, University at Albany, NY 12222</p>
(518) 442-6375
<p></p>
<p>http://nysmesonet.org/<br>
</p>
</div>
</div>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> ncl-talk <ncl-talk-bounces@ucar.edu> on behalf of Emma Nelson <enelson23@wisc.edu><br>
<b>Sent:</b> Tuesday, November 28, 2017 1:07 PM<br>
<b>To:</b> ncl-talk@ucar.edu<br>
<b>Subject:</b> [ncl-talk] Plotting average station values on map</font>
<div> </div>
</div>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:#000000; font-family:Calibri,Helvetica,sans-serif">
<p>Hi,</p>
<p><br>
</p>
<p>I have monthly averages of ozone data and am trying to figure out how to plot them with different colors given a certain range. The only examples I can find are using dummy data, and I'm having trouble figuring out how to apply this to actual data. </p>
<p><br>
</p>
<p>My averages are:</p>
<p>average1 = 37.62</p>
<p>average2 = 39.49 </p>
<p><span style="font-family:Calibri,Helvetica,sans-serif,Helvetica,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">average3 = </span><span style="font-family:Calibri,Helvetica,sans-serif,Helvetica,EmojiFont,"Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols; font-size:16px">36.36 </span><br>
</p>
<p>I want to display these values as different colors. For example, I want one color for values less than 37, one between 37 and 39, and one greater than 39. Here is what I've tried:</p>
<p><br>
</p>
<p><br>
</p>
<p></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">arr = (/0.,37.,39./)</span></p>
<p></p>
<p></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">do i = 0, num_distinct_markers-1</span><br>
</p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">if (i.eq.0) then</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">indexes = ind(average3.lt.arr(37))</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">labels(i) = "x < " + arr(37)</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">end if</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">if (i.eq.num_distinct_markers-1) then</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">indexes = ind(average2.gt.arr(39))</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">labels(i) = "x > " + arr(39</span><span style="">)</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">end if</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style=""><br>
</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">if (i.gt.arr(37).and.i.lt.arr(39)) then</span><br>
</p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style=""></span><span style="">indexes = ind(average1.gt.arr(37).and.average1.lt.arr(39))</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style=""></span><span style="">labels(i) = arr(37) + "< x < " + arr(39)</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">end if</span></p>
<p style="margin:0px; font-style:normal; font-weight:normal; font-size:12px; line-height:normal; font-family:Courier">
<span style="">end do</span></p>
<br>
<p></p>
<p>I'm pretty sure most of this is wrong, but I don't know what a lot of the functions mean, so any help would be appreciated!</p>
<p><br>
</p>
<p>Thanks,</p>
<p>Emma Nelson</p>
</div>
</div>
</div>
</div>
</body>
</html>