Re: PyNio and writing 3d variables

From: Hatzopoulos, Nikolaos <hatzopou_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 28 2011 - 09:51:54 MDT

instead of: nc.variables['sst_data'][0]

try: nc.variables['sst_data'][0,:,:]

--Nikos Hatzopoulos
________________________________________
From: pyngl-talk-bounces@ucar.edu [pyngl-talk-bounces@ucar.edu] on behalf of Hank Fisher [fisherh@ucar.edu]
Sent: Wednesday, July 27, 2011 7:31 AM
To: pyngl-talk@ucar.edu
Subject: PyNio and writing 3d variables

        I am having a curious problem. Currently I am unable to write a 3d variable to
a netcdf file using PyNio. 2d are all fine and easy but none of the following
methods seem to work....

nc.variables['sst_data'] = d.astype(np.float32)
or
nc.variables['sst_data'][0] = d.astype(np.float32)
or
nc.variables['sst_data'].assign_value(d.astype(np.float32))

        I have verified the shape of both the Netcdf variable (sst_data) and the one
containing the data (d). I have also experimented with reshaping d into 2d and
3d variables. Reshaping it into a 2d var and writing it to a 2d var works but
no amount of manipulation will let me write anything to a 3d var.

        I am using a fairly old version of PyNio 1.03b1 but have found the same issue
on 1.03b5. We will upgrade to 1.4 to see if that solves the problem but I would
love to know, has anyone else has run into this problem?

PyNio version 1.03b
Red Hat Enterprise Linux Server release 5.6

--
--------------------------------------------------------------
Hank Fisher         Research Applications Laboratory
303-497-2817        National Center for Atmospheric Research
fisherh@ucar.edu    P.O. Box 3000, Boulder CO 80307-3000
--------------------------------------------------------------
_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk
Received on Thu Jul 28 09:52:07 2011

This archive was generated by hypermail 2.1.8 : Fri Jul 29 2011 - 08:51:37 MDT