From 240e641fa3ebea74ae84cac059785b247d25e4ef Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Thu, 5 Sep 2019 11:48:44 +0100 Subject: [PATCH] ECC-886: changes reverted. No longer needed --- tools/grib_to_netcdf.c | 57 +++++++++++------------------------------- 1 file changed, 15 insertions(+), 42 deletions(-) diff --git a/tools/grib_to_netcdf.c b/tools/grib_to_netcdf.c index 8a3d14f7e..634492eb7 100644 --- a/tools/grib_to_netcdf.c +++ b/tools/grib_to_netcdf.c @@ -1834,10 +1834,12 @@ typedef struct filter { boolean scale; } dataset_t; -typedef struct ncfile { - dataset_t *filters; - int ncid; -} ncfile_t; +/* + * typedef struct ncfile { + * dataset_t *filters; + * int ncid; + * } ncfile_t; +*/ typedef struct ncoptions { boolean usevalidtime; /* Whether to use valid TIME only or not */ @@ -2183,29 +2185,13 @@ static int check_grid(field *f) if (strcmp(grid_type, "regular_ll") != 0 && (strcmp(grid_type, "regular_gg") != 0)) { - if(strcmp(grid_type,"lambert_azimuthal_equal_area")==0) { - fprintf(stderr, "grib_to_netcdf: WARNING: Support for gridType of lambert_azimuthal_equal_area is currently experimental.\n"); - } else { - grib_context_log(ctx, GRIB_LOG_ERROR, "Grid type = %s", grid_type); - grib_context_log(ctx, GRIB_LOG_ERROR, "First GRIB is not on a regular lat/lon grid or on a regular Gaussian grid. Exiting.\n"); - return GRIB_GEOCALCULUS_PROBLEM; - } + grib_context_log(ctx, GRIB_LOG_ERROR, "Grid type = %s", grid_type); + grib_context_log(ctx, GRIB_LOG_ERROR, "First GRIB is not on a regular lat/lon grid or on a regular Gaussian grid. Exiting.\n"); + return GRIB_GEOCALCULUS_PROBLEM; } return e; } -static int grid_is_lambert_azimuthal(grib_handle* h) -{ - char grid_type[80]; - size_t size = sizeof(grid_type); - if (grib_get_string(h, "typeOfGrid", grid_type, &size) == GRIB_SUCCESS && - strcmp(grid_type, "lambert_azimuthal_equal_area")==0) - { - return 1; - } - return 0; -} - static int get_num_latitudes_longitudes(grib_handle* h, size_t* nlats, size_t* nlons) { err e=0; @@ -2213,9 +2199,9 @@ static int get_num_latitudes_longitudes(grib_handle* h, size_t* nlats, size_t* n size_t size = sizeof(grid_type); if (grib_get_string(h, "typeOfGrid", grid_type, &size) == GRIB_SUCCESS && - (strcmp(grid_type, "regular_ll")==0 || strcmp(grid_type, "lambert_azimuthal_equal_area")==0)) + strcmp(grid_type, "regular_ll") == 0) { - /* Special shortcut for regular lat/on and lambert azimuthal grids */ + /* Special shortcut for regular lat/on grids */ long n; Assert( !grib_is_missing(h, "Ni", &e) ); if ((e = grib_get_long(h, "Ni", &n)) != GRIB_SUCCESS) { @@ -2323,22 +2309,9 @@ static int put_latlon(int ncid, fieldset *fs) } #endif - if (grid_is_lambert_azimuthal(g->handle)) { - /* ECC-886: For Lambert we need the actual number of distinct lat/lons which will be higher than Ni/Nj */ - if((e = grib_get_size(g->handle, "distinctLatitudes", &nj)) != GRIB_SUCCESS) { - grib_context_log(ctx, GRIB_LOG_ERROR, "ecCodes: cannot get distinctLatitudes: %s", grib_get_error_message(e)); - return e; - } - if((e = grib_get_size(g->handle, "distinctLongitudes", &ni)) != GRIB_SUCCESS) { - grib_context_log(ctx, GRIB_LOG_ERROR, "ecCodes: cannot get distinctLongitudes: %s", grib_get_error_message(e)); - return e; - } - } - else { - if((e = get_num_latitudes_longitudes(g->handle, &nj, &ni)) != GRIB_SUCCESS) { - grib_context_log(ctx, GRIB_LOG_ERROR, "ecCodes: put_latlon: cannot get distinctLatitudes: %s", grib_get_error_message(e)); - return e; - } + if((e = get_num_latitudes_longitudes(g->handle, &nj, &ni)) != GRIB_SUCCESS) { + grib_context_log(ctx, GRIB_LOG_ERROR, "ecCodes: put_latlon: cannot get distinctLatitudes: %s", grib_get_error_message(e)); + return e; } /* Compute max. # values and allocate */ @@ -4503,7 +4476,7 @@ int grib_no_handle_action(grib_runtime_options* options, int err) int main(int argc, char** argv) { printf("\n"); - printf("grib_to_netcdf:\n"); + printf("%s:\n", grib_tool_name); printf("\n"); printf(" ecCodes was not compiled with NETCDF enabled\n"); printf("\n");