爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 13491|回复: 2

[脚本编辑] ctl文件内容修改

[复制链接]

新浪微博达人勋

发表于 2019-4-7 17:49:36 | 显示全部楼层 |阅读模式
10金钱
求助,在使用GrADS画湿位涡是关于CTL文件的问题。
以下是我得到的原作者ctl文件内容:

DSET f:\NCEP\thse.dat
TITLE Upper Data
undef -9.99E33
xdef 45 linear 50 2.5
ydef 25 linear 10 2.5
zdef 8 levels 1000 925 850 700 600 500 400 300
tdef 53 linear 0z20Aug2005 6hr
vars 3
thse 8 99 temps
uwnd 8 99 u-wind
vwnd 8 99 v-wind
Endvars


由于我的数据是NCEP/NCAR一日四次的再分析数据,与原作者使用的数据有一些出入,因此需要更改上述ctl文件中的部分内容以适用于我的dat数据。我需要的时间段是1991年7月5日00时至6日12时,即t = 741至t = 747.
以下是我的数据内容:
netcdf uwnd.1991 {
dimensions:
        lon = 144 ;
        lat = 73 ;
        level = 17 ;
        time = UNLIMITED ; // (1460 currently)
variables:
        float level(level) ;
                level:units = "millibar" ;
                level:actual_range = 1000.f, 10.f ;
                level:long_name = "Level" ;
                level:positive = "down" ;
                level:GRIB_id = 100s ;
                level:GRIB_name = "hPa" ;
                level:axis = "Z" ;
        float lat(lat) ;
                lat:units = "degrees_north" ;
                lat:actual_range = 90.f, -90.f ;
                lat:long_name = "Latitude" ;
                lat:standard_name = "latitude" ;
                lat:axis = "Y" ;
        float lon(lon) ;
                lon:units = "degrees_east" ;
                lon:long_name = "Longitude" ;
                lon:actual_range = 0.f, 357.5f ;
                lon:standard_name = "longitude" ;
                lon:axis = "X" ;
        double time(time) ;
                time:long_name = "Time" ;
                time:delta_t = "0000-00-00 06:00:00" ;
                time:standard_name = "time" ;
                time:axis = "T" ;
                time:units = "hours since 1800-01-01 00:00:0.0" ;
                time:actual_range = 1674264., 1683018. ;
        float uwnd(time, level, lat, lon) ;
                uwnd:long_name = "u-wind" ;
                uwnd:units = "m/s" ;
                uwnd:precision = 2s ;
                uwnd:least_significant_digit = 1s ;
                uwnd:GRIB_id = 33s ;
                uwnd:GRIB_name = "UGRD" ;
                uwnd:var_desc = "u-wind" ;
                uwnd:level_desc = "Multiple levels" ;
                uwnd:statistic = "Individual Obs" ;
                uwnd:parent_stat = "Other" ;
                uwnd:missing_value = -9.96921e+36f ;
                uwnd:actual_range = -104.3f, 132.6f ;
                uwnd:valid_range = -125.f, 160.f ;
                uwnd:dataset = "NCEP Reanalysis" ;

密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2019-4-7 21:49:52 | 显示全部楼层
你的问题没讲清楚啊,原始的NCEP资料直接用GrADS打开就能用,时间段直接用 set t 就行······
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

新浪微博达人勋

发表于 2019-4-13 08:38:36 | 显示全部楼层
首先批量操作nc文件的ctl需要用xdfopen命令打开,即“xdfopen nc.ctl”
如果你nc的变量没有变化,你的ctl应改为如下:

DSET f:\NCEP\%y4.nc*%y4代表了(f:\NCEP\文件夹下,你想批量操作的nc)四位数年资料,如果资料名字为201402.nc则此处改为%y4%m2.nc
TITLE Upper Data
options template  *这个必须要有的,具体啥含义忘记了,可以去看手册
options yrev  *这个是看情况加的,在有些nc资料在批量描述后,Y坐标是相反的情况下再加,
undef -9.99E33
xdef latitude 45 linear 50 2.5 *红色部分是你数据说明中“lat:long-name”中获取的,需要自己加
ydef latitude 25 linear 10 2.5 *红色部分是你数据说明中“lon:long_name = "Longitude"”中获取的,需要自己加
zdef level 8 levels 1000 925 850 700 600 500 400 300
tdef time 747 linear 0z20Aug2005 6hr *把红色部分修改为你的时间,0z20Aug2005应为你第一个文件的第一个日期
vars 3
thse 8 99 temps
uwnd 8 99 u-wind
vwnd 8 99 v-wind
Endvars
Grads识别nc资料的CTL,也就是说想要用xdfopen命令批量打开读取nc的ctl文件,最重要的就是需要建立维数对应,以便软件能够正确理解数据的结构和逻辑,所以与一般的ctl(open)不同的地方就在于“xdef latitude 45 linear 50 2.5 ”中latitude的添加
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册 新浪微博登陆

本版积分规则

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

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

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