ECC-1552: Alternative implementation using WGS84

This commit is contained in:
Shahram Najm 2023-03-28 15:25:54 +00:00
parent ee3f3500f7
commit c60c79fbcd
2 changed files with 23 additions and 21 deletions

View File

@ -294,19 +294,20 @@ static int proj_polar_stereographic(grib_handle* h, char* result)
return err;
}
#if 0
// ECC-1552: This is for regular_ll, regular_gg, reduced_ll, reduced_gg
static int proj_unprojected(grib_handle* h, char* result)
{
int err = 0;
char shape[64] = {0,};
if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
return err;
//char shape[64] = {0,};
//if ((err = get_earth_shape(h, shape)) != GRIB_SUCCESS)
// return err;
//snprintf(result, 1024, "+proj=longlat %s", shape);
snprintf(result, 1024, "+proj=longlat +datum=WGS84 +no_defs +type=crs");
snprintf(result, 1024, "+proj=longlat %s", shape);
return err;
}
#endif
static int proj_mercator(grib_handle* h, char* result)
{
@ -325,10 +326,10 @@ static int proj_mercator(grib_handle* h, char* result)
#define NUMBER(a) (sizeof(a) / sizeof(a[0]))
static proj_mapping proj_mappings[] = {
// { "regular_ll", &proj_unprojected },
// { "regular_gg", &proj_unprojected },
// { "reduced_ll", &proj_unprojected },
// { "reduced_gg", &proj_unprojected },
{ "regular_ll", &proj_unprojected },
{ "regular_gg", &proj_unprojected },
{ "reduced_ll", &proj_unprojected },
{ "reduced_gg", &proj_unprojected },
{ "mercator", &proj_mercator },
{ "lambert", &proj_lambert_conformal },

View File

@ -47,24 +47,25 @@ done
# Various grid types
# ECC-1552: To be done later. Current behaviour is to return KeyNotFound
set +e
${tools_dir}/grib_get -p projString $grib2_sample > $tempText 2>&1
status=$?
set -e
[ $status -ne 0 ]
grep -q "Key/value not found" $tempText
# set +e
# ${tools_dir}/grib_get -p projString $grib2_sample > $tempText 2>&1
# status=$?
# set -e
# [ $status -ne 0 ]
# grep -q "Key/value not found" $tempText
rm -f $tempText
# ${tools_dir}/grib_get -p projString $grib2_sample > $tempText
# grep -q "proj=longlat +R=6367470" $tempText
${tools_dir}/grib_get -p projString $grib2_sample > $tempText
grep -q "+proj=longlat +datum=WGS84" $tempText
${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl > $tempText
grep -q "+proj=longlat +datum=WGS84" $tempText
# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/regular_ll_pl_grib2.tmpl > $tempText
# grep -q "proj=longlat +R=6371229" $tempText
# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/regular_gg_ml_grib1.tmpl > $tempText
# grep -q "proj=longlat +R=6367470" $tempText
# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/reduced_ll_sfc_grib1.tmpl > $tempText
# grep -q "proj=longlat +R=6367470" $tempText
# ${tools_dir}/grib_get -p projString $ECCODES_SAMPLES_PATH/reduced_gg_pl_32_grib2.tmpl > $tempText
# grep -q "proj=longlat +R=6371229" $tempText
${tools_dir}/grib_set -s gridType=lambert_azimuthal_equal_area $grib2_sample $tempGrib