get every season data from serveral years data

54 Views Asked by At

I'm using python and trying to calculate trends of SIC of different season. So i need to cut every season from all the months from 1979 to 2009

print sic.shape
 (372, 180, 360)

sics=sic[90,:,:]
sicm=[]
for i in range(0,12):
    sicj=sic[i::12,:,:]
    sicm.append(sicj)
    del sicj
sics[0::3,:,:]=sicm[11][:30,:,:]
sics[1::3,:,:]=sicm[0][1:,:,:]
sics[2::3,:,:]=sicm[1][1:,:,:]

then the result showed that

IndexErrorTraceback (most recent call last) in () ----> 1 sics[0::3,:,:]=sicm[11][:30,:,:]

/home/charcoalp/anaconda2/envs/pyn_test/lib/python2.7/site-packages/numpy/ma/core.pyc in setitem(self, indx, value) 3299 _mask = self._mask 3300 # Set the data, then the mask -> 3301 _data[indx] = dval 3302 _mask[indx] = mval 3303 elif hasattr(indx, 'dtype') and (indx.dtype == MaskType):

IndexError: too many indices for array

My way is to cut every Jan,Feb,Mar...and make a new array to combine 3 months as the same season data. Is the problem can be solved or just my way is wrong?

Thanks a lot if you can help me

0

There are 0 best solutions below