爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3541|回复: 0

[讨论] 请教大家matlab写出netcdf4格式后,文件数据错误的问题。

[复制链接]

新浪微博达人勋

发表于 2017-3-7 22:42:47 | 显示全部楼层 |阅读模式

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

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

x
我用matlab把计算好的数据写出为netcdf4格式的文件后,重新打开写出的文件,发现变量数据是错误的,下面是我的程序,请教大家,这是什么问题引起的呢,谢谢。
outdirfile = [outputdatadir '/' outfile];%输出路径
mode = netcdf.getConstant('NC_NETCDF4');
mode = bitor(mode,netcdf.getConstant('NC_CLOBBER'));
outid = netcdf.create(outdirfile,mode);

latdimID = netcdf.defDim(outid,'latitude',161);
londimID = netcdf.defDim(outid,'longitude',161);%同理
latid = netcdf.defVar(outid,'latitude','double',latdimID);%定义变量,变量名等。
lonid = netcdf.defVar(outid,'longitude','double',londimID);
aotid = netcdf.defVar(outid,'AOT','double',[londimID,latdimID]);
netcdf.endDef(outid);%定义结束

netcdf.putVar(outid,latid,for_lat);%将值赋给变量
netcdf.putVar(outid,lonid,for_lon);
netcdf.putVar(outid,aotid,mean_out);
netcdf.reDef(outid);%赋值结束

netcdf.putAtt(outid,latid,'long_name','latitude');%对变量的说明
netcdf.putAtt(outid,latid,'units','degrees_north');
netcdf.putAtt(outid,latid,'standard_name','latitude');
netcdf.putAtt(outid,lonid,'long_name','longitude');
netcdf.putAtt(outid,lonid,'units','degrees_east');
netcdf.putAtt(outid,lonid,'standard_name','longitude');
netcdf.putAtt(outid,aotid,'long_name','Aerosol optical thickness');
netcdf.putAtt(outid,aotid,'units','Dimensionless');
netcdf.putAtt(outid,aotid,'valid_min',0);
netcdf.putAtt(outid,aotid,'valid_max',25000);
netcdf.putAtt(outid,aotid,'scale_factor',0.0002);
netcdf.putAtt(outid,aotid,'add_offset',0);
netcdf.putAtt(outid,aotid,'missing_value',-32768);
netcdf.close(outid);
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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