爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 6108|回复: 5

[讨论] netcdf.getVar 读取的网络nc数据存储在哪里?附:matlab直接读取网络nc数据资源样例

[复制链接]
发表于 2013-10-31 21:52:28 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 海蓝海魂一 于 2015-12-3 16:29 编辑

一楼格式错乱,烦请移步二楼~

下面是网站(http://www.opendap.org/user/jimg/blog/matlab_2012a)上的一篇关于用matlab直接读取网络上数据资源的样例,拿来分享之~~顺便有一点不懂之处想请假各位。就是data = netcdf.getVar(ncid,3);这个命令可以直接从网上获取数据了,但我用的那个dataset不是样例里的,非常大,这样下下来之后保存在哪里了,关掉matlab之后会继续占我电脑存储空间吗?
% To open a remote dataset, use its URL:modis='http://test.opendap.org/dap/data/hdf/MOD08_D3.A2001153.003.2001207172930.hdf.gz';ncid = netcdf.open ( modis );% If you don't know what it contains, start by using the 'netcdf.inq' operation:[numdims,numvars,numglobalatts,unlimdimid] = netcdf.inq(ncid);% How many variables are there?>> numvarsnumvars = 666% Lets look at the fourth variable:[name,xtype,dimids,natts] = netcdf.inqVar(ncid,3);>> namename = mod08.Data%20Fields.Scattering_Angle_Maximum% Now lets get values for 'Scattering_Angle_Maximum'>> data = netcdf.getVar(ncid,3);>> datadata =  Columns 1 through 22  -9999  11924  12044  12135  12226  12298  12386  12513  12619  12712  12820...  -9999  11942  12037  12128  12220  12313  12413  12518  12612  12720  12820...  -9999  11899  12019  12121  12214  12299  12418  12511  12621  12721  12823......
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2013-10-31 21:54:35 | 显示全部楼层
不好意思,样例的格式似乎有错误,重发一遍。。。
% To open a remote dataset, use its URL:
modis='http://test.opendap.org/dap/data/hdf/MOD08_D3.A2001153.003.2001207172930.hdf.gz';

ncid = netcdf.open ( modis );

% If you don't know what it contains, start by using the 'netcdf.inq' operation:
[numdims,numvars,numglobalatts,unlimdimid] = netcdf.inq(ncid);

% How many variables are there?
>> numvars
numvars = 666

% Lets look at the fourth variable:
[name,xtype,dimids,natts] = netcdf.inqVar(ncid,3);
>> name
name = mod08.Data%20Fields.Scattering_Angle_Maximum
% Now lets get values for 'Scattering_Angle_Maximum'
>> data = netcdf.getVar(ncid,3);
>> data
data =
  Columns 1 through 22
  -9999  11924  12044  12135  12226  12298  12386  12513  12619  12712  12820...
  -9999  11942  12037  12128  12220  12313  12413  12518  12612  12720  12820...
  -9999  11899  12019  12121  12214  12299  12418  12511  12621  12721  12823...
..

评分

参与人数 1金钱 +10 贡献 +2 收起 理由
Aires + 10 + 2

查看全部评分

密码修改失败请联系微信:mofangbao
发表于 2013-11-1 11:06:17 | 显示全部楼层
关掉之后应该不会占用你内存吧。我一般都是下完数据才处理的。你help一下看看有没有相关的例子。
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2013-11-1 17:40:11 | 显示全部楼层

好的,谢谢~我开始是怕像缓存文件一样占用c盘的地方
密码修改失败请联系微信:mofangbao
发表于 2015-11-4 23:22:04 | 显示全部楼层
学习了,谢谢楼主分享
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2015-11-9 08:45:45 | 显示全部楼层
ziqiangbuxi 发表于 2015-11-4 23:22
学习了,谢谢楼主分享

共同进步
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

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

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