Я использую Eccodes API для преобразования файлов GRIB2.Когда я использую C ++ API для извлечения всех paramId
и shortName
, компонент 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=%ld\n",(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=%ld\n",(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
Может ли кто-нибудь помочь мне выяснить это?
Я могу предоставить свои данные, если они нужны или полезны.Спасибо.