爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 5840|回复: 1

[其他] 【提问】批量读取文件

[复制链接]

新浪微博达人勋

发表于 2016-4-21 11:15:25 来自手机 | 显示全部楼层 |阅读模式

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

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

x
本帖最后由 glozs 于 2016-4-21 11:20 编辑

文件名基本一样,类似*.000.cdf,*.001.cdf,*.002.cdf,如何一次性批量读取,求大神指导!!拜谢!!
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2016-4-21 12:10:57 | 显示全部楼层
本帖最后由 xuebiz 于 2016-4-21 12:16 编辑

addfiles

官网language_man文档:
-------------------------------------------------
Section 3.1.7 Spanning multiple files
The function addfiles (note the trailing ‘s’) provides the user with the ability to access
data spanning multiple files. This function can concatenate records (default; “cat”) or
"join" variables from different files by adding an extra dimension. In this example, we use
systemfunc (see section 5.8) to get a listing of all the ann* netCDF files in the current
directory.
fils = systemfunc("ls ann*.nc")
f   = addfiles(fils,"r")
T  = f[:]->T

------中文版--------------------------------------------------
多文件处理:
函数addfiles(注意多出s)能够存取多个文件的数据。如:
fils = systemfunc(“ls ann*,nc”)
f  = addfiles(fils,”r”)
T  = f[:]->T
这里合成的变量T将会跨度所有文件。


详见:
http://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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