Re: Fw: plot circle in contour map

From: Arindam Chakraborty <arch_at_nyahnyahspammersnyahnyah>
Date: Fri May 25 2012 - 02:27:06 MDT

hi Juky,
 that function is not designed for plotting multiple circles at a time. In
case one need to draw more than one circle on the same plot, simplest
solution is to call that function multiple times. For example, in your case
you can write a do-loop around circle_ll() to get your results.

do i=0,dimsizes(lon)-1
  circle_ll(wks,map,lon(i),lat(i),R(i),resc)
end do

regards,

arindam

--
*Dr Arindam Chakraborty*
Centre for Atmospheric and Oceanic Sciences
Indian Institute of Science
Bangalore - 560 012, INDIA.
http://caos.iisc.ernet.in/ <http://caos.iisc.ernet.in/faculty/arch>
On Fri, May 25, 2012 at 11:49 AM, juki juki <juky_emc2@yahoo.com> wrote:
> thanks for nice suggestion. I try the code and the result is ok for one
> input, when I used array input, some errors are visbile. The following is
> example my code:
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "circle_ll.ncl"
>
> begin
>
>  data     = asciiread("ncldatasample.txt", (/10,3/), "float")
>  lon =data(:,0);
>  lat =data(:,1);
>  R = data(:,2);
>
>
>  wks = gsn_open_wks("x11","circle");
>  gsn_define_colormap(wks,"WhViBlGrYeOrRe")
>  nc1 = NhlNewColor(wks,.8,.8,.8)        ; Add light gray to colormap,
>                                          ; for continents.
>
>  ; Set up some map resources.
> ;
>   mpres              = True
>   mpres@gsnMaximize  = True             ; Maximize plot in frame.
>   mpres@gsnFrame     = False            ; Don't advance the frame
> ;
> ; Zoom in on United States.
> ;
>   mpres@mpMinLatF    = -10.
>   mpres@mpMaxLatF    = 10.
>   mpres@mpMinLonF    = 70.
>   mpres@mpMaxLonF    = 160.
>
>   mpres@mpFillColors = (/-1,-1,nc1,-1/)    ;assign light gray to land
> masses
>
>   mpres@tiMainString = "test circle"
>   map = gsn_csm_map(wks,mpres)
>
>  ;res = True
>  ;res@vpHeightF=0.5
>  ;res@vpWidthF=0.8
>  ;res@gsnDraw = False
>  ;res@gsnFrame = False
>  ;plt=gsn_csm_contour(wks,arr,res)
>
>  resc=True
>  resc@gsLineColor="red"
>  resc@gsLineThicknessF=0.5
>  resc@Scale=1
>  resc@Rotation=-90
>  circle_ll(wks,map,lon,lat,R,resc)
>  draw(map)
>  frame(wks)
>  end
>
> The input file is attached, probably you know the reason..
>
> Thanks again,
>
> Juky
>
>
>
>   ------------------------------
> *From:* Arindam Chakraborty <arch@caos.iisc.ernet.in>
> *To:* Dennis Shea <shea@ucar.edu>; juki juki <juky_emc2@yahoo.com>
> *Cc:* NCL Talk <ncl-talk@ucar.edu>
> *Sent:* Friday, May 25, 2012 2:19 PM
> *Subject:* Re: [ncl-talk] Fw: plot circle in contour map
>
> hi Juki Juki,
> see the attached procedure circle_ll() that can draw a circle on a plot on
> specification of its center and radius. Optionally one can draw an ellipse
> and
> rotate its axes. An example is provided in the function header. Hope this
> helps.
>
> regards,
>
> arindam
> --
> Dr Arindam Chakraborty
> Centre for Atmospheric and Oceanic Sciences
> Indian Institute of Science
> Bangalore - 560 012, INDIA
> http://caos.iisc.ernet.in/
>
> ---------- Original Message -----------
> From: Dennis Shea <shea@ucar.edu>
> To: juki juki <juky_emc2@yahoo.com>
> Cc: NCL Talk <ncl-talk@ucar.edu>
> Sent: Thu, 24 May 2012 21:46:24 -0600
> Subject: Re: Fw:  plot circle in contour map
>
> > This works fine for me.
> > Note that there should be no blank line at the end of the data file.
> >
> >    data    = asciiread("ncldatasample.txt", (/10,3/), "float")
> >  ;print(data)
> >
> >    lon      = data(:,0)
> >    lat      = data(:,1)
> >    val      = data(:,2)
> >
> > On 5/24/12 5:55 PM, juki juki wrote:
> > >
> > > I did, I am able to plot the data by copying the data to the ncl
> script.
> > > My ascii file is very simple but when I read as follow;
> > >
> > > data = asciiread("ncldatasample.txt", (/10,3/), "float")
> > >
> > > the error occur, can not open the ascii file..
> > >
> > >
> > >
> > >
> > >
> > >
> ------------------------------------------------------------------------
> > > *From:* juki juki <juky_emc2@yahoo.com>
> > > *To:* Dennis Shea <shea@ucar.edu>
> > > *Cc:* NCL Talk <ncl-talk@ucar.edu>
> > > *Sent:* Friday, May 25, 2012 7:47 AM
> > > *Subject:* Re: [ncl-talk] Fw: plot circle in contour map
> > >
> > > Hi Dennis;
> > >
> > > Thanks for your reply. Yes, it is ok, but let me ask few points.
> > >
> > > I will adopt the following code:
> > >
> > > http://www.ncl.ucar.edu/Applications/Scripts/polyg_8.ncl
> > >
> > > I try to read the data I sent you by simple command as:
> > >
> > > 126.57.41.538904
> > > 156.25.70.95746147
> > > 132.19.31.2666025
> > > 151.6-9.31.1283792
> > > 84.3 -8.41.0155413
> > > 131.79.12.018506
> > > 117.68.70.83682839
> > > 75.4-8.50.91669957
> > > 78.3-8.11.1834541
> > > 81.7 6.51.526443
> > >
> > >
> > > ; -------read data
> > >
> > > data = asciiread("ncldatasample.txt", (/10,3/), "float")
> > >
> > > Are there any other option to read it ? The data contain is above.
> > >
> > > For example I use the following bin:
> > >
> > > arr = (/0.5,1.,1.5,2.,2.5,3.,4., 5./)
> > >
> > > How to bin the third column of my data.
> > >
> > > The following line:
> > >
> > > npts = 10 ; Number of points.
> > > lat = second coulumn of my data ; Create some dummy latitude
> > > lon = first coulumn of my data ; and longitude data that
> > > ; will contain the position of
> > > ; our markers.
> > >
> > > R = random_uniform(-1.2,35.,npts) ; This is dummy data for determining
> > > ; how to color the markers.
> > >
> > > How about R ?
> > >
> > > Thanks for help,
> > >
> > > Juky
> > >
> > >
> ------------------------------------------------------------------------
> > >
> > >  >
> > >  >
> > >  >
> > >  > ----- Forwarded Message -----
> > >  > *From:* juki juki <juky_emc2@yahoo.com <mailto:juky_emc2@yahoo.com
> >>
> > >  > *To:* Dennis Shea <shea@ucar.edu <mailto:shea@ucar.edu>>
> > >  > *Cc:* NCL Talk <ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>>; Mary
> > > Haley <haley@ucar.edu <mailto:haley@ucar.edu>>
> > >  > *Sent:* Friday, May 25, 2012 7:02 AM
> > >  > *Subject:* Re: [ncl-talk] plot circle in contour map
> > >  >
> > >  > Hi Dennis;
> > >  >
> > >  > Thanks for your reply. If I can do as the following example is also
> ok.
> > >  >
> > >  > http://www.ncl.ucar.edu/Applications/Scripts/polyg_8.ncl
> > >  >
> > >  > Location of the circle/point as I said before and then classify the
> > >  > color into 3 color only based on the size in the third column.
> Again,
> > >  > thank you.
> > >  >
> > >  > Juki
> > >  >
> > >  >
> -----------------------------------------------------------------------
> -
> > >  > *From:* Dennis Shea <shea@ucar.edu <mailto:shea@ucar.edu>>
> > >  > *To:* juki juki <juky_emc2@yahoo.com <mailto:juky_emc2@yahoo.com>>
> > >  > *Cc:* NCL Talk <ncl-talk@ucar.edu <mailto:ncl-talk@ucar.edu>>; Mary
> > > Haley <haley@ucar.edu <mailto:haley@ucar.edu>>
> > >  > *Sent:* Friday, May 25, 2012 3:14 AM
> > >  > *Subject:* Re: [ncl-talk] plot circle in contour map
> > >  >
> > >  > See Example 4
> > >  > http://www.ncl.ucar.edu/Applications/polyg.shtml
> > >  >
> > >  > Just read the lat and lon values.
> > >  > You must repeat the last point to complete the circle.
> > >  >
> > >  > lat = (/7.4, 5.7, ... , 6.5, 7.4/)
> > >  > lon = (/126.5, 156.6, ..., 81.7, 126.5/)
> > >  >
> > >  > On 5/24/12 12:02 PM, juki juki wrote:
> > >  > > Dear all,
> > >  > >
> > >  > > I want plot circles in a contourmap in 70-160E and 10S-10N. For
> example
> > >  > > we know the position of the circle and the radius in degree. Data
> > >  > example:
> > >  > >
> > >  > > 126.5000000000007.400000000000001.53890401039422
> > >  > > 156.2000000000005.700000000000000.957461472963439
> > >  > > 132.1000000000009.300000000000001.26660247369343
> > >  > > 151.600000000000-9.300000000000001.12837916709551
> > >  > > 84.3000000000000-8.400000000000001.01554125038596
> > >  > > 131.7000000000009.100000000000002.01850601761613
> > >  > > 117.6000000000008.700000000000000.836828387188401
> > >  > > 75.4000000000000-8.500000000000000.916699568847508
> > >  > > 78.3000000000000-8.100000000000001.18345405454064
> > >  > > 81.70000000000006.500000000000001.52644304409478
> > >  > >
> > >  > > First column is longitude position, latitude is in the second and
> last
> > >  > > one is the radius. Are there ncl example regarding this matter,
> to
> plot
> > >  > > circle in contourmap or in topographymap ?. Thanks for sharing,
> > >  > >
> > >  > > Regards,
> > >  > > Juki
> > >  > >
> > >  > >
> > >  > >
> > >  > >
> > >  > > _______________________________________________
> > >  > > 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
> > >
> > >
> > _______________________________________________
> > ncl-talk mailing list
> > List instructions, subscriber options, unsubscribe:
> > http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> >
> > --
> > This message has been scanned for viruses and
> > dangerous content by MailScanner, and is
> > believed to be clean.
> ------- End of Original Message -------
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
>
>
> --
> This message has been scanned for viruses and
> dangerous content by *MailScanner* <http://www.mailscanner.info/>, and is
> believed to be clean.

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri May 25 02:27:45 2012

This archive was generated by hypermail 2.1.8 : Fri May 25 2012 - 08:35:50 MDT