网站收录做关键词排名,坑梓网站建设,医疗营销网站建设,卡盟平台官网Numpy的hstack、vstack或dstack(取决于要连接数组的轴)将连接多维数组。在请注意#xff0c;对于MODIS气溶胶数据#xff0c;使用hstack连接阵列有时会抛出错误#xff0c;因为有时阵列是203 x 135#xff0c;有时是204 x 135#xff0c;因此水平维度并不总是匹配的基于您…Numpy的hstack、vstack或dstack(取决于要连接数组的轴)将连接多维数组。在请注意对于MODIS气溶胶数据使用hstack连接阵列有时会抛出错误因为有时阵列是203 x 135有时是204 x 135因此水平维度并不总是匹配的基于您的代码构建(不漂亮但功能强大)import globimport numpy as npimport osfrom pyhdf.SD import SD,SDCfiles glob.glob(MOD04*)files.sort()for n, f in enumerate(files):product f[0:5] -Atmospheric Productyear f[10:14]jdn f[14:17] # julian day number# Read dataset.hdf SD(f, SDC.READ)data3D hdf.select(Deep_Blue_Aerosol_Optical_Depth_550_Land)data data3D[:,:].astype(np.double)# Read geolocation datasetlat hdf.select(Latitude)latitude lat[:,:]lon hdf.select(Longitude)longitude lon[:,:]if n ! 0 and jdn ! old_jdn:#do analysis; write to file for later analysis; etc.passif n 0 or jdn ! old_jdn:data_timeseries datalatitude_timeseries latitudelongitude_timeseries longitudeelse:data_timeseries np.vstack((data_timeseries, data))latitude_timeseries np.vstack((latitude_timeseries, latitude))longitude_timeseries np.vstack((longitude_timeseries, longitude))print data_timeseries.shapeprint latitude_timeseries.shapeprint longitude_timeseries.shapeold_jdn jdn