Re: error in Ngl.ftcurv function

From: [BE] Ufuk Utku Turuncoglu <turuncu_at_nyahnyahspammersnyahnyah>
Date: Thu, 26 Apr 2007 09:56:28 +0300

Hi,

No, it is not working. it still gives same error messages.

thanks for your kindly help,

ufuk

Fred Clare wrote:
> Ufuk,
>
> OK, try putting the following two lines in your code:
>
> import gc
> gc.disable()
>
> This disables garbage collection. I am not sure that this
> will propagate down to the C extension level. Let me know
> if it works.
>
> Fred
>
> On Apr 25, 2007, at 1:07 PM, turuncu_at_be.itu.edu.tr wrote:
>
>> Hi,
>>
>> I change the loop as,
>>
>> for i in xrange(0, im):
>> print i
>> x = None
>> lat[i,:] = Ngl.ftcurv(ctlpix[:], ctllat[i,:], npix[:])
>> lon[i,:] = Ngl.ftcurv(ctlpix[:], ctllon[i,:], npix[:])
>>
>> but it gives same error. my python version is 2.4.3. may be the problem
>> could be related with version of the python and its modules (such as,
>> numeric etc.) and i am using redhat as 3.0.
>>
>> Ufuk
>>
>>> Hmmmm. Works for me.
>>>
>>> Anyway, try the following. In the loop, before the ftcurv call,
>>> insert:
>>>
>>> x = None
>>>
>>> This may seem stupid, but the problem is that the Python object
>>> "None" is being garbage collected and when the low level code
>>> tries to decrease its reference count and that count is already
>>> zero, you get the error. The above should keep the reference
>>> count positive.
>>>
>>> Again, let me know if this does not work and we will try something
>>> else.
>>>
>>> Fred
>>>
>>> On Apr 25, 2007, at 12:09 AM, [BE] Ufuk Utku Turuncoglu wrote:
>>>
>>>> Hi,
>>>>
>>>> It is not working,
>>>>
>>>> 1329
>>>> 1330
>>>> Fatal Python error: deallocating None
>>>> Abort (core dumped)
>>>>
>>>> it is terminating in 1330 step. So i try to interpolate the
>>>> variables in two seperate step. first step from 0 to 1329 and then
>>>> 1330 to 2040 but the problem still exist. The modified part as
>>>> follows,
>>>>
>>>> for i in xrange(0, 1329):
>>>> print i
>>>> lat[i,:] = Ngl.ftcurv(ctlpix[:], ctllat[i,:], npix[:])
>>>> print "------"
>>>> for i in xrange(1329, im):
>>>> print i
>>>> lat[i,:] = Ngl.ftcurv(ctlpix[:], ctllat[i,:], npix[:])
>>>>
>>>> and the output is,
>>>>
>>>> 1327
>>>> 1328
>>>> ------
>>>> 1329
>>>> 1330
>>>> Fatal Python error: deallocating None
>>>> Abort (core dumped)
>>>>
>>>> so, it is not working in this case.
>>>>
>>>> best wishes
>>>>
>>>> ufuk
>>>>
>>>> Fred Clare wrote:
>>>>> Hi Ufuk,
>>>>>
>>>>> I think I have found the problem. Unfortunately it is in the C
>>>>> extension
>>>>> module and will require rebuilding the package. As a temporary
>>>>> workaround, try splitting up your loop as:
>>>>>
>>>>> for i in xrange(0, im):
>>>>> lat[i,:] = Ngl.ftcurv(ctlpix[:], ctllat[i,:], npix[:])
>>>>> for i in xrange(0, im):
>>>>> lon[i,:] = Ngl.ftcurv(ctlpix[:], ctllon[i,:], npix[:])
>>>>>
>>>>> Let me know if that does not work for you.
>>>>>
>>>>> Fred Clare
>>>>>
>>>>> On Apr 24, 2007, at 8:15 AM, [BE] Ufuk Utku Turuncoglu wrote:
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I try to plot the modis sst data and i need to interpolate
>>>>>> coordinate variables. So i write following script based on an IDL
>>>>>> script which is found in,
>>>>>>
>>>>>> http://seadas.gsfc.nasa.gov/forum/oceancolor/topic_show.pl?tid=758
>>>>>>
>>>>>> I am using Ngl.ftcurv function for interpolation but it gives me
>>>>>> following error,
>>>>>>
>>>>>> Fatal Python error: deallocating None
>>>>>> Abort (core dumped)
>>>>>>
>>>>>> so, i does not have any detailed information. I check the memory
>>>>>> usage of my script but it is around %2-%3 of the total memory.
>>>>>> The part of my script as follows,
>>>>>>
>>>>>> hdf = Nio.open_file("../sst/A2002232102000.L2_LAC_SST.hdf", "r")
>>>>>>
>>>>>> sst = hdf.variables['sst']
>>>>>> ctllat = hdf.variables['latitude']
>>>>>> ctllon = hdf.variables['longitude']
>>>>>> ctlpix = hdf.variables['cntl_pt_cols']
>>>>>>
>>>>>> im = sst.shape[0]
>>>>>> jm = sst.shape[1]
>>>>>> lat = zeros((im, jm), Float)
>>>>>> lon = zeros((im, jm), Float)
>>>>>> npix = zeros(jm, Int)
>>>>>>
>>>>>> for i in xrange(0, jm):
>>>>>> npix[i] = i
>>>>>>
>>>>>> for i in xrange(0, im):
>>>>>> print i
>>>>>> lat[i,:] = Ngl.ftcurv(ctlpix[:], ctllat[i,:], npix[:])
>>>>>> # lon[i,:] = Ngl.ftcurv(ctlpix[:], ctllon[i,:], npix[:])
>>>>>>
>>>>>> so, i have also interpolate the long valuse using last line of
>>>>>> the script. but in this case it terminates in i=650 in this case
>>>>>> it terminates the i=1350 the total processed i values is 2040.
>>>>>> But it is not memory related problem as i mention before. The
>>>>>> dimensions of the ctlpix, ctllon and npix is,
>>>>>>
>>>>>> ctlpix = (170,)
>>>>>> ctllon = (2040, 170)
>>>>>> npix = (1354,)
>>>>>>
>>>>>> Best regards,
>>>>>>
>>>>>> Ufuk Utku Turuncoglu
>>>>>> Istanbul Technical University
>>>>>> Informatics Institute
>>>>>> HPC Lab
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> pyngl-talk mailing list
>>>>>> pyngl-talk_at_ucar.edu
>>>>>> http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
>>>>
>>>
>>
>>

_______________________________________________
pyngl-talk mailing list
pyngl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Thu Apr 26 2007 - 00:56:28 MDT

This archive was generated by hypermail 2.2.0 : Thu Apr 26 2007 - 08:56:15 MDT