May-15-2018, 08:17 PM
Do you have to use loops for this task? If not I would recommend using numpy without loops.
if you have a huge amount of data this way is much much more efficient than loops in combination with numpy.
if we can say, that your data has the dimensions: timexlatitudexlongitude then you can do following:
i havent tested it yet, but it may work :)
if you have a huge amount of data this way is much much more efficient than loops in combination with numpy.
if we can say, that your data has the dimensions: timexlatitudexlongitude then you can do following:
import numpy as np # quantity would be given at this point and is an 3-dimensional numpy array. new_quantity = np.add.reduceat(quantity, range(0, quantity.shape[0], 365))here is the documentation of reduceat https://docs.scipy.org/doc/numpy/referen...uceat.html
i havent tested it yet, but it may work :)