ECC-1038: grib_util_set_spec: Add support for unstructured grids (GRIB2)

This commit is contained in:
Shahram Najm 2019-12-06 11:19:17 +00:00
parent cabbc031fb
commit a142baacd6
3 changed files with 15 additions and 3 deletions

View File

@ -1237,7 +1237,7 @@ int codes_points_get_values(codes_handle* h, codes_points* points, double* val);
#define CODES_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC GRIB_UTIL_GRID_SPEC_POLAR_STEREOGRAPHIC
#define CODES_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA
#define CODES_UTIL_GRID_SPEC_LAMBERT_CONFORMAL GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL
#define CODES_UTIL_GRID_SPEC_UNSTRUCTURED GRIB_UTIL_GRID_SPEC_UNSTRUCTURED
#define CODES_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX GRIB_UTIL_PACKING_TYPE_SPECTRAL_COMPLEX
#define CODES_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE GRIB_UTIL_PACKING_TYPE_SPECTRAL_SIMPLE

View File

@ -1399,6 +1399,7 @@ int grib_points_get_values(grib_handle* h, grib_points* points, double* val);
#define GRIB_UTIL_GRID_SPEC_REDUCED_ROTATED_GG 9
#define GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA 10
#define GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL 11
#define GRIB_UTIL_GRID_SPEC_UNSTRUCTURED 12
typedef struct grib_util_grid_spec {

View File

@ -749,6 +749,9 @@ static const char* get_grid_type_name(const int spec_grid_type)
if (spec_grid_type == GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL)
return "lambert";
if (spec_grid_type == GRIB_UTIL_GRID_SPEC_UNSTRUCTURED)
return "unstructured_grid";
return NULL;
}
@ -1067,10 +1070,11 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
}
break;
case GRIB_UTIL_GRID_SPEC_LAMBERT_AZIMUTHAL_EQUAL_AREA:
case GRIB_UTIL_GRID_SPEC_UNSTRUCTURED:
if (editionNumber==1) { /* This grid type is not available in edition 1 */
if (h->context->debug==-1)
fprintf(stderr,"ECCODES DEBUG grib_util: lambert_azimuthal_equal_area specified "
"but input is GRIB1. Output must be a higher edition!\n");
fprintf(stderr,"ECCODES DEBUG grib_util: '%s' specified "
"but input is GRIB1. Output must be a higher edition!\n", grid_type);
convertEditionEarlier=1;
}
sprintf(name, "GRIB%ld", editionNumber);
@ -1217,6 +1221,13 @@ grib_handle* grib_util_set_spec2(grib_handle* h,
COPY_SPEC_LONG(centralLongitudeInMicrodegrees);
*/
break;
case GRIB_UTIL_GRID_SPEC_UNSTRUCTURED:
COPY_SPEC_LONG (bitmapPresent);
if (spec->missingValue) COPY_SPEC_DOUBLE(missingValue);
/*
* TODO: Other keys
*/
break;
case GRIB_UTIL_GRID_SPEC_LAMBERT_CONFORMAL:
COPY_SPEC_LONG (bitmapPresent);