[ncl-talk] Trying to draw circles with different radius in Km around a station

Dennis Shea shea at ucar.edu
Thu Feb 8 07:45:59 MST 2018


An alternative:

nggog can be used. Sample code segments follow. For small radii Npts=100 is
fine but for large radii and nice circles, Npts=360 might be better.

;=========================================================================
; On a sphere with radius 6371 km, one degree is approximately 110.57 km.
;---
; Of course, the earth is an oblate spheroid:
;      http://www.longitudestore.com/how-big-is-one-gps-degree.html
;=========================================================================
; https://www.ncl.ucar.edu/Document/Functions/Built-in/nggcog.shtml
;=========================================================================

;---One station

   slat     = 0.0                  ; station lat
   slon     = 0.0                  ;         lon
   srad_km  = (/ 50, 100, 150, 5*110.57/)*1.0  ; station radii (km)
   km2deg   = 1/110.57             ; conversion factor: deg ==> km
                                   ; one degree is approximately 110.57 km.
   srad_dg  = srad_km*km2deg       ; km ==> deg; nggcog requires degrees

   Nrad = dimsizes(srad_dg)        ; # of radii
   Npts = 100                      ; # of points at each radii (arbitrary)

   Rlat = new((/Nrad, Npts/), "float")    ; lat at each radius
   Rlon = new((/Nrad, Npts/), "float")

   do nr=0,Nrad-1
      print("nr="+nr+" srad_km="+srad_km(nr)+";   srad_dg="+srad_dg(nr))
      print("")

      nggcog(slat, slon, srad_dg(nr), Rlat(nr,:), Rlon(nr,:))

      print(Rlat(nr,:)+"   "+ Rlon(nr,:))
      print("========")
   end do

+++++++++++++++++++++++++++++++++++++++++++++++++++++
;---Multiple stations

   slat     = (/ 0.0, 50.0     /)  ; station lat
   slon     = (/ 0.0, 30.0     /)  ;         lon
   srad_km  = (/ 50, 100, 150, 5*110.57/)*1.0  ; station radii (km)
   km2deg   = 1/110.57                ; conversion factor: deg ==> km
                                                    ; one degree is
approximately 110.57 km.
   srad_dg  = srad_km*km2deg   ; km ==> deg; nggcog requires degrees
   Nrad     = dimsizes(srad_dg)    ; # of radii

   Nsta     = dimsizes(slat)            ; # stations
   Nrad     = dimsizes(srad)          ; # of radii
   Npts     = 100                            ; # of points at each radii
(arbitrary; eg 360)

   Rlat = new((/Nsta, Nrad, Npts/), "float")    ; lat at each radius
   Rlon = new((/Nsta, Nrad, Npts/), "float")

   do ns=0,Nsta-1
     do nr=0,Nrad-1
        nggcog(slat(ns), slon(ns), srad(nr), Rlat(ns,nr,:), Rlon((ns,nr,:))
     end do
   end do


On Thu, Feb 8, 2018 at 2:38 AM, Karin Meier-Fleischer <
meier-fleischer at dkrz.de> wrote:

> Hi Soumik,
>
> you can use polymarkers to plot the circles around lat/lon locations. Have
> a look at example newcolor_4.ncl at http://ncl.ucar.edu/
> Applications/Scripts/newcolor_4.ncl
>
> I've attached an example script using random data for marker size and
> lat/lon locations overlayed on filled contour map.
>
> Hope this helps.
>
> -Karin
>
> Am 08.02.18 um 00:55 schrieb Soumik Basu:
>
> Hello NCL-users,
>
> I am trying to draw circles around a station with different radius. For
> example 50 Km, 100 Km, 150 Km etc.
>
> So, I am wondering if there is any way to do it in NCL.
>
> I looked at the "nggcog" function but from the description what I
> understand is that it can draw circles along a great circle only not
> according to a given distance.
>
> Thank you for any help.
>
> Thanks,
> Soumik
>
> --
> --
> “We’ve all got both light and dark inside us. What matters is the part we
> choose to act on. That’s who we really are.” – J.K. Rowling
>
> ************************************************************
> **************************************
> Dr. Soumik Basu
> Post Doctoral Research Faculty
> International Arctic Research Center, UAF, Fairbanks, AK, USA
> PhD in Atmospheric Sciences
> M.Sc. in Atmospheric Sciences
> Email: suvro05 at gmail.com
> website: http://soumikbasu.weebly.com/
>
> ************************************************************
> ***************************************
>
>
> _______________________________________________
> ncl-talk mailing listncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180208/9fefbb99/attachment.html>


More information about the ncl-talk mailing list