[pyngl-talk] Function similar to NCL's nggcog?

Alyssa Stansfield alyssa.stansfield at stonybrook.edu
Fri Oct 19 10:54:13 MDT 2018


Mary,

Wow, thank you so much for this!

-Alyssa

On Fri, Oct 19, 2018 at 12:33 PM Mary Haley <haley at ucar.edu> wrote:

> Hi Alyssa,
>
> Normally I would suggest googling something like "great circle numpy" and
> you are likely to find a number of functions that calculate the same thing
> as NCL's nggcog.
>
> However, as an exercise, since I knew the nggcog Fortran routine was
> pretty short, I decided to see what it took to convert it to python. This
> routine calls an internal Fortran routine called ngritd, so I had to
> convert that too.
>
> I didn't try to do this the "pythonic" way, using array arithmetic instead
> of looping, because doing a line-by-line conversion was simply faster.
>
> See the attached nggcog.py which defines both nggcog and ngritd and has
> some driver code that generates and plot a great circle. I attached the NCL
> version for comparison. You should be able to run these as-is:
>
> python nggcog.py
> ncl nggcog.ncl
>
> I'm in the process of learning how to create Python versions of NCL
> scripts, so this was a good exercise.  :-)
>
> Note: the Python version of the nggcog routine is not tested, other than
> this plotting program. You might want to look at the Fortran code yourself
> to compare it with the Python code.
>
> The Fortran routines can be found on github:
>
> https://github.com/NCAR/ncl
>
> and then navigate down to this path:
>
> ncarg2d/src/libncarg/ngmisc
>
> and the nggcog.f and ngridt.f Fortran code can be found on that page:
>
> https://github.com/NCAR/ncl/tree/master/ncarg2d/src/libncarg/ngmisc
>
> --Mary
>
>
>
> On Wed, Oct 17, 2018 at 7:29 PM, Alyssa Stansfield via pyngl-talk <
> pyngl-talk at ucar.edu> wrote:
>
>> Hello,
>>
>> I am trying to plot a circle with a radius of 200 km around a certain
>> latitude and longitude on a map. I know that NCL has the nggcog command,
>> but does pyngl have anything similar? Or do you know of a workaround using
>> pyngl commands?
>>
>> Thank you,
>> Alyssa
>>
>> _______________________________________________
>> pyngl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/pyngl-talk/attachments/20181019/2b02fd1c/attachment.html>


More information about the pyngl-talk mailing list