Re: Overlapping Strings

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Tue Aug 30 2011 - 18:41:19 MDT

As noted
   http://www.ncl.ucar.edu/Applications/text.shtml#ex10
which removes overlapping strings is not what you want.
So, I think some form of manual, movement is required.
See untested change below. You will likely have to play
with the dlat and dlon offsets.

Good Luck

On 8/30/11 6:06 PM, Clark, Brandi Lynn wrote:
> I am adding stations and their identifications on a map, but some of
> them overlap. I do not want to remove the overlapping station names, but
> rather I want to change their position so that they are no longer
> overlapping. Is there a way to do this? The only script I have found on
> the website removes the overlapping strings.
>
> This is the way I have set it up:
>
> fname = "COOP_2010_Mean.dat" ; ascii file path
> lines = asciiread(fname,-1,"string") ; read ascii file
>
> lat = stringtofloat(str_get_field(lines(1:),2," "))
> lon = stringtofloat(str_get_field(lines(1:),3," "))
> pwv = stringtofloat(str_get_field(lines(1:),4," "))
> stations = str_get_cols(lines(1:),0,7)

   nsta = dimsizes(stations)
   dlat = new(nsta, "float","No_FillValue") ; lat offset
   dlon = new(nsta, "float","No_FillValue") ; lon offset
   dlat = 0.0 ; default is no offset
   dlon = 0.0

   do ns=0,nsta-1
      if (stations(ns).eq."413284") then
          dlat(ns) = -0.005 ; move down some small distance
          dlon(ns) = 0.0 ; no change
      end if
      if (stations(ns).eq."413285") then
          dlat(ns) = 0.005 ; move up some small distance
          dlon(ns) = 0.005
      end if
   end do

>
> txres = True ; turn on text resources
> txres@txJust = "CenterRight" ; station labels to right of marker
> txres@txFontHeightF = 0.01 ; font size
>
> gsn_text(wks,map," " + station1,lon,lat,txres)

Change above to:

   gsn_text(wks,map," " + station1,(lon+dlon),(lat+dlat),txres)
>
> I have attached a copy of the map so you can see the issue. I just need
> to justify the overlapping station names differently than the rest.
>
> Thank you,
>
> Brandi Clark
>
>
> _______________________________________________
> 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 30 18:41:25 2011

This archive was generated by hypermail 2.1.8 : Wed Sep 07 2011 - 10:58:58 MDT