python 2.7 - Matching Numpy and NetCDF4 indexing when creating a netCDF file -


I am trying to move values ​​from a NETIDER array to a NetCDF file, which I am making. Currently, I am trying to find the best way to imitate the 'fancy indexing' of Naxalite array while creating netdf file, but two indexing systems do not match when there are only two digits in the dataset.

netcodef4 import np rootgrp = netCDF4.Dataset ('Test.nc', 'w', format = 'NETCDF4') time = rootgrp.createDimension ('time', none ) Dim1 = rootgrp.createDimension ('dim1', 100) dim2 = rootgrp.createDimension ('dim2', 100) dim3 = rootgrp.createDimension ('dim3', 100) ncVar = rootgrp.createVariable ('ncVar', 'f4' , ('Time', 'dim1', 'dim2', 'dim3')) npArr = np.arange (0, 10000) npArr = np.reshape (npArr, (100100)) < P> Then it works fine:

  x, y = np.array (([1,75,10,99], [40,88,19,2])) NCVR [0, x, y, 0] = NpArr [x, y]  

although it is not:

  x, y = np.array ( ([1,75], [40, 88])) ncVar [0, x, y, 0] = npArr [x, y]  

The assignment is part of the dynamic loop Edit the <100> time-step

at ncVar to create a value for x, y : This issue seems to be the first The case recognizes X, Y to define the chain of PCs, and therefore gives the array of size (despite documentation on NDDFF 4), whereas the latter defines them together And therefore gives an array of [2,2] size (as explained in the document has gone). Has anyone been run in it or found an alternate solution?


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -