mirror of https://github.com/ecmwf/eccodes.git
Merge branch 'develop' of ssh://software.ecmwf.int:7999/eccodes/eccodes into develop
This commit is contained in:
commit
53de0863c4
|
@ -100,23 +100,23 @@ int main(int argc,char* argv[])
|
|||
* read so we will use the # (occurrence) operator accordingly. */
|
||||
|
||||
/* Cloud amount (low and middleclouds) */
|
||||
CODES_CHECK(codes_get_long(h,"cloudAmount#1",&longVal),0);
|
||||
CODES_CHECK(codes_get_long(h,"#1#cloudAmount",&longVal),0);
|
||||
printf(" cloudAmount (low and middle): %ld\n",longVal);
|
||||
|
||||
/* Height of cloud base */
|
||||
CODES_CHECK(codes_get_long(h,"heightOfBaseOfCloud#1",&longVal),0);
|
||||
CODES_CHECK(codes_get_long(h,"#1#heightOfBaseOfCloud",&longVal),0);
|
||||
printf(" heightOfBaseOfCloud: %ld\n",longVal);
|
||||
|
||||
/* Cloud type (low clouds) */
|
||||
CODES_CHECK(codes_get_long(h,"cloudType#1",&longVal),0);
|
||||
CODES_CHECK(codes_get_long(h,"#1#cloudType",&longVal),0);
|
||||
printf(" cloudType (low): %ld\n",longVal);
|
||||
|
||||
/* Cloud type (middle clouds) */
|
||||
CODES_CHECK(codes_get_long(h,"cloudType#2",&longVal),0);
|
||||
CODES_CHECK(codes_get_long(h,"#2#cloudType",&longVal),0);
|
||||
printf(" cloudType (middle): %ld\n",longVal);
|
||||
|
||||
/* Cloud type (high clouds) */
|
||||
CODES_CHECK(codes_get_long(h,"cloudType#3",&longVal),0);
|
||||
CODES_CHECK(codes_get_long(h,"#3#cloudType",&longVal),0);
|
||||
printf(" cloudType (high): %ld\n",longVal);
|
||||
|
||||
/* delete handle */
|
||||
|
|
|
@ -85,23 +85,23 @@ integer(kind=4) :: cloudAmount,cloudBaseHeight,lowCloud,midCloud,highCloud
|
|||
! read so we will use the # (occurrence) operator accordingly.
|
||||
|
||||
! Cloud amount (low and middleclouds)
|
||||
call codes_get(ibufr,'cloudAmount#1',cloudAmount)
|
||||
call codes_get(ibufr,'#1#cloudAmount',cloudAmount)
|
||||
write(*,*) ' cloudAmount (low and middle):',cloudAmount
|
||||
|
||||
! Height of cloud base
|
||||
call codes_get(ibufr,'heightOfBaseOfCloud#1',cloudBaseHeight)
|
||||
call codes_get(ibufr,'#1#heightOfBaseOfCloud',cloudBaseHeight)
|
||||
write(*,*) ' heightOfBaseOfCloud:',cloudBaseHeight
|
||||
|
||||
! Cloud type (low clouds)
|
||||
call codes_get(ibufr,'cloudType#1',lowCloud)
|
||||
call codes_get(ibufr,'#1#cloudType',lowCloud)
|
||||
write(*,*) ' cloudType (low):',lowCloud
|
||||
|
||||
! Cloud type (middle clouds)
|
||||
call codes_get(ibufr,'cloudType#2',midCloud)
|
||||
call codes_get(ibufr,'#2#cloudType',midCloud)
|
||||
write(*,*) ' cloudType (middle):',midCloud
|
||||
|
||||
! Cloud type (high clouds)
|
||||
call codes_get(ibufr,'cloudType#3',highCloud)
|
||||
call codes_get(ibufr,'#3#cloudType',highCloud)
|
||||
write(*,*) ' cloudType (high):',highCloud
|
||||
|
||||
! release the bufr message
|
||||
|
|
|
@ -41,11 +41,11 @@ def example():
|
|||
'dewpointTemperatureAt2M',
|
||||
'windSpeedAt10M',
|
||||
'windDirectionAt10M',
|
||||
'cloudAmount#1', #cloud amount (low and mid level)
|
||||
'heightOfBaseOfCloud#1',
|
||||
'cloudType#1', #cloud type (low clouds)
|
||||
'cloudType#2', #cloud type (middle clouds)
|
||||
'cloudType#3' #cloud type (highclouds)
|
||||
'#1#cloudAmount', #cloud amount (low and mid level)
|
||||
'#1#heightOfBaseOfCloud',
|
||||
'#1#cloudType', #cloud type (low clouds)
|
||||
'#2#cloudType', #cloud type (middle clouds)
|
||||
'#3#cloudType' #cloud type (highclouds)
|
||||
]
|
||||
|
||||
# The cloud information is stored in several blocks in the
|
||||
|
|
|
@ -1092,7 +1092,7 @@ int grib_keys_iterator_get_native_type(grib_keys_iterator *kiter);
|
|||
|
||||
/* grib_parse_utils.c */
|
||||
int grib_recompose_name(grib_handle *h, grib_accessor *observer, const char *uname, char *fname, int fail);
|
||||
int grib_accessor_print(grib_accessor *a, int has_rank, const char *name, int type, const char *format, const char *separator, int maxcols, int *newline, FILE *out);
|
||||
int grib_accessor_print(grib_accessor *a, const char *name, int type, const char *format, const char *separator, int maxcols, int *newline, FILE *out);
|
||||
int grib_accessors_list_print(grib_accessors_list *al, const char *name, int type, const char *format, const char *separator, int maxcols, int *newline, FILE *out);
|
||||
int grib_recompose_print(grib_handle *h, grib_accessor *observer, const char *uname, int fail, FILE *out);
|
||||
grib_action_file *grib_find_action_file(const char *fname, grib_action_file_list *afl);
|
||||
|
@ -1110,7 +1110,6 @@ int grib_type_to_int(char id);
|
|||
char *get_rank(const char *name, long *rank);
|
||||
char *get_condition(const char *name, codes_condition *condition);
|
||||
grib_accessors_list *grib_find_accessors_list(grib_handle *h, const char *name);
|
||||
int has_rank(const char *name);
|
||||
char *grib_split_name_attribute(grib_context *c, const char *name, char *attribute_name);
|
||||
grib_accessor *grib_find_accessor(grib_handle *h, const char *name);
|
||||
grib_accessor *grib_find_attribute(grib_handle *h, const char *name, const char *attr_name, int *err);
|
||||
|
|
|
@ -141,7 +141,7 @@ int grib_recompose_name(grib_handle* h, grib_accessor *observer, const char* una
|
|||
return GRIB_SUCCESS;
|
||||
}
|
||||
|
||||
int grib_accessor_print(grib_accessor* a,int has_rank,const char* name,int type,const char* format,const char* separator,int maxcols,int* newline,FILE* out)
|
||||
int grib_accessor_print(grib_accessor* a,const char* name,int type,const char* format,const char* separator,int maxcols,int* newline,FILE* out)
|
||||
{
|
||||
size_t size=0;
|
||||
char val[1024] = {0,};
|
||||
|
@ -169,7 +169,7 @@ int grib_accessor_print(grib_accessor* a,int has_rank,const char* name,int type,
|
|||
case GRIB_TYPE_DOUBLE:
|
||||
myformat= format ? (char*)format : double_format;
|
||||
myseparator= separator ? (char*)separator : default_separator;
|
||||
if (name[0]=='/' || has_rank!=0) {
|
||||
if (name[0]=='/' || name[0]=='#') {
|
||||
long count;
|
||||
ret=grib_value_count(a,&count);
|
||||
size=count;
|
||||
|
@ -177,7 +177,7 @@ int grib_accessor_print(grib_accessor* a,int has_rank,const char* name,int type,
|
|||
ret=_grib_get_size(h,a,&size);
|
||||
}
|
||||
dval=(double*)grib_context_malloc_clear(h->context,sizeof(double)*size);
|
||||
if (name[0]=='/' || has_rank!=0) {
|
||||
if (name[0]=='/' || name[0]=='#') {
|
||||
replen=size;
|
||||
ret=grib_unpack_double(a,dval,&replen);
|
||||
} else {
|
||||
|
@ -205,7 +205,7 @@ int grib_accessor_print(grib_accessor* a,int has_rank,const char* name,int type,
|
|||
case GRIB_TYPE_LONG:
|
||||
myformat= format ? (char*)format : long_format;
|
||||
myseparator= separator ? (char*)separator : default_separator;
|
||||
if (name[0]=='/' || has_rank!=0) {
|
||||
if (name[0]=='/' || name[0]=='#') {
|
||||
long count;
|
||||
ret=grib_value_count(a,&count);
|
||||
size=count;
|
||||
|
@ -213,7 +213,7 @@ int grib_accessor_print(grib_accessor* a,int has_rank,const char* name,int type,
|
|||
ret=_grib_get_size(h,a,&size);
|
||||
}
|
||||
lval=(long*)grib_context_malloc_clear(h->context,sizeof(long)*size);
|
||||
if (name[0]=='/' || has_rank!=0) {
|
||||
if (name[0]=='/' || name[0]=='#') {
|
||||
replen=size;
|
||||
ret=grib_unpack_long(a,lval,&replen);
|
||||
} else {
|
||||
|
|
|
@ -140,20 +140,17 @@ char* get_rank(const char* name,long *rank) {
|
|||
char* p=(char*)name;
|
||||
char* end=p;
|
||||
char* ret=NULL;
|
||||
size_t len;
|
||||
|
||||
*rank=-1;
|
||||
while (*p!=0 && *p!='#') p++;
|
||||
|
||||
if (*p=='#') {
|
||||
*rank=strtol(++p,&end,10);
|
||||
if ( *end != 0) {
|
||||
if ( *end != '#') {
|
||||
*rank=-1;
|
||||
} else {
|
||||
grib_context* c=grib_context_get_default();
|
||||
len=p-name;
|
||||
ret=(char*)grib_context_malloc_clear(c,len);
|
||||
memcpy(ret,name,len-1);
|
||||
end++;
|
||||
ret=grib_context_strdup(c,end);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
@ -324,7 +321,7 @@ grib_accessors_list* grib_find_accessors_list(grib_handle* h,const char* name) {
|
|||
if (condition->rightString) grib_context_free(h->context,condition->rightString);
|
||||
}
|
||||
grib_context_free(h->context,condition);
|
||||
} else if (has_rank(name)) {
|
||||
} else if (name[0]=='#') {
|
||||
a=grib_find_accessor(h, name);
|
||||
if (a) {
|
||||
al=(grib_accessors_list*)grib_context_malloc_clear(h->context,sizeof(grib_accessors_list));
|
||||
|
@ -347,10 +344,10 @@ static grib_accessor* search_and_cache(grib_handle* h, const char* name,const ch
|
|||
grib_accessor* a=NULL;
|
||||
long rank;
|
||||
|
||||
str=get_rank(name,&rank);
|
||||
if (rank>0) {
|
||||
a=search_by_rank(h,str,the_namespace,rank);
|
||||
grib_context_free(h->context,str);
|
||||
if (name[0]=='#') {
|
||||
str=get_rank(name,&rank);
|
||||
a=search_by_rank(h,str,the_namespace,rank);
|
||||
grib_context_free(h->context,str);
|
||||
} else {
|
||||
a=_search_and_cache(h,name,the_namespace);
|
||||
}
|
||||
|
@ -391,12 +388,6 @@ static grib_accessor* _grib_find_accessor(grib_handle* h, const char* name)
|
|||
return a;
|
||||
}
|
||||
|
||||
int has_rank(const char* name) {
|
||||
char* p=(char*)name;
|
||||
while (*p!=0 && *p!='#') p++;
|
||||
return *p ? 1 : 0 ;
|
||||
}
|
||||
|
||||
char* grib_split_name_attribute(grib_context* c,const char* name,char* attribute_name) {
|
||||
/*returns accessor name and attribute*/
|
||||
char* p=0;
|
||||
|
|
|
@ -576,7 +576,7 @@ static int _grib_set_double_array(grib_handle* h, const char* name,
|
|||
int err=0;
|
||||
|
||||
if (!a) return GRIB_NOT_FOUND ;
|
||||
if (name[0]=='/' || has_rank(name)) {
|
||||
if (name[0]=='/' || name[0]=='#' ) {
|
||||
if(check && (a->flags & GRIB_ACCESSOR_FLAG_READ_ONLY))
|
||||
return GRIB_READ_ONLY;
|
||||
err=grib_pack_double(a, val, &length);
|
||||
|
@ -1001,7 +1001,7 @@ int grib_get_double_array(grib_handle* h, const char* name, double* val, size_t
|
|||
} else {
|
||||
a=grib_find_accessor(h, name);
|
||||
if(!a) return GRIB_NOT_FOUND;
|
||||
if (has_rank(name)) {
|
||||
if (name[0] == '#') {
|
||||
return grib_unpack_double(a, val , length);
|
||||
} else {
|
||||
*length = 0;
|
||||
|
@ -1070,7 +1070,7 @@ int grib_get_size(grib_handle* h, const char* name,size_t* size)
|
|||
} else {
|
||||
a=grib_find_accessor(h, name);
|
||||
if(!a) return GRIB_NOT_FOUND;
|
||||
if (has_rank(name)) {
|
||||
if (name[0]=='#') {
|
||||
int ret;
|
||||
long count=*size;
|
||||
ret=grib_value_count(a,&count);
|
||||
|
@ -1144,7 +1144,7 @@ int grib_get_string_array(grib_handle* h, const char* name, char** val, size_t *
|
|||
} else {
|
||||
a=grib_find_accessor(h, name);
|
||||
if(!a) return GRIB_NOT_FOUND;
|
||||
if (has_rank(name)) {
|
||||
if (name[0]=='#') {
|
||||
return grib_unpack_string_array(a, val , length);
|
||||
} else {
|
||||
*length = 0;
|
||||
|
@ -1200,7 +1200,7 @@ int grib_get_long_array(grib_handle* h, const char* name, long* val, size_t *len
|
|||
} else {
|
||||
a=grib_find_accessor(h, name);
|
||||
if(!a) return GRIB_NOT_FOUND;
|
||||
if (has_rank(name)) {
|
||||
if (name[0]=='#') {
|
||||
return grib_unpack_long(a, val , length);
|
||||
} else {
|
||||
*length = 0;
|
||||
|
|
|
@ -161,7 +161,7 @@ rm -f ${f}.ref ${f}.log
|
|||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "pressure=[pressure#4] [pressure#4->units]";
|
||||
print "pressure=[#4#pressure] [#4#pressure->units]";
|
||||
print "pressure=[pressure]";
|
||||
EOF
|
||||
|
||||
|
@ -194,9 +194,9 @@ rm -f ${f}.ref ${f}.log
|
|||
#-----------------------------------------------------------
|
||||
cat > $fRules <<EOF
|
||||
set unpack=1;
|
||||
print "brightnessTemperature={[brightnessTemperature#2!',']}";
|
||||
print "brightnessTemperature->percentConfidence={[brightnessTemperature#2->percentConfidence!',']}";
|
||||
print "brightnessTemperature->firstOrderStatisticalValue={[brightnessTemperature#2->firstOrderStatisticalValue!',']}";
|
||||
print "brightnessTemperature={[#2#brightnessTemperature!',']}";
|
||||
print "brightnessTemperature->percentConfidence={[#2#brightnessTemperature->percentConfidence!',']}";
|
||||
print "brightnessTemperature->firstOrderStatisticalValue={[#2#brightnessTemperature->firstOrderStatisticalValue!',']}";
|
||||
EOF
|
||||
|
||||
f="b005_89.bufr"
|
||||
|
|
Loading…
Reference in New Issue