Re: Nio Hangs With __setslice__ on Unlimited Dimension

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Tue, 26 Aug 2008 17:03:26 -0600

Hi Omer,
I just wanted to let you know that I believe this problem has been
fixed in the beta version of the new PyNIO release. It is
now available on the ESG site. I would appreciate if you could try it
out and report any problems you still have.

  -dave

On Aug 13, 2008, at 11:21 AM, David Brown wrote:

> Hi Omer,
> Yes this does seem like a bug. I will try to fix it for the new
> release.
> -dave
>
> On Aug 13, 2008, at 10:43 AM, Omer Bar-or wrote:
>
>> Hello,
>>
>> I am using Nio version 1.2.0 on 32-bit Debian 4.0 (Etch). (uname -
>> a is at the bottom.)
>>
>> When setting a variable's data to an existing array, my
>> understanding of the best practice (at least from
>> Scientific.IO.NetCDF) is to do the following:
>>
>> var[:] = arr
>>
>> This practice works correctly when var is of a limited dimension,
>> but if it is of the unlimited dimension, Nio hangs (at least for
>> the twenty minutes or so that I let it run) and cannot be killed
>> with ctrl-c or the TERM signal.
>>
>> The only solution I have found is to specify the ending index
>> explicitly:
>>
>> var[:len(arr)] = arr
>>
>> Is this a bug? Is there a cleaner way to set an unlimited variable
>> with a slice of data?
>>
>> An example script on which Nio hangs (virtually copied from the
>> nio04.py example) is attached. Line 35 is the relevant line.
>>
>> Thanks,
>> - Omer.
>>
>> P.S.
>> > uname -a
>> Linux laika 2.6.18-6-686 #1 SMP Sun Feb 10 22:11:31 UTC 2008 i686
>> GNU/Linux
>>
>> import numpy
>> import Nio
>> import os
>>
>> #
>> # Creating a NetCDF file named "nio04.nc". If there is already
>> # a file with that name, delete it first.
>> #
>> filename = "nio04.nc"
>>
>> if (os.path.exists(filename)):
>> os.remove(filename)
>>
>> #
>> # Open a NetCDF file for writing file and specify a
>> # global history attribute.
>> #
>> file = Nio.open_file(filename, "w")
>> file.title = "Unlimited dimension test file"
>>
>> #
>> # Create some dimensions.
>> #
>> file.create_dimension("time", None) # unlimited dimension
>>
>> print file
>>
>> #
>> # Create a variable of type double with three dimemsions.
>> #
>> var = file.create_variable("var", 'd', ("time",))
>> var._FillValue = -999.0
>>
>> data = numpy.arange(10)
>> var[:] = data
>>
>> print "After assigning elements 0-9 of unlimited dimension:"
>> print file
>>
>> print "Closing '" + filename + "' file...\n"
>> file.close()
>>
>> _______________________________________________
>> 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 Tue Aug 26 2008 - 17:03:26 MDT

This archive was generated by hypermail 2.2.0 : Mon Sep 01 2008 - 06:41:22 MDT