problem with PyNIO dimension sizes

From: Zach DuFran <zdufran_at_nyahnyahspammersnyahnyah>
Date: Fri, 12 Dec 2008 10:48:16 -0600

I am trying to write a 4D variable to a NetCDF file and I am receiving a fatal error. The line where the error occurs is prcp_NC[0,0,:,:] = prcp[t,:,:]. I have printed out the shapes of each variable and they match. When I switch the order in prcp_NC to be prcp_NC[:,:,0,0] the script will run succesfully, but the data in the NetCDF file is all blank.

If I assign prcp_NC as a 2D variable (only x and y) and do prcp_NC[:,:] = prcp[t,:,:] the data is written correctly.

The error message for the attached script is:
            fatal:Dimension sizes of left hand side do not match right hand side

The only way I can get the assignment to a 4D variable to work is to add 2 loops so the code reads:
      for i in xrange(nrows):
            for j in xrange(ncols):
                  prcp_NC[0,0,i,j] = prcp[t,i,j]

Of course, this method is considerably slower.

I would appreciate any help you can provide-
Zach DuFran

_______________________________________________
pyngl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/pyngl-talk

Received on Fri Dec 12 2008 - 09:48:16 MST

This archive was generated by hypermail 2.2.0 : Thu Jan 01 2009 - 08:39:20 MST