爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6856|回复: 4

怎样用NCL给nc文件里面的几个变量进行重新排序

[复制链接]
发表于 2016-2-16 14:33:08 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
初学者。请多多指教。谢谢! 或者大神门有其他可以处理的方式,也可以教一下我~

原nc文件用ncl读取,为:dimensions:
lev =
lat =
lon =
time =
Variables:
lat
lon
lat_bnds
lon_bnds

我的问题是 -->
需将variables的顺序改成:

Variables:
lat
lat_bnds
lon
lon_bnds
密码修改失败请联系微信:mofangbao
发表于 2016-2-16 15:15:55 | 显示全部楼层
你是想生成新的NC文件?还是仅仅是处理它?
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-2-16 23:42:43 | 显示全部楼层
琼满楼 发表于 2016-2-16 15:15
你是想生成新的NC文件?还是仅仅是处理它?

我的文件都很大,是不是只需要处理就好了?不过生成新的文件也可以,只要我的variables顺序变了就好。因为刚接触这个,所以很多都不是很懂,只知道一个大概。现在脑子里就知道要改顺序,但不知道怎么操作。

我是用WRF做气候模拟,虽然这个论坛是搞气象的,但我觉得还是问问这里比较好。我用的是GFDL的数据当做input到ungrib,但是GFDL下载的nc文件不能直接被ungrib读取,所以,我需要先对nc文件做处理,然后转成grib,最后input到ungrib.exe里。

我试过直接用cdo做处理http://www.meteo.unican.es/wiki/cordexwrf/SoftwareTools/CmorPreprocessor,无果。后来看到这个帖子,得知需要先对nc文件做处理,觉得会对我很有帮助:http://forum.wrfforum.com/viewtopic.php?f=22&t=6946

里面提到:“Next, I read in each netcdf file, resorted the variable order, and removed the excess data. I found the GFDL output is not entirely CFL compliant. To fix it you need resort the variables and dimensions to be in the same order. Specifically, time, lev, lev_bnds, lat, lat_bnds, lon, lon_bnds in the variables and time, lev, lat, lon in the dimensions. The order of the remaining variables I found did not matter. You will also need to removed the "bnds" attribute from the a and b variables (else CDO will not read the vertical coordinate correctly). If you need a reference, I would suggest downloading a file or two from MIROC5 and trying to match its style. I found this format served me well with MIROC5, but also with GFDL-ESM2M. At this stage you are ready for CDO...”
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2016-2-17 08:35:07 | 显示全部楼层
!!!刚才发现,其实是我的CDO版本的问题!我之前安装的是1.7.0,现在改成1.6.9或者更低的版本,就没有warning或者报错了。晕!感觉一周的时间都浪费了!

不过我还是很想知道怎么用NCL语言实现变量重新排序的问题。谢谢!
密码修改失败请联系微信:mofangbao
发表于 2019-9-7 09:18:21 | 显示全部楼层
wrf123 发表于 2016-2-17 08:35
!!!刚才发现,其实是我的CDO版本的问题!我之前安装的是1.7.0,现在改成1.6.9或者更低的版本,就没有warnin ...

请问你是用的cdo的什么指令?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表