NCAR / pyngl

Other
134 stars 30 forks source link

Ngl.regline causes segmentation fault #8

Open KMFleischer opened 5 years ago

KMFleischer commented 5 years ago

Hi,

I've just tested Ngl.regline with python 3 and run into a segmentation fault. The simple example below from the PyNGL Ngl.regline function description page demonstrates what happend.

import Ngl

x = [ 1190.,1455.,1550.,1730.,1745.,1770., \ 1900.,1920.,1960.,2295.,2335.,2490., \ 2720.,2710.,2530.,2900.,2760.,3010. ] y = [ 1115.,1425.,1515.,1795.,1715.,1710., \ 1830.,1920.,1970.,2300.,2280.,2520., \ 2630.,2740.,2390.,2800.,2630.,2970. ]

print('--> regline') rc,attrs = Ngl.regline(x,y,return_info=True) print (rc) print (attrs)

Note use of dictionary items

df = attrs["nptxy"]-2 tval = attrs["tval"] yint = attrs["yintercept"] prob = (1 - Ngl.betainc(df/(df+tval^2), df/2.0, 0.5) )

yReg = rc*x + yint print ("prob",prob) print (yReg)

Bye, Karin

KMFleischer commented 5 years ago

Forget the 'Note use of dictonary items' line. I've tried to use italic font to emphasize the source code but it doesn't work correctly.

marylhaley commented 5 years ago

I will flag this function as a high priority one to implement in PyNCOMP. The PyNGL computational routines should be deprecated at some point in favor of PyNCOMP.

HLQ1996hlq commented 4 years ago

Hi, i just met the same question. Did it work? Or we can not use Ngl.regline() right now?

rbrownrigg commented 4 years ago

It works for me. However, I was originally able to duplicate the SEGV Karin was experiencing. The following is what I wrote about it in an email to colleagues, back in January:


For what it's worth, I tried to look into this today. I installed PyNGL via conda, into an environment that had only PyNIO previously installed. It promptly threw exceptions all over me when I tried to import Ngl. I futzed around for a bit and realized even importing Numpy failed on importing. Don't know why, very frustrating and I gave up (I have to imagine this is how scientists are going to feel/react)

Any how, I created a completely new environment here at home, and updated python to 3.72 from 3.6.x, installed pynio and pyngl, and lo and behold -- no core dump, and returned results from Karin's test script look reasonable.

On Wed, Nov 13, 2019 at 8:29 AM HLQ1996hlq notifications@github.com wrote:

Hi, i just met the same question. Did it work? Or we can not use Ngl.regline() right now?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/NCAR/pyngl/issues/8?email_source=notifications&email_token=ADLWOXVALG5YNEW7NH2654LQTQMLXA5CNFSM4GTQR47KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOED6QO3A#issuecomment-553453420, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADLWOXUYGNQHVDITXFMOIQ3QTQMLXANCNFSM4GTQR47A .