Perhaps a bug in NCL with natgrid

From: daryl herzmann <akrherz_at_nyahnyahspammersnyahnyah>
Date: Thu Mar 04 2010 - 10:39:36 MST

Hi Mary,

I hope you don't mind the direct email, I was going to send this to
pyngl-talk, but I think I found a bug with NCL, so maybe better just send
it directly to you folks.

daryl
------------------------------------------------
Hello PyNGL'rs!

I've got a script that loops over a bunch of times and attempts to natgrid
some data for each time. The issue is that sometimes natgrid hits a
failure (for instance, due to insufficient data). The problem is that
while natgrid returns None for the grid, any further calls to natgrid
result in a segfault. A simple reproducer is:

import Ngl
import numpy

vals = [278.14, 280.87, 280.87]
lats = [31.39, 33.21, 33.57]
lons = [-92.29, -87.62, -86.75]

XAXIS = numpy.arange(-92., -88.25, 0.25)
YAXIS = numpy.arange(30.,25., 0.25)

grid = Ngl.natgrid(lons, lats, vals, XAXIS, YAXIS)
grid = Ngl.natgrid(lons, lats, vals, XAXIS, YAXIS)

------------------------------

Looking up gdb, we find this error:

Program received signal SIGSEGV, Segmentation fault.
0x00002ac7557be22f in FreeMatrixd ()
    from /home/mesonet/python-2.5/lib/python2.5/site-packages/PyNGL/_hlu.so

which appears to be a NCL bug and sure enough, a simple NCL program
like above produces the same segfault.

Looking at the source code, I think the bug is on line 52 of
ngmath/src/lib/gridpack/natgrid/nncrunchs.c

FreeMatrixd(joints);

where joints is null. I don't fully have a build/debug environment set to
test this hypothesis though.

daryl

-- 
/**
  * Daryl Herzmann
  * Assistant Scientist -- Iowa Environmental Mesonet
  * http://mesonet.agron.iastate.edu
  */
Received on Thu Mar 4 18:12:52 2010

This archive was generated by hypermail 2.1.8 : Fri Jul 02 2010 - 10:10:53 MDT