Commit 5e8c01e5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Removed obsolete grid type GRID_LAEA.

parent 5c871957
2016-08-11 Uwe Schulzweida
* Removed obsolete grid type GRID_LAEA
* Removed obsolete grid type GRID_SINUSOIDAL
* Removed obsolete CDI grid functions gridXXXXpole(), gridXXXYpole(), gridXXXAngle() and gridIsRotated()
......
......@@ -354,13 +354,6 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
fprintf(stdout, "\n");
}
if ( gridtype == GRID_LAEA )
{
double a, lon_0, lat_0;
gridInqLaea(gridID, &a, &lon_0, &lat_0);
fprintf(stdout, "%33s : a=%g lon_0=%g lat_0=%g\n", "projpar", a, lon_0, lat_0);
}
if ( gridtype == GRID_LCC2 )
{
double a, lon_0, lat_0, lat_1, lat_2;
......
......@@ -624,8 +624,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
char gmapvarname[CDI_MAX_NAME]; gmapvarname[0] = 0;
if ( gridtype == GRID_LAEA ) strcpy(gmapvarname, "Lambert_AEA");
else if ( gridtype == GRID_LCC2 ) strcpy(gmapvarname, "Lambert_CC");
if ( gridtype == GRID_LCC2 ) strcpy(gmapvarname, "Lambert_CC");
else cdf_get_gmapvarname(gridID, gmapvarname);
if ( gmapvarname[0] ) cdf_put_att_text(fileID, ncvarid, "grid_mapping", strlen(gmapvarname), gmapvarname);
......
......@@ -138,8 +138,7 @@ extern "C" {
#define GRID_CURVILINEAR 10 /* Curvilinear grid */
#define GRID_LCC 11 /* Lambert Conformal Conic (GRIB) */
#define GRID_LCC2 12 /* Lambert Conformal Conic (PROJ) */
#define GRID_LAEA 13 /* Lambert Azimuthal Equal Area */
#define GRID_PROJECTION 14 /* Projected coordinates */
#define GRID_PROJECTION 13 /* Projected coordinates */
#define CDI_PROJ_RLL 21 /* Rotated Latitude Longitude */
#define CDI_PROJ_LCC 22 /* Lambert Conformal Conic */
......
......@@ -39,8 +39,7 @@ static const char Grids[][17] = {
/* 10 */ "curvilinear",
/* 11 */ "lcc",
/* 12 */ "lcc2",
/* 13 */ "laea",
/* 15 */ "projection",
/* 13 */ "projection",
};
/* must match table below */
......@@ -128,11 +127,6 @@ void grid_init(grid_t *gridptr)
gridptr->lcc2.a = 0.0;
gridptr->lcc2.defined = FALSE;
gridptr->laea.lon_0 = 0.0;
gridptr->laea.lat_0 = 0.0;
gridptr->laea.a = 0.0;
gridptr->laea.defined = FALSE;
gridptr->gme.nd = 0;
gridptr->gme.ni = 0;
gridptr->gme.ni2 = 0;
......@@ -314,7 +308,6 @@ void cdiGridTypeInit(grid_t *gridptr, int gridtype, int size)
case GRID_GENERIC:
case GRID_PROJECTION:
case GRID_LCC2:
case GRID_LAEA:
{
if ( gridptr->x.name[0] == 0 ) gridSetName(gridptr->x.name, "x");
if ( gridptr->y.name[0] == 0 ) gridSetName(gridptr->y.name, "y");
......@@ -2354,7 +2347,6 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
if ( g1->lcc.scanflag != g2->lcc.scanflag ) return differ;
if ( g1->lcc.defined != g2->lcc.defined ) return differ;
if ( g1->lcc2.defined != g2->lcc2.defined ) return differ;
if ( g1->laea.defined != g2->laea.defined ) return differ;
if ( g1->isCyclic != g2->isCyclic ) return differ;
if ( g1->x.flag != g2->x.flag ) return differ;
if ( g1->y.flag != g2->y.flag ) return differ;
......@@ -2390,9 +2382,6 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
if ( IS_NOT_EQUAL(g1->lcc2.lat_1 , g2->lcc2.lat_1) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc2.lat_2 , g2->lcc2.lat_2) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc2.a , g2->lcc2.a) ) return differ;
if ( IS_NOT_EQUAL(g1->laea.lon_0 , g2->laea.lon_0) ) return differ;
if ( IS_NOT_EQUAL(g1->laea.lat_0 , g2->laea.lat_0) ) return differ;
if ( IS_NOT_EQUAL(g1->laea.a , g2->laea.a) ) return differ;
const double *restrict g1_xvals = g1->vtable->inqXValsPtr(g1),
*restrict g2_xvals = g2->vtable->inqXValsPtr(g2);
......@@ -2543,7 +2532,6 @@ void gridComplete(grid_t *grid)
case GRID_GENERIC:
case GRID_LCC:
case GRID_LCC2:
case GRID_LAEA:
case GRID_PROJECTION:
{
if ( grid->x.size > 0 ) gridDefXsize(gridID, grid->x.size);
......@@ -2590,9 +2578,6 @@ void gridComplete(grid_t *grid)
switch (gridtype)
{
case GRID_LAEA:
gridDefLaea(gridID, grid->laea.a, grid->laea.lon_0, grid->laea.lat_0);
break;
case GRID_LCC2:
gridDefLcc2(gridID, grid->lcc2.a, grid->lcc2.lon_0, grid->lcc2.lat_0, grid->lcc2.lat_1, grid->lcc2.lat_2);
break;
......@@ -2706,7 +2691,7 @@ int gridGenerate(const grid_t *grid)
int valdef_group1 = 0;
static const int valdef_group1_tab[] = {
GRID_LONLAT, GRID_GAUSSIAN, GRID_UNSTRUCTURED, GRID_CURVILINEAR,
GRID_GENERIC, GRID_LCC, GRID_LCC2, GRID_LAEA,
GRID_GENERIC, GRID_LCC, GRID_LCC2,
GRID_PROJECTION
};
for ( size_t i = 0; i < sizeof (valdef_group1_tab) / sizeof (valdef_group1_tab[0]); ++i)
......@@ -2732,9 +2717,6 @@ int gridGenerate(const grid_t *grid)
gridptr->y.inc = grid->y.inc;
if ( valdef_group1 && grid->area)
gridDefArea(gridID, grid->area);
gridptr->laea.a = grid->laea.a;
gridptr->laea.lon_0 = grid->laea.lon_0;
gridptr->laea.lat_0 = grid->laea.lat_0;
gridptr->lcc2.a = grid->lcc2.a;
gridptr->lcc2.lon_0 = grid->lcc2.lon_0;
gridptr->lcc2.lat_0 = grid->lcc2.lat_0;
......@@ -3441,7 +3423,6 @@ void gridPrintKernel(grid_t *gridptr, int index, int opt, FILE *fp)
case GRID_GAUSSIAN_REDUCED:
case GRID_GENERIC:
case GRID_LCC2:
case GRID_LAEA:
case GRID_PROJECTION:
case GRID_CURVILINEAR:
case GRID_UNSTRUCTURED:
......@@ -3489,15 +3470,6 @@ void gridPrintKernel(grid_t *gridptr, int index, int opt, FILE *fp)
}
}
if ( type == GRID_LAEA )
{
double a = 0, lon_0 = 0, lat_0 = 0;
gridInqLaea(gridID, &a, &lon_0, &lat_0);
fprintf(fp, "a = %.*g\n"
"lon_0 = %.*g\n"
"lat_0 = %.*g\n", dig, a, dig, lon_0, dig, lat_0);
}
if ( type == GRID_LCC2 )
{
double a = 0, lon_0 = 0, lat_0 = 0, lat_1 = 0, lat_2 = 0;
......@@ -3516,8 +3488,7 @@ void gridPrintKernel(grid_t *gridptr, int index, int opt, FILE *fp)
if ( type == GRID_LONLAT || type == GRID_GAUSSIAN ||
type == GRID_PROJECTION ||
type == GRID_GENERIC || type == GRID_LCC2 ||
type == GRID_LAEA )
type == GRID_GENERIC || type == GRID_LCC2 )
{
xfirst = gridInqXval(gridID, 0);
xinc = gridInqXinc(gridID);
......@@ -3550,8 +3521,7 @@ void gridPrintKernel(grid_t *gridptr, int index, int opt, FILE *fp)
if ( type == GRID_LONLAT || type == GRID_GENERIC ||
type == GRID_PROJECTION ||
type == GRID_GENERIC || type == GRID_LCC2 ||
type == GRID_LAEA )
type == GRID_GENERIC || type == GRID_LCC2 )
{
yfirst = gridInqYval(gridID, 0);
yinc = gridInqYinc(gridID);
......@@ -3871,44 +3841,6 @@ void gridInqLcc2(int gridID, double *earth_radius, double *lon_0, double *lat_0,
}
}
void gridDefLaea(int gridID, double earth_radius, double lon_0, double lat_0)
{
grid_t *gridptr = gridID2Ptr(gridID);
if ( gridptr->type != GRID_LAEA )
Warning("Definition of LAEA grid for %s grid not allowed!",
gridNamePtr(gridptr->type));
else
{
gridptr->laea.a = earth_radius;
gridptr->laea.lon_0 = lon_0;
gridptr->laea.lat_0 = lat_0;
gridptr->laea.defined = TRUE;
gridMark4Update(gridID);
}
}
void gridInqLaea(int gridID, double *earth_radius, double *lon_0, double *lat_0)
{
grid_t* gridptr = gridID2Ptr(gridID);
if ( gridptr->type != GRID_LAEA )
Warning("Inquire of LAEA grid definition for %s grid not allowed!",
gridNamePtr(gridptr->type));
else
{
if ( gridptr->laea.defined )
{
*earth_radius = gridptr->laea.a;
*lon_0 = gridptr->laea.lon_0;
*lat_0 = gridptr->laea.lat_0;
}
else
Warning("LAEA grid undefined (gridID = %d)", gridID);
}
}
void gridDefComplexPacking(int gridID, int lcomplex)
{
......@@ -4340,7 +4272,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP->lcc.scanflag = intBuffer[4];
gridP->lcc.defined = (short)intBuffer[5];
gridP->lcc2.defined = (short)intBuffer[6];
gridP->laea.defined = intBuffer[7];
gridP->isCyclic = (short)intBuffer[8];
gridP->x.flag = (short)intBuffer[10];
gridP->y.flag = (short)intBuffer[11];
......@@ -4399,9 +4330,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP->lcc2.lat_1 = doubleBuffer[15];
gridP->lcc2.lat_2 = doubleBuffer[16];
gridP->lcc2.a = doubleBuffer[17];
gridP->laea.lon_0 = doubleBuffer[18];
gridP->laea.lat_0 = doubleBuffer[19];
gridP->laea.a = doubleBuffer[20];
}
int irregular = gridP->type == GRID_UNSTRUCTURED
......@@ -4539,7 +4467,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
intBuffer[4] = gridP->lcc.scanflag;
intBuffer[5] = gridP->lcc.defined;
intBuffer[6] = gridP->lcc2.defined;
intBuffer[7] = gridP->laea.defined;
intBuffer[8] = gridP->isCyclic;
intBuffer[10] = gridP->x.flag;
intBuffer[11] = gridP->y.flag;
......@@ -4601,9 +4528,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
doubleBuffer[15] = gridP->lcc2.lat_1;
doubleBuffer[16] = gridP->lcc2.lat_2;
doubleBuffer[17] = gridP->lcc2.a;
doubleBuffer[18] = gridP->laea.lon_0;
doubleBuffer[19] = gridP->laea.lat_0;
doubleBuffer[20] = gridP->laea.a;
serializePack(doubleBuffer, gridNdouble, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context);
......
......@@ -82,14 +82,6 @@ struct grid_lcc2_t {
short defined;
};
// Lambert Azimuthal Equal Area
struct grid_laea_t {
double lon_0;
double lat_0;
double a;
short defined;
};
// GME Grid
struct grid_gme_t {
int nd, ni, ni2, ni3; /* parameter for GRID_GME */
......@@ -106,7 +98,6 @@ struct grid_t {
double *area;
struct grid_lcc_t lcc;
struct grid_lcc2_t lcc2;
struct grid_laea_t laea;
struct grid_gme_t gme;
short isCyclic; /* TRUE for global cyclic grids */
int number, position; /* parameter for GRID_REFERENCE */
......
......@@ -2502,22 +2502,15 @@ void cdf_set_proj_atts(int ncid, int gmapvarid, grid_t *grid)
cdfGetAttText(ncid, gmapvarid, attname, attstringlen, attstring);
str_tolower(attstring);
if ( strcmp(attstring, "lambert_azimuthal_equal_area") == 0 )
grid->type = GRID_LAEA;
else if ( strcmp(attstring, "lambert_conformal_conic") == 0 )
if ( strcmp(attstring, "lambert_conformal_conic") == 0 )
grid->type = GRID_LCC2;
}
else if ( strcmp(attname, "earth_radius") == 0 )
{
double datt;
cdfGetAttDouble(ncid, gmapvarid, attname, 1, &datt);
grid->laea.a = datt;
grid->lcc2.a = datt;
}
else if ( strcmp(attname, "longitude_of_projection_origin") == 0 )
{
cdfGetAttDouble(ncid, gmapvarid, attname, 1, &grid->laea.lon_0);
}
else if ( strcmp(attname, "longitude_of_central_meridian") == 0 )
{
cdfGetAttDouble(ncid, gmapvarid, attname, 1, &grid->lcc2.lon_0);
......@@ -2526,7 +2519,6 @@ void cdf_set_proj_atts(int ncid, int gmapvarid, grid_t *grid)
{
double datt;
cdfGetAttDouble(ncid, gmapvarid, attname, 1, &datt);
grid->laea.lat_0 = datt;
grid->lcc2.lat_0 = datt;
}
else if ( strcmp(attname, "standard_parallel") == 0 )
......
......@@ -1936,29 +1936,7 @@ void cdfDefMapping(stream_t *streamptr, int gridID)
int ncvarid = UNDEFID;
int fileID = streamptr->fileID;
if ( gridInqType(gridID) == GRID_LAEA )
{
static const char varname[] = "Lambert_AEA";
static const char mapname[] = "lambert_azimuthal_equal_area";
cdf_redef(fileID);
int ncerrcode = nc_def_var(fileID, varname, (nc_type) NC_CHAR, 0, NULL, &ncvarid);
if ( ncerrcode == NC_NOERR )
{
double a, lon_0, lat_0;
gridInqLaea(gridID, &a, &lon_0, &lat_0);
cdf_put_att_text(fileID, ncvarid, "grid_mapping_name", strlen(mapname), mapname);
cdf_put_att_double(fileID, ncvarid, "earth_radius", NC_DOUBLE, 1, &a);
cdf_put_att_double(fileID, ncvarid, "longitude_of_projection_origin", NC_DOUBLE, 1, &lon_0);
cdf_put_att_double(fileID, ncvarid, "latitude_of_projection_origin", NC_DOUBLE, 1, &lat_0);
}
cdf_enddef(fileID);
}
else if ( gridInqType(gridID) == GRID_LCC2 )
if ( gridInqType(gridID) == GRID_LCC2 )
{
static const char varname[] = "Lambert_CC";
static const char mapname[] = "lambert_conformal_conic";
......@@ -2072,7 +2050,7 @@ void cdfDefGrid(stream_t *streamptr, int gridID, int gridindex)
cdfDefTrajLon(streamptr, gridID, gridindex);
cdfDefTrajLat(streamptr, gridID, gridindex);
}
else if ( gridtype == GRID_LAEA || gridtype == GRID_LCC2 )
else if ( gridtype == GRID_LCC2 )
{
cdfDefXaxis(streamptr, gridID, gridindex, 1);
cdfDefYaxis(streamptr, gridID, gridindex, 1);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment