CESM模式结果nc文件处理

文章讲述了如何在服务器上利用cdo工具对CESM模式生成的nc文件进行切片处理,并通过python或MATLAB下载处理后进行画图。两种方法中,一种涉及文件下载到本地用MATLAB的M-Map或python的cartopy进行地图绘制,另一种是直接在服务器上用jupyter进行处理。此外,还提及了厄尔尼诺指数的计算和相关数据源。
摘要由CSDN通过智能技术生成

在服务器上跑CESM模式,得到nc文件,进行处理:

  1. 在服务器上对nc文件进行切片,下载,在python或MATLAB上画图;

  1. 在服务器上对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安装:

https://blog.csdn.net/weixin_43913261/article/details/124648150?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522167783265016800188589123%2522%252C%2522scm%2522%253A%252220140713.130102334..%2522%257D&request_id=167783265016800188589123&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~sobaiduend~default-1-124648150-null-null.142

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

ERSST下载:https://www.baidu.com/link?url=wpxwgG67gQoDORa7Er3PGpCh5290Hkt-B22pQCK6e4LEmzuRMcgm8BD1FQrlC8gZaaBZTZjczEHFIqkXhTqRGAuMBcZhiGYOvXSe0omPV1m&wd=&eqid=a8ea6e0400006fed0000000464054dc7

模式运行得到的nc文件格式与ERSST格式不同,需要分别处理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值