Re: Nio Hangs With __setslice__ on Unlimited Dimension

From: David Brown <dbrown_at_nyahnyahspammersnyahnyah>
Date: Wed, 13 Aug 2008 11:21:58 -0600

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 Wed Aug 13 2008 - 11:21:58 MDT

This archive was generated by hypermail 2.2.0 : Thu Aug 21 2008 - 22:13:03 MDT