爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 4349|回复: 1

[脚本编辑] 求如何在没有undef的情况下写Ctl文件

[复制链接]
回帖奖励 10 金钱 回复本帖可获得 5 金钱奖励! 每人限 1 次

新浪微博达人勋

 成长值: 0
发表于 2022-1-20 00:34:12 | 显示全部楼层 |阅读模式

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

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

x
大家好,

我现在想给一个netcdf文件写ctl,这个netcdf无法直接被grads打开,会显示“NetCDF: unknown data format”
我检查了该nc文件后得到如下信息:

netcdf CAT_PRECT_256x512.eam.h1 {
dimensions:
        lat = 256 ;
        lon = 512 ;
        nbnd = 2 ;
        time = UNLIMITED ; // (3936 currently)
variables:
        double lat(lat) ;
                lat:long_name = "Latitude of Grid Cell Centers" ;
                lat:standard_name = "latitude" ;
                lat:units = "degrees_north" ;
                lat:axis = "Y" ;
                lat:valid_min = -90. ;
                lat:valid_max = 90. ;
                lat:bounds = "lat_bnds" ;
        double lon(lon) ;
                lon:long_name = "Longitude of Grid Cell Centers" ;
                lon:standard_name = "longitude" ;
                lon:units = "degrees_east" ;
                lon:axis = "X" ;
                lon:valid_min = 0. ;
                lon:valid_max = 360. ;
                lon:bounds = "lon_bnds" ;
        double lat_bnds(lat, nbnd) ;
                lat_bnds:long_name = "Gridcell latitude interfaces" ;
        double lon_bnds(lon, nbnd) ;
                lon_bnds:long_name = "Gridcell longitude interfaces" ;
        double area(lat, lon) ;
                area:long_name = "Solid angle subtended by gridcell" ;
                area:standard_name = "solid_angle" ;
                area:units = "steradian" ;
                area:cell_mathods = "lat, lon: sum" ;
        float PRECT(time, lat, lon) ;
                PRECT:units = "m/s" ;
                PRECT:long_name = "Total (convective and large-scale) precipitation rate (liq + ice)" ;
                PRECT:cell_measures = "area: area" ;
                PRECT:cell_methods = "time: mean" ;
        double time(time) ;
                time:long_name = "time" ;
                time:units = "days since 2020-01-20 00:00:00" ;
                time:calendar = "noleap" ;
                time:bounds = "time_bnds" ;
                time:cell_methods = "time: mean" ;
        double time_bnds(time, nbnd) ;
                time_bnds:long_name = "time interval endpoints" ;
                time_bnds:cell_methods = "time: mean" ;



我写的ctl如下:

dset ^CAT_PRECT_256x512.eam.h1.nc
title CAT_PRECT
undef -9.99e8
xdef 512 linear 0 0.703125
ydef 256 linear -90 0.703125
zdef 128 linear 0 127
tdef 3936 linear 00Z20JAN2020 15mn
vars 1
precip=>PRECT  0  t,y,x  precipitation rate
endvars


打开之后显示的是乱码 (3e+38..)
我尝试过用cdo 添加missing values (cdo setmissval,-9.99e8 input.nc output.nc), 但结果没有差别。
求问该nc文件如何写ctl文件,谢谢!
我也试过在ctl中加入dtype netcdf,但加入之后文件都无法打开
密码修改失败请联系微信:mofangbao

新浪微博达人勋

 成长值: 0
发表于 2022-1-20 07:15:24 | 显示全部楼层
自己鼓捣半天搞定了。。
我不知道为什么,我的这个netcdf不是classic netcdf,所以我先将这个文件转化为classic netcdf (nccopy -k 1 input.nc output.nc), 再通过cdo加入missing value,就可以用ctl读取了。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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