Commit 02b6b6a2 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Removed obsolete grid type GRID_LCC2.

parent 5e8c01e5
2016-08-12 Uwe Schulzweida
* Removed obsolete grid type GRID_LCC2
2016-08-11 Uwe Schulzweida
* Removed obsolete grid type GRID_LAEA
......
......@@ -353,14 +353,6 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
if ( gridInqMask(gridID, NULL) ) fprintf(stdout, " mask");
fprintf(stdout, "\n");
}
if ( gridtype == GRID_LCC2 )
{
double a, lon_0, lat_0, lat_1, lat_2;
gridInqLcc2(gridID, &a, &lon_0, &lat_0, &lat_1, &lat_2);
fprintf(stdout, "%33s : a=%7.0f lon_0=%g lat_0=%g lat_1=%g lat_2=%g\n",
"projpar", a, lon_0, lat_0, lat_1, lat_2);
}
}
else if ( gridtype == GRID_SPECTRAL )
{
......
......@@ -265,12 +265,6 @@ void set_gridtype(const char *attstring, int *gridtype)
*gridtype = GRID_UNSTRUCTURED;
else if ( strcmp(attstring, "curvilinear") == 0 )
*gridtype = GRID_CURVILINEAR;
else if ( strcmp(attstring, "sinusoidal") == 0 )
;
else if ( strcmp(attstring, "laea") == 0 )
;
else if ( strcmp(attstring, "lcc2") == 0 )
;
else if ( strcmp(attstring, "linear") == 0 ) // ignore grid type linear
;
else
......
......@@ -624,8 +624,7 @@ int cdfDefVar(stream_t *streamptr, int varID)
char gmapvarname[CDI_MAX_NAME]; gmapvarname[0] = 0;
if ( gridtype == GRID_LCC2 ) strcpy(gmapvarname, "Lambert_CC");
else cdf_get_gmapvarname(gridID, gmapvarname);
cdf_get_gmapvarname(gridID, gmapvarname);
if ( gmapvarname[0] ) cdf_put_att_text(fileID, ncvarid, "grid_mapping", strlen(gmapvarname), gmapvarname);
......
......@@ -137,8 +137,7 @@ extern "C" {
#define GRID_UNSTRUCTURED 9 /* General unstructured grid */
#define GRID_CURVILINEAR 10 /* Curvilinear grid */
#define GRID_LCC 11 /* Lambert Conformal Conic (GRIB) */
#define GRID_LCC2 12 /* Lambert Conformal Conic (PROJ) */
#define GRID_PROJECTION 13 /* Projected coordinates */
#define GRID_PROJECTION 12 /* Projected coordinates */
#define CDI_PROJ_RLL 21 /* Rotated Latitude Longitude */
#define CDI_PROJ_LCC 22 /* Lambert Conformal Conic */
......@@ -902,15 +901,6 @@ void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]);
void gridDefLCC(int gridID, double originLon, double originLat, double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag);
void gridInqLCC(int gridID, double *originLon, double *originLat, double *lonParY, double *lat1, double *lat2, double *xinc, double *yinc, int *projflag, int *scanflag);
/* Lambert Conformal Conic 2 grid (PROJ version) */
void gridDefLcc2(int gridID, double earth_radius, double lon_0, double lat_0, double lat_1, double lat_2);
void gridInqLcc2(int gridID, double *earth_radius, double *lon_0, double *lat_0, double *lat_1, double *lat_2);
/* Lambert Azimuthal Equal Area grid */
void gridDefLaea(int gridID, double earth_radius, double lon_0, double lat_0);
void gridInqLaea(int gridID, double *earth_radius, double *lon_0, double *lat_0);
void gridDefArea(int gridID, const double area[]);
void gridInqArea(int gridID, double area[]);
int gridHasArea(int gridID);
......
......@@ -38,8 +38,7 @@ static const char Grids[][17] = {
/* 9 */ "unstructured",
/* 10 */ "curvilinear",
/* 11 */ "lcc",
/* 12 */ "lcc2",
/* 13 */ "projection",
/* 12 */ "projection",
};
/* must match table below */
......@@ -120,12 +119,6 @@ void grid_init(grid_t *gridptr)
gridptr->lcc.projflag = 0;
gridptr->lcc.scanflag = 0;
gridptr->lcc.defined = FALSE;
gridptr->lcc2.lon_0 = 0.0;
gridptr->lcc2.lat_0 = 0.0;
gridptr->lcc2.lat_1 = 0.0;
gridptr->lcc2.lat_2 = 0.0;
gridptr->lcc2.a = 0.0;
gridptr->lcc2.defined = FALSE;
gridptr->gme.nd = 0;
gridptr->gme.ni = 0;
......@@ -307,16 +300,13 @@ void cdiGridTypeInit(grid_t *gridptr, int gridtype, int size)
}
case GRID_GENERIC:
case GRID_PROJECTION:
case GRID_LCC2:
{
if ( gridptr->x.name[0] == 0 ) gridSetName(gridptr->x.name, "x");
if ( gridptr->y.name[0] == 0 ) gridSetName(gridptr->y.name, "y");
if ( gridtype == GRID_PROJECTION )
{
gridSetName(gridptr->mapname, "Projection");
}
if ( gridtype != GRID_GENERIC )
{
gridptr->x.stdname = xystdname_tab[grid_xystdname_projection][0];
gridptr->y.stdname = xystdname_tab[grid_xystdname_projection][1];
gridSetName(gridptr->x.units, "m");
......@@ -2346,7 +2336,6 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
if ( g1->lcc.projflag != g2->lcc.projflag ) return differ;
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->isCyclic != g2->isCyclic ) return differ;
if ( g1->x.flag != g2->x.flag ) return differ;
if ( g1->y.flag != g2->y.flag ) return differ;
......@@ -2377,11 +2366,6 @@ int gridCompareP ( void * gridptr1, void * gridptr2 )
if ( IS_NOT_EQUAL(g1->lcc.lat2 , g2->lcc.lat2) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc.xinc , g2->lcc.xinc) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc.yinc , g2->lcc.yinc) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc2.lon_0 , g2->lcc2.lon_0) ) return differ;
if ( IS_NOT_EQUAL(g1->lcc2.lat_0 , g2->lcc2.lat_0) ) return differ;
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;
const double *restrict g1_xvals = g1->vtable->inqXValsPtr(g1),
*restrict g2_xvals = g2->vtable->inqXValsPtr(g2);
......@@ -2531,7 +2515,6 @@ void gridComplete(grid_t *grid)
case GRID_CURVILINEAR:
case GRID_GENERIC:
case GRID_LCC:
case GRID_LCC2:
case GRID_PROJECTION:
{
if ( grid->x.size > 0 ) gridDefXsize(gridID, grid->x.size);
......@@ -2578,9 +2561,6 @@ void gridComplete(grid_t *grid)
switch (gridtype)
{
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;
case GRID_LCC:
gridDefLCC(gridID, grid->lcc.originLon, grid->lcc.originLat, grid->lcc.lonParY,
grid->lcc.lat1, grid->lcc.lat2, grid->lcc.xinc, grid->lcc.yinc,
......@@ -2691,8 +2671,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_PROJECTION
GRID_GENERIC, GRID_LCC, GRID_PROJECTION
};
for ( size_t i = 0; i < sizeof (valdef_group1_tab) / sizeof (valdef_group1_tab[0]); ++i)
valdef_group1 |= (gridtype == valdef_group1_tab[i]);
......@@ -2717,11 +2696,6 @@ int gridGenerate(const grid_t *grid)
gridptr->y.inc = grid->y.inc;
if ( valdef_group1 && grid->area)
gridDefArea(gridID, grid->area);
gridptr->lcc2.a = grid->lcc2.a;
gridptr->lcc2.lon_0 = grid->lcc2.lon_0;
gridptr->lcc2.lat_0 = grid->lcc2.lat_0;
gridptr->lcc2.lat_1 = grid->lcc2.lat_1;
gridptr->lcc2.lat_2 = grid->lcc2.lat_2;
gridptr->lcc.originLon = grid->lcc.originLon;
gridptr->lcc.originLat = grid->lcc.originLat;
gridptr->lcc.lonParY = grid->lcc.lonParY;
......@@ -3422,7 +3396,6 @@ void gridPrintKernel(grid_t *gridptr, int index, int opt, FILE *fp)
case GRID_GAUSSIAN:
case GRID_GAUSSIAN_REDUCED:
case GRID_GENERIC:
case GRID_LCC2:
case GRID_PROJECTION:
case GRID_CURVILINEAR:
case GRID_UNSTRUCTURED:
......@@ -3470,25 +3443,12 @@ void gridPrintKernel(grid_t *gridptr, int index, int opt, FILE *fp)
}
}
if ( type == GRID_LCC2 )
{
double a = 0, lon_0 = 0, lat_0 = 0, lat_1 = 0, lat_2 = 0;
gridInqLcc2(gridID, &a, &lon_0, &lat_0, &lat_1, &lat_2);
fprintf(fp, "a = %.*g\n"
"lon_0 = %.*g\n"
"lat_0 = %.*g\n"
"lat_1 = %.*g\n"
"lat_2 = %.*g\n",
dig, a, dig, lon_0, dig, lat_0, dig, lat_1, dig, lat_2);
}
if ( xvals )
{
double xfirst = 0.0, xinc = 0.0;
if ( type == GRID_LONLAT || type == GRID_GAUSSIAN ||
type == GRID_PROJECTION ||
type == GRID_GENERIC || type == GRID_LCC2 )
type == GRID_PROJECTION || type == GRID_GENERIC )
{
xfirst = gridInqXval(gridID, 0);
xinc = gridInqXinc(gridID);
......@@ -3520,8 +3480,7 @@ void gridPrintKernel(grid_t *gridptr, int index, int opt, FILE *fp)
double yfirst = 0.0, yinc = 0.0;
if ( type == GRID_LONLAT || type == GRID_GENERIC ||
type == GRID_PROJECTION ||
type == GRID_GENERIC || type == GRID_LCC2 )
type == GRID_PROJECTION || type == GRID_GENERIC )
{
yfirst = gridInqYval(gridID, 0);
yinc = gridInqYinc(gridID);
......@@ -3799,48 +3758,6 @@ void gridInqLCC(int gridID, double *originLon, double *originLat, double *lonPar
}
}
void gridDefLcc2(int gridID, double earth_radius, double lon_0, double lat_0, double lat_1, double lat_2)
{
grid_t *gridptr = gridID2Ptr(gridID);
if ( gridptr->type != GRID_LCC2 )
Warning("Definition of LCC2 grid for %s grid not allowed!",
gridNamePtr(gridptr->type));
else
{
gridptr->lcc2.a = earth_radius;
gridptr->lcc2.lon_0 = lon_0;
gridptr->lcc2.lat_0 = lat_0;
gridptr->lcc2.lat_1 = lat_1;
gridptr->lcc2.lat_2 = lat_2;
gridptr->lcc2.defined = TRUE;
gridMark4Update(gridID);
}
}
void gridInqLcc2(int gridID, double *earth_radius, double *lon_0, double *lat_0, double *lat_1, double *lat_2)
{
grid_t *gridptr = gridID2Ptr(gridID);
if ( gridptr->type != GRID_LCC2 )
Warning("Inquire of LCC2 grid definition for %s grid not allowed!",
gridNamePtr(gridptr->type));
else
{
if ( gridptr->lcc2.defined )
{
*earth_radius = gridptr->lcc2.a;
*lon_0 = gridptr->lcc2.lon_0;
*lat_0 = gridptr->lcc2.lat_0;
*lat_1 = gridptr->lcc2.lat_1;
*lat_2 = gridptr->lcc2.lat_2;
}
else
Warning("LCC2 grid undefined (gridID = %d)", gridID);
}
}
void gridDefComplexPacking(int gridID, int lcomplex)
{
......@@ -4271,7 +4188,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP->lcc.projflag = intBuffer[3];
gridP->lcc.scanflag = intBuffer[4];
gridP->lcc.defined = (short)intBuffer[5];
gridP->lcc2.defined = (short)intBuffer[6];
gridP->isCyclic = (short)intBuffer[8];
gridP->x.flag = (short)intBuffer[10];
gridP->y.flag = (short)intBuffer[11];
......@@ -4325,11 +4241,6 @@ gridUnpack(char * unpackBuffer, int unpackBufferSize,
gridP->lcc.lat2 = doubleBuffer[10];
gridP->lcc.xinc = doubleBuffer[11];
gridP->lcc.yinc = doubleBuffer[12];
gridP->lcc2.lon_0 = doubleBuffer[13];
gridP->lcc2.lat_0 = doubleBuffer[14];
gridP->lcc2.lat_1 = doubleBuffer[15];
gridP->lcc2.lat_2 = doubleBuffer[16];
gridP->lcc2.a = doubleBuffer[17];
}
int irregular = gridP->type == GRID_UNSTRUCTURED
......@@ -4466,7 +4377,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
intBuffer[3] = gridP->lcc.projflag;
intBuffer[4] = gridP->lcc.scanflag;
intBuffer[5] = gridP->lcc.defined;
intBuffer[6] = gridP->lcc2.defined;
intBuffer[8] = gridP->isCyclic;
intBuffer[10] = gridP->x.flag;
intBuffer[11] = gridP->y.flag;
......@@ -4523,11 +4433,6 @@ gridPack(void * voidP, void * packBuffer, int packBufferSize,
doubleBuffer[10] = gridP->lcc.lat2;
doubleBuffer[11] = gridP->lcc.xinc;
doubleBuffer[12] = gridP->lcc.yinc;
doubleBuffer[13] = gridP->lcc2.lon_0;
doubleBuffer[14] = gridP->lcc2.lat_0;
doubleBuffer[15] = gridP->lcc2.lat_1;
doubleBuffer[16] = gridP->lcc2.lat_2;
doubleBuffer[17] = gridP->lcc2.a;
serializePack(doubleBuffer, gridNdouble, DATATYPE_FLT64,
packBuffer, packBufferSize, packBufferPos, context);
......
......@@ -72,16 +72,6 @@ struct grid_lcc_t {
short defined;
};
// Lambert Conformal Conic 2
struct grid_lcc2_t {
double lon_0;
double lat_0;
double lat_1;
double lat_2;
double a;
short defined;
};
// GME Grid
struct grid_gme_t {
int nd, ni, ni2, ni3; /* parameter for GRID_GME */
......@@ -97,7 +87,6 @@ struct grid_t {
mask_t *mask_gme;
double *area;
struct grid_lcc_t lcc;
struct grid_lcc2_t lcc2;
struct grid_gme_t gme;
short isCyclic; /* TRUE for global cyclic grids */
int number, position; /* parameter for GRID_REFERENCE */
......
......@@ -2480,67 +2480,6 @@ void cdf_read_mapping_atts(int ncid, int gmapvarid, int projID, const char *varn
cdf_set_cdi_attr(ncid, gmapvarid, attnum, projID, CDI_GLOBAL);
}
static
void cdf_set_proj_atts(int ncid, int gmapvarid, grid_t *grid)
{
int nvatts;
cdf_inq_varnatts(ncid, gmapvarid, &nvatts);
for ( int iatt = 0; iatt < nvatts; iatt++ )
{
nc_type atttype;
size_t attlen;
char attname[CDI_MAX_NAME];
cdf_inq_attname(ncid, gmapvarid, iatt, attname);
cdf_inq_attlen(ncid, gmapvarid, attname, &attlen);
cdf_inq_atttype(ncid, gmapvarid, attname, &atttype);
if ( strcmp(attname, "grid_mapping_name") == 0 )
{
enum {attstringlen = 8192};
char attstring[attstringlen];
cdfGetAttText(ncid, gmapvarid, attname, attstringlen, attstring);
str_tolower(attstring);
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->lcc2.a = datt;
}
else if ( strcmp(attname, "longitude_of_central_meridian") == 0 )
{
cdfGetAttDouble(ncid, gmapvarid, attname, 1, &grid->lcc2.lon_0);
}
else if ( strcmp(attname, "latitude_of_projection_origin") == 0 )
{
double datt;
cdfGetAttDouble(ncid, gmapvarid, attname, 1, &datt);
grid->lcc2.lat_0 = datt;
}
else if ( strcmp(attname, "standard_parallel") == 0 )
{
if ( attlen == 1 )
{
double datt;
cdfGetAttDouble(ncid, gmapvarid, attname, 1, &datt);
grid->lcc2.lat_1 = datt;
grid->lcc2.lat_2 = datt;
}
else
{
double datt2[2];
cdfGetAttDouble(ncid, gmapvarid, attname, 2, datt2);
grid->lcc2.lat_1 = datt2[0];
grid->lcc2.lat_2 = datt2[1];
}
}
}
}
static
void cdf_set_grid_to_similar_vars(ncvar_t *ncvar1, ncvar_t *ncvar2, int gridtype, int xdimid, int ydimid)
{
......@@ -2675,22 +2614,11 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
if ( cdf_set_unstructured_par(ncvar, grid, xdimid, ydimid, number_of_grid_used, uuidOfHGrid) )
continue;
if ( lproj )
if ( lproj && lgrid )
{
int ncid = ncvars[gmapvarid].ncid;
if ( !testproj && ncvar->gridtype != GRID_CURVILINEAR )
{
cdf_set_proj_atts(ncid, gmapvarid, grid);
}
else if ( testproj )
{
if ( lgrid )
{
int dumid;
cdf_read_coordinates(lazyProj, ncvar, ncvars, ncdims, timedimid,
xaxisid, yaxisid, xsize, ysize, &dumid);
}
}
int dumid;
cdf_read_coordinates(lazyProj, ncvar, ncvars, ncdims, timedimid,
xaxisid, yaxisid, xsize, ysize, &dumid);
}
if ( CDI_Debug )
......
......@@ -1930,46 +1930,6 @@ void cdf_def_mapping(stream_t *streamptr, int gridID)
}
}
static
void cdfDefMapping(stream_t *streamptr, int gridID)
{
int ncvarid = UNDEFID;
int fileID = streamptr->fileID;
if ( gridInqType(gridID) == GRID_LCC2 )
{
static const char varname[] = "Lambert_CC";
static const char mapname[] = "lambert_conformal_conic";
cdf_redef(fileID);
int ncerrcode = nc_def_var(fileID, varname, (nc_type) NC_CHAR, 0, NULL, &ncvarid);
if ( ncerrcode == NC_NOERR )
{
double radius, lon_0, lat_0, lat_1, lat_2;
gridInqLcc2(gridID, &radius, &lon_0, &lat_0, &lat_1, &lat_2);
cdf_put_att_text(fileID, ncvarid, "grid_mapping_name", strlen(mapname), mapname);
if ( radius > 0 )
cdf_put_att_double(fileID, ncvarid, "earth_radius", NC_DOUBLE, 1, &radius);
cdf_put_att_double(fileID, ncvarid, "longitude_of_central_meridian", NC_DOUBLE, 1, &lon_0);
cdf_put_att_double(fileID, ncvarid, "latitude_of_projection_origin", NC_DOUBLE, 1, &lat_0);
if ( IS_EQUAL(lat_1, lat_2) )
cdf_put_att_double(fileID, ncvarid, "standard_parallel", NC_DOUBLE, 1, &lat_1);
else
{
double lat_1_2[2];
lat_1_2[0] = lat_1;
lat_1_2[1] = lat_2;
cdf_put_att_double(fileID, ncvarid, "standard_parallel", NC_DOUBLE, 2, lat_1_2);
}
}
cdf_enddef(fileID);
}
}
static
void cdfDefGrid(stream_t *streamptr, int gridID, int gridindex)
{
......@@ -2050,13 +2010,6 @@ void cdfDefGrid(stream_t *streamptr, int gridID, int gridindex)
cdfDefTrajLon(streamptr, gridID, gridindex);
cdfDefTrajLat(streamptr, gridID, gridindex);
}
else if ( gridtype == GRID_LCC2 )
{
cdfDefXaxis(streamptr, gridID, gridindex, 1);
cdfDefYaxis(streamptr, gridID, gridindex, 1);
cdfDefMapping(streamptr, gridID);
}
/*
else if ( gridtype == GRID_LCC )
{
......
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