创建netCDF4文件
out_file='.nc'
file_out=netCDF4.Dataset(out_file,'w')
file_out.createDimension('lat',180)
file_out.createDimension('lon',360)
file_out.createVariable('sst', np.float('lat','lon'))
file_out.variables['spatial'][:]=data片
np.hstack用法
原文地址
https://www.cjavapy.com/article/893/
去线性趋势
signal.detrend()
np.where()筛选拓展
'''将数列打包成可以用于np.where筛选的格式'''
lat_index=np.floor((lat_list+90)*96)
lon_index=np.floor((lon_list+180)*96)
lat_index=np.int64(lat_index);lon_index=np.int64(lon_index)
index_new=tuple((lat_index,lon_index))
np.where() 筛选条件合并
'''取交集'''
index1=np.where();index2=np.where();index3=np.where()
index_cross1=index1[np.in1d(index1, index2)]
index_cross2=index_cross1[np.in1d(index_cross1, index3)]
numpy与np.where tuple的相互转换
depth=[1,2,3,4,5,6]
depth=np.array(depth)
depth_tuple=[depth]
depth_tuple=tuple(depth_tuple) #可用于index直接筛选的数据格式