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
94a7d6b73a
|
@ -87,12 +87,13 @@ int grib_recompose_name(grib_handle* h, grib_accessor *observer, const char* una
|
|||
long lval=0;
|
||||
int type=GRIB_TYPE_STRING;
|
||||
size_t replen = 0;
|
||||
/* const size_t uname_len = strlen(uname); */
|
||||
char* ptrEnd_fname = NULL; /* Maintain ptr to end of fname string */
|
||||
|
||||
loc[0] = 0 ;
|
||||
fname[0] = 0 ;
|
||||
/* for(i=0; i<uname_len; i++) */
|
||||
i=0;
|
||||
ptrEnd_fname = fname;
|
||||
|
||||
/* uname is a string like "grib[GRIBEditionNumber:l]/boot.def". The result fname will be grib2/boot.def */
|
||||
while (uname[i]!='\0')
|
||||
{
|
||||
if(mode > -1)
|
||||
|
@ -145,11 +146,10 @@ int grib_recompose_name(grib_handle* h, grib_accessor *observer, const char* una
|
|||
char* pc=fname;
|
||||
while (*pc != '\0') pc++;
|
||||
strcpy(pc,val);
|
||||
ptrEnd_fname = pc + strlen(val); /* Update ptr to end of fname */
|
||||
}
|
||||
/* sprintf(fname,"%s%s",fname,val); */
|
||||
|
||||
loc[0] = 0 ;
|
||||
|
||||
}
|
||||
else
|
||||
loc[mode++]=uname[i];
|
||||
|
@ -157,10 +157,15 @@ int grib_recompose_name(grib_handle* h, grib_accessor *observer, const char* una
|
|||
else if(uname[i]=='[')
|
||||
mode = 0;
|
||||
else {
|
||||
int llen=strlen(fname);
|
||||
#if 0
|
||||
int llen=strlen(fname); // The strlen cost is too high
|
||||
fname[llen]=uname[i];
|
||||
fname[llen+1]='\0';
|
||||
/* sprintf(fname,"%s%c",fname, uname[i]); */
|
||||
#else
|
||||
/* Performance: faster to avoid call to strlen. Append to end */
|
||||
*ptrEnd_fname++ = uname[i];
|
||||
*ptrEnd_fname = '\0';
|
||||
#endif
|
||||
type=GRIB_TYPE_STRING;
|
||||
}
|
||||
i++;
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
REDIRECT=/dev/null
|
||||
|
||||
temp=temp.grib2to3.grib3
|
||||
label="grib2to3"
|
||||
temp=temp.$label.grib3
|
||||
sample_g2=$ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_set -s editionNumber=3 $sample_g2 $temp
|
||||
${tools_dir}/grib_dump -O -M $temp
|
||||
|
@ -39,7 +40,7 @@ files="constant_field\
|
|||
for f in $files
|
||||
do
|
||||
file=${data_dir}/$f
|
||||
output=${file}.grib3_
|
||||
output=${file}.temp.$label.grib3_
|
||||
rm -f ${output}
|
||||
${tools_dir}/grib_set -s editionNumber=3 ${file}.grib1 ${output}
|
||||
|
||||
|
|
|
@ -11,7 +11,8 @@
|
|||
|
||||
REDIRECT=/dev/null
|
||||
|
||||
temp=temp.grib1to3.grib3
|
||||
label="grib1to3"
|
||||
temp=temp.$label.grib3
|
||||
sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||
${tools_dir}/grib_set -s editionNumber=3 $sample_g1 $temp
|
||||
${tools_dir}/grib_dump -O -M $temp
|
||||
|
@ -38,7 +39,7 @@ files="constant_field\
|
|||
for f in $files
|
||||
do
|
||||
file=${data_dir}/$f
|
||||
output=${file}.grib3_
|
||||
output=${file}.temp.$label.grib3_
|
||||
rm -f ${output}
|
||||
${tools_dir}/grib_set -s editionNumber=3 ${file}.grib2 ${output}
|
||||
|
||||
|
|
Loading…
Reference in New Issue