Re: PyNio and writing 3d variables

From: Hank Fisher <fisherh_at_nyahnyahspammersnyahnyah>
Date: Thu Jul 28 2011 - 14:41:33 MDT

        Thanks for the responses!

The combination of upgrading to Python 2.6 and PyNio 1.4 plus Nikos' suggestion

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

has solved my problem. I had tried that method in 1.3.0b1 and .0b5 and neither
had worked but it does in 1.4. I am off on PTO for a week but when I am back I
will try Tim's suggestion, as well, just for completeness sake.

Hank

On 07/28/2011 09:54 AM, Tim Supinie wrote:
> Hank,
> Just out of curiosity, have you tried
>
> nc.variables['sst_data'][:] = d.astype(np.float32)
>
> Tim Supinie
>
> On Wed, Jul 27, 2011 at 9:31 AM, Hank Fisher <fisherh@ucar.edu
> <mailto:fisherh@ucar.edu>> wrote:
>
>
> 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 <tel:303-497-2817> National Center for Atmospheric Research
> fisherh@ucar.edu <mailto: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
>
>

-- 
--------------------------------------------------------------
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
Received on Thu Jul 28 14:41:36 2011

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