Re: Plotting dots on the map using different colors

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 14 2012 - 11:24:53 MDT

Mark,

Since I can't run your script without the data file, I can't tell why your "do" loop may never be exiting.

However, instead of a "do" loop and a bunch of "if" statements, you might try using "ind" to gather up all the indices where a certain condition is true, and then use the indices to plot all the text strings for that grouping.

For example, instead of :

  i=0

  do while (i.le.(nrows_dots-2))

  if (bias_dots(i) .le. -5 ) then
     txres@txFontColor = colors(0)
  end if

  if ( (bias_dots(i) .gt. -5) .and. (bias_dots(i) .le. 5) ) then
     txres@txFontColor = colors(1)
  end if

  if (bias_dots(i) .gt. 5 ) then
     txres@txFontColor = colors(2)
  end if

  text_dots = gsn_add_text(wks,plot,\
                  symbols_dots(i),\
  lons_dots(i),lats_dots(i),txres)

  i=i+1

  end do

Try something like this (untested):

   ii1 = ind(bias_dots .le. -5 )
  ii2 = ind((bias_dots .gt. -5).and.(bias_dots .le. 5))
  ii3 = ind(bias_dots(i) .gt. 5)

  txres@txFontColor = colors(0)
  text_dots1 = gsn_add_text(wks,plot,\
                            symbols_dots(ii1),\
                            lons_dots(ii1),lats_dots(ii1),txres)

  txres@txFontColor = colors(1)
  text_dots2 = gsn_add_text(wks,plot,\
                            symbols_dots(ii2),\
                            lons_dots(ii2),lats_dots(ii2),txres)

  txres@txFontColor = colors(2)
  text_dots3 = gsn_add_text(wks,plot,\
                            symbols_dots(ii3),\
                            lons_dots(ii3),lats_dots(ii3),txres)

--Mary

On Aug 10, 2012, at 3:41 PM, m p wrote:

> Hello,
> I' d like to plot on the map at latitudes and longitudes of measurement stations biases and other statistics of the model.
> I wrote a clumsy script that I am attaching that executes forever, never actually ends. Could somebody have a look and advise
> hot to handle it better?
> Thanks,
> Mark
> <ncl_script_and_data.tar.gz>_______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Aug 14 11:25:05 2012

This archive was generated by hypermail 2.1.8 : Wed Aug 15 2012 - 08:12:08 MDT