使用不同的工具时,Eccodes 会产生不同的结果
Eccodes generates different results when using different tools
我正在使用 Eccodes API 来转换 GRIB2 文件。当我使用 C++ API 提取所有paramId
和shortName
时,查询结果中不存在 wind 的 V 分量(paramId 为 132,shortName 为 v(,如下所示:
ids=73
0 31 43 54 59 130 131 133 134 135 156 157 165 167 168 172 173 3020 3024 3041 3045 3046 3054 3063 3066 3086 228001 228002 228139 228164 228228 260002 260003 260029 260030 260031 260032 260038 260056 260065 260072 260073 260074 260083 260087 260088 260097 260098 260125 260127 260128 260155 260180 260185 260187 260189 260190 260205 260206 260207 260208 260209 260238 260242 260256 260317 260389 260390 260391
260439 260442 260509 7001353
names=73
10u 2d 2r 2t 4lftx VRATE absv acpcp al bmixl cape cd cfrzr ci cicep cin cnwat crain csnow dlwrf dswrf fricv gh gust hindex hlcy hpbl lftx lhtfl lsm ltng mslet mstav orog pli poros pres prmsl pwat q r refc refd rlyrs sde sdwe shtfl slt smdry smref snowc soill soilw sp sr ssw st t tcc tke tp u ulwrf unknown uswrf veg vgtyp vis vucsh vvcsh w wilt wz
程序代码如下:
/*
* Copyright 2005-2017 ECMWF.
*
* This software is licensed under the terms of the Apache Licence Version 2.0
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
*
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
/*
* C Implementation: grib_index
*
* Description: How to create and use an index to access GRIB messages from a file
*
*/
#include "eccodes.h"
int main(int argc,char* argv[])
{
codes_index* index = NULL;
codes_handle* h = NULL;
int ret;
size_t size, i;
char** names;
long* ids;
index = codes_index_new_from_file(0, argv[argc - 1], "paramId,shortName", &ret);
CODES_CHECK(ret, 0);
CODES_CHECK(codes_index_get_size(index, "shortName", &size),0);
ids=(long*)malloc(sizeof(long)*size);
CODES_CHECK(codes_index_get_long(index,"paramId",ids,&size),0);
printf("ids=%ldn",(long)size);
for (i=0;i<size;i++) printf("%ld ",ids[i]);
printf("n");
CODES_CHECK(codes_index_get_size(index, "shortName", &size),0);
names=(char**)malloc(sizeof(char*)*size);
CODES_CHECK(codes_index_get_string(index,"shortName",names,&size),0);
printf("names=%ldn",(long)size);
for (i=0;i<size;i++) printf("%s ",names[i]);
printf("n");
return 0;
}
但是,如果我使用grib_ls
查询参数,它会显示:
wuh20@sapphire:~/github/test$ grib_ls -w paramId=132 -p paramId,level,shortName,name ~/Desktop/test/nam_218_20180701_0000_000.grb2
/home/graduate/wuh20/Desktop/test/nam_218_20180701_0000_000.grb2
paramId level shortName name
132 0 v V component of wind
132 50 v V component of wind
132 75 v V component of wind
132 100 v V component of wind
132 125 v V component of wind
132 150 v V component of wind
132 175 v V component of wind
132 200 v V component of wind
132 225 v V component of wind
132 250 v V component of wind
132 275 v V component of wind
132 300 v V component of wind
132 325 v V component of wind
132 350 v V component of wind
132 375 v V component of wind
132 400 v V component of wind
132 425 v V component of wind
132 450 v V component of wind
132 475 v V component of wind
132 500 v V component of wind
132 525 v V component of wind
132 550 v V component of wind
132 575 v V component of wind
132 600 v V component of wind
132 625 v V component of wind
132 650 v V component of wind
132 675 v V component of wind
132 700 v V component of wind
132 725 v V component of wind
132 750 v V component of wind
132 775 v V component of wind
132 800 v V component of wind
132 825 v V component of wind
132 850 v V component of wind
132 875 v V component of wind
132 900 v V component of wind
132 925 v V component of wind
132 950 v V component of wind
132 975 v V component of wind
132 1000 v V component of wind
132 0 v V component of wind
132 0 v V component of wind
132 80 v V component of wind
132 3000 v V component of wind
132 6000 v V component of wind
132 9000 v V component of wind
132 12000 v V component of wind
132 15000 v V component of wind
132 18000 v V component of wind
49 of 446 messages in /home/graduate/wuh20/Desktop/test/nam_218_20180701_0000_000.grb2
有人可以帮我解决这个问题吗?
如果需要或有帮助,我可以提供我的数据。谢谢。
这是一个相当隐藏但简单的问题。我必须打开多支持,该支持在所有工具中默认处于打开状态。
对于所有工具,默认为多支持打开。
参考
- 为什么"do while"循环不断退出,即使条件计算结果为 false?
- valgrind-hellgrind与泄漏检查的结果不同
- 用C++20 fmt限制结果的总大小
- 如何返回一个类的两个对象相加的结果
- 使用QProcess执行命令,并将结果存储在QStringList中
- 如果我std::dynamic_pointer_cast并且底层dynamic_cast的结果为null,那么返回的sh
- 在没有定义返回类型的函数中返回布尔值,并将结果保存在无错误的char编译中-为什么
- 序列化,没有库的整数,得到奇怪的结果
- 使用取消引用的指针的多态性会产生意外的结果.为什么?
- 在更改for循环的第三部分后,未使用for循环结果
- 使用++运算符会导致意外的结果
- 为什么在逗号分隔符上下文中将预增量的结果强制转换为void
- C++Brute Force攻击函数不会返回结果
- 你好。。。id_public变量不应该给出结果为 81 和 86 吗?为什么它为两个派生类占用不同的内存位置?
- 算术运算的结果类似于:C浮点变量中的1/3
- ";结果类型必须是可从输入范围的值类型""构造的;创建std::vector时
- 密码登录程序将永远循环并显示不正确的结果
- 如何让C++'tally up'结果并制定计划?
- 为什么这个程序的结果是3 "born"?和 4 死
- 使用不同的工具时,Eccodes 会产生不同的结果