如何解决 cdo转换经度-180~180 为0~360时出现报错:cdo sellonlatbox: Unsupported grid type: generic的问题

简介: 如何解决 cdo转换经度-180~180 为0~360时出现报错:cdo sellonlatbox: Unsupported grid type: generic的问题
  • 问题起因:
    自己写出的nc文件经度的排序为:-180°~180°,用于插值时需要将其经度排序与目标文件的经度排序方式一致,恰巧我的目标nc文件经度排序为:0°~360°,需要先进行转换。
  • 虽然之前我也曾写过转换的方法,但是一般比较麻烦,还经常容易出问题。
  • 最近在学习cdo命令,发现cdo可以方便快捷的实现上述问题。只需要通过下列一行命令即可:
  • cdo sellonlatbox,lon1,lon2,lat1,lat2 input.nc output.nc


input.nc 就是你要输入的nc文件output.nc就是转换完成后输出的nc文件

但是在我进行转换时,却发现报错了:


31a303bdf62e4e86ab0cd4b8dd63249e.png


通过网页查找,发现问题如下图所示,我创建的nc文件中,grid coordinates网格的格式为:generic (通用)

cdo无法识别该格式


d3f6cd2afbc64b728b4ddb4d6e4d6a05.png


解决方法:


generic 转换为 lonlat 格式

通过下面的命令可以实现:


1、创建一个新的网格文件,将“generic”替换为“lonlat”

cdo griddes 你的文件名称.nc > mygrid
sed -i "s/generic/lonlat/g" mygrid


2、使用cdo命令重新设置网格

cdo setgrid,mygrid 你的文件名.nc 输出文件名.nc


最后进行结果检验:


3a2c574668c346a18cd8944b0df7c9a6.png

7ecc4170c4434f348c59068878aef844.png

成功了!!!插值也轻易完成啦~~希望对大家有帮助!!!


1f225e6020b34e609f0a259097dc29a5.png

                    一个努力学习python的海洋
                            水平有限,欢迎指正!!!
                              欢迎评论、收藏、点赞、转发、关注。
                              关注我不后悔,记录学习进步的过程~~
相关文章
|
9月前
|
机器学习/深度学习
GEE土地分类——Property ‘B1‘ of feature ‘LE07_066018_20220603‘ is missing.错误
GEE土地分类——Property ‘B1‘ of feature ‘LE07_066018_20220603‘ is missing.错误
113 0
|
9月前
|
Python
GEE—关于RSEI生态遥感指数中出现的问题 Layer error: Image.rename: The number of names (1) must match the number of..
GEE—关于RSEI生态遥感指数中出现的问题 Layer error: Image.rename: The number of names (1) must match the number of..
244 0
|
9月前
|
数据库
Greenplum【异常 03】COPY命令报错 > ERROR: invalid input syntax for type double precision: ““(问题分析及解决方案)数据去重
Greenplum【异常 03】COPY命令报错 > ERROR: invalid input syntax for type double precision: ““(问题分析及解决方案)数据去重
264 0
|
JavaScript 安全 开发者
重新认识number类型
重新认识number类型
237 0
cdo 合并nc文件时,报错:Error(cdf_put_vara_double):NetCDF:Numeric conversion not representable
cdo 合并nc文件时,报错:Error(cdf_put_vara_double):NetCDF:Numeric conversion not representable
SAP WM初阶Storage Type上的SUM Indicator参数修改
SAP WM初阶Storage Type上的SUM Indicator参数修改
SAP WM初阶Storage Type上的SUM Indicator参数修改
SAP WM中阶LT06对物料做上架报错 -Definition of totals level is missing for storage type 004 -
SAP WM中阶LT06对物料做上架报错 -Definition of totals level is missing for storage type 004 -
SAP WM中阶LT06对物料做上架报错 -Definition of totals level is missing for storage type 004 -
SAP WM中阶存储类型里的Full stk rmvl 字段和Return Storage type字段
SAP WM中阶存储类型里的Full stk rmvl 字段和Return Storage type字段
SAP WM中阶存储类型里的Full stk rmvl 字段和Return Storage type字段
SAP WM中阶之存储类型设置界面里的’Return Stock To Same Storage Bin’
SAP WM中阶之存储类型设置界面里的’Return Stock To Same Storage Bin’
SAP WM中阶之存储类型设置界面里的’Return Stock To Same Storage Bin’