在服务器上跑CESM模式,得到nc文件,进行处理:
在服务器上对nc文件进行切片,下载,在python或MATLAB上画图;
在服务器上对nc文件进行切片,在服务器上画图。
方法一 nc文件切片下载处理
一、服务器部分
找到模式所得文件,进行切片处理
cdo -selname,variable1 input_file output_file
多个文件处理:
#读取文件夹所有文件,grep找到包含字符串的文件为要处理的文件
#IFS(Internal Field Seprator),内部域分隔符
对切片后的文件进行下载,使用python或MATLAB处理。
二、个人计算机部分
1、MATLAB处理
添加M-Map,进行画图。
2、python处理
下载cartopy,运行失败参考方式:
https://www.cnblogs.com/roundfish/p/15982373.html
https://blog.csdn.net/QJBMFCH/article/details/126748181
进行画图,cartopy使用手册:
https://www.osgeo.cn/pygis/cartopy-intro.html
https://zhuanlan.zhihu.com/p/544122658
lon = np.reshape(np.array(ds['ULONG']),[384*320])
lat = np.reshape(np.array(ds['ULAT']),[384*320])
sst = np.reshape((temp[:,:,0]),[384*320])
fig = plt.figure(dpi = 600)
ax = fig.add_subplot(1,1,1,projection = ccrs.PlateCarree(central_longitude=180))
norm = colors.TwoSlopeNorm(vmin=np.min(sst), vcenter=0, vmax=np.max(sst))
conf = ax.tricontourf(lon-180,lat,sst,40,cmap=cmaps.NCV_jaisnd,norm=norm)
ax.add_feature(cfeature.COASTLINE.with_scale('50m'),lw = 0.5)
ax.set_xticks(np.arange(-180,180.1,60))
ax.set_yticks(np.arange(-90,90.1,30), crs=ccrs.PlateCarree())
# ax.add_feature(cfeature.LAND.with_scale('50m'),facecolor = 'g')
lon_formatter = LongitudeFormatter(zero_direction_label=False)
lat_formatter = LatitudeFormatter()
ax.xaxis.set_major_formatter(lon_formatter)
ax.yaxis.set_major_formatter(lat_formatter)
plt.colorbar(conf)
方法二 在服务器直接处理
1、环境
anoconda
jupyter安装:
2、方法
jupyter直接运行,参考个人计算机Python处理部分
厄尔尼诺指数计算
参考:https://northfar.net/nino-intro/
Nino3.4指数参考:
https://origin.cpc.ncep.noaa.gov/products/analysis_monitoring/ensostuff/ONI_v5.php
https://origin.cpc.ncep.noaa.gov/products/analysis_monitoring/ensostuff/detrend.nino34.ascii.txt
模式运行得到的nc文件格式与ERSST格式不同,需要分别处理