mirror of https://github.com/ecmwf/eccodes.git
Testing: Add test for accessor g1day_of_the_year_date
This commit is contained in:
parent
6132e9d8de
commit
d41b90070d
|
@ -142,7 +142,6 @@ static void init(grib_accessor* a, const long l, grib_arguments* c)
|
||||||
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
a->flags |= GRIB_ACCESSOR_FLAG_READ_ONLY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void dump(grib_accessor* a, grib_dumper* dumper)
|
static void dump(grib_accessor* a, grib_dumper* dumper)
|
||||||
{
|
{
|
||||||
grib_dump_string(dumper, a, NULL);
|
grib_dump_string(dumper, a, NULL);
|
||||||
|
@ -153,7 +152,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
/* special clim case where each mont have 30 days.. to comply with mars*/
|
/* special clim case where each mont have 30 days.. to comply with mars*/
|
||||||
grib_accessor_g1day_of_the_year_date* self = (grib_accessor_g1day_of_the_year_date*)a;
|
grib_accessor_g1day_of_the_year_date* self = (grib_accessor_g1day_of_the_year_date*)a;
|
||||||
|
|
||||||
|
|
||||||
char tmp[1024];
|
char tmp[1024];
|
||||||
|
|
||||||
long year = 0;
|
long year = 0;
|
||||||
|
@ -164,7 +162,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
long fullyear = 0;
|
long fullyear = 0;
|
||||||
long fake_day_of_year = 0;
|
long fake_day_of_year = 0;
|
||||||
|
|
||||||
|
|
||||||
size_t l;
|
size_t l;
|
||||||
|
|
||||||
grib_get_long_internal(grib_handle_of_accessor(a), self->century, ¢ury);
|
grib_get_long_internal(grib_handle_of_accessor(a), self->century, ¢ury);
|
||||||
|
@ -175,7 +172,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
if (*len < 1)
|
if (*len < 1)
|
||||||
return GRIB_BUFFER_TOO_SMALL;
|
return GRIB_BUFFER_TOO_SMALL;
|
||||||
|
|
||||||
|
|
||||||
fullyear = ((century - 1) * 100 + year);
|
fullyear = ((century - 1) * 100 + year);
|
||||||
fake_day_of_year = ((month - 1) * 30) + day;
|
fake_day_of_year = ((month - 1) * 30) + day;
|
||||||
sprintf(tmp, "%04ld-%03ld", fullyear, fake_day_of_year);
|
sprintf(tmp, "%04ld-%03ld", fullyear, fake_day_of_year);
|
||||||
|
@ -189,6 +185,5 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
|
||||||
*len = l;
|
*len = l;
|
||||||
strcpy(val, tmp);
|
strcpy(val, tmp);
|
||||||
|
|
||||||
|
|
||||||
return GRIB_SUCCESS;
|
return GRIB_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,6 +105,7 @@ if( HAVE_BUILD_TOOLS )
|
||||||
grib_grid_lambert_conformal
|
grib_grid_lambert_conformal
|
||||||
grib_grid_polar_stereographic
|
grib_grid_polar_stereographic
|
||||||
grib_g1monthlydate
|
grib_g1monthlydate
|
||||||
|
grib_g1day_of_the_year_date
|
||||||
grib_g1fcperiod)
|
grib_g1fcperiod)
|
||||||
|
|
||||||
# These tests do require data downloads
|
# These tests do require data downloads
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# (C) Copyright 2005- 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
. ./include.sh
|
||||||
|
|
||||||
|
label="grib_g1day_of_the_year_date"
|
||||||
|
sample_g1=$ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||||
|
temp=temp.$label.grib
|
||||||
|
|
||||||
|
${tools_dir}/grib_set -s marsType=s3,marsStream=mpic $sample_g1 $temp
|
||||||
|
grib_check_key_equals $temp "mars.date:s,dayOfTheYearDate:s" "2006-076 2006-076"
|
||||||
|
|
||||||
|
${tools_dir}/grib_set -s marsType=s3,marsStream=ukmo $sample_g1 $temp
|
||||||
|
grib_check_key_equals $temp "mars.date:s,dayOfTheYearDate:s" "2006-076 2006-076"
|
||||||
|
|
||||||
|
|
||||||
|
# Clean up
|
||||||
|
rm -f $temp
|
Loading…
Reference in New Issue