爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博登陆

只需一步, 快速开始

搜索
查看: 3829|回复: 6

ERA5区域数据和全球数据不匹配

[复制链接]

新浪微博达人勋

发表于 2022-8-9 17:02:21 | 显示全部楼层 |阅读模式
数据资料
我看过提问的智慧: 看过

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

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

x
今天下了一些ERA5逐小时全球温度数据,和半年前下载的区域数据对比,发现不太一致,基本同一格点同一时间的数值都不相同,只是很接近……
为了验证,又下了2000年1月1日0时的全球和区域数据,两个文件除了一个选了区域一个没选之外没有任何差别。

代码如下:
def check(var):
    f1 = r'E:/test.nc'
    ds1 = xr.open_dataset(f1)
    a = ds1['{:}'.format(var)].loc[:,60,0].values[0]

    f2 = r'E:/test2.nc'
    ds2 = xr.open_dataset(f2)
    b = ds2['{:}'.format(var)].loc[:,60,0].values[0]

    print('equal? ',(a==b).all())
    print('close? ',np.allclose(a,b))
    print('minus:',a-b)
check('t2m')

结果:
equal?  False
close?  True
minus: -0.00018310547

百思不得其解,有没有遇到类似问题的……或者是我的代码哪里有问题?
密码修改失败请联系微信:mofangbao

新浪微博达人勋

发表于 2022-8-9 17:37:29 | 显示全部楼层
其他时段没注意,上次收到邮件说1950-1979的更新过
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-8-9 18:48:35 | 显示全部楼层
freekiller 发表于 2022-8-9 17:37
其他时段没注意,上次收到邮件说1950-1979的更新过

我用的是2000年的数据,而且为了确认是不是数据更新,我放出来的这个都是今天下载的…………
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-8-10 10:32:24 | 显示全部楼层
是不是浮点数比较的问题
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-8-10 10:57:08 | 显示全部楼层
wjy_ecnu 发表于 2022-8-10 10:32
是不是浮点数比较的问题

有可能……但这要怎么规避呢?
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

发表于 2022-8-10 14:42:07 | 显示全部楼层
一一一一 发表于 2022-8-10 10:57
有可能……但这要怎么规避呢?

abs(a-b)<1e-10 试试
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

新浪微博达人勋

 楼主| 发表于 2022-8-11 14:33:16 | 显示全部楼层
好吧,在官方论坛找到了类似的问题,收到的回复是:
The grib are the 'original' data, and the netCDF files are produced from these using conversion software. This conversion can introduce small differences. However the same software is used for the conversion whether you use the CDS web or CDS API to request the data, so for exactly the same request, you should get exactly the same file for both methods.
However, if the requests are different (e.g. slightly different area selected, so the data are interpolated) then you may see small differences.
也就是说,nc文件是由grib文件插值得到的,原始的分辨率也不是0.25°,印象里好像是31km,0.28125°。所以截取区域数据就会有一些差异。
密码修改失败请联系微信:mofangbao
回复 支持 反对

使用道具 举报

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

本版积分规则

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

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

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