python - How to get the sum of the values when the columns have different sizes -
i have 42 files containing 42 days' data of 1 variable/profile (i.e. each file has 1 variable , altitude) , need calculate sum , average of variable @ same height.
however, variables/columns in 42 files have different sizes. example, in file 0.cdf, tdry.shape = 3085 whereas in file 1.cdf, tdry.shape = 3505. how can add several columns different sizes , still sum same altitude?
from scipy.io import netcdf import numpy np pylab import * import numpy matplotlib import rc tdry_sum = np.zeros(3085, dtype = float) in range(0,42): path = "/data/{}.cdf".format(i) = netcdf.netcdf_file(path,'r') tdry = a.variables['tdry'][:] #variable alt = a.variables['alt'][:] #altitude tdry_sum = try_sum + tdry
Comments
Post a Comment