爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4214|回复: 0

[程序设计] nc文件中变量的替换

[复制链接]

新浪微博达人勋

发表于 2016-7-12 21:48:43 | 显示全部楼层 |阅读模式

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

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

x
由于LAPS模式有模块不太好用,所以用其它模块代替它来运行,所以得替换其中的背景场数据
%% 替换nc数据中的tsf和tgd
% open netcdf file
ncid = netcdf.open('D:\laps_test1\background_data\1420600001100.lgb','NC_WRITE');
% put file in define mode
netcdf.reDef(ncid);
% get name of tgd variable
[varname,xtype,varDimIDs,varAtts] = netcdf.inqVar(ncid,3)
% rename the variable ,using a capital letter to start the name
netcdf.renameVar(ncid,3,'tsf')

注意:运行一次不会修改其中变量的名称,再次运行的时候会报错,但是其中的变量名被修改,所以报错可以忽略。(不知道为什么?希望大神补充下)
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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