Commit f3409394 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Moved grid lcc2 parameter to struct grid_lcc2_t.

parent 96e4f414
......@@ -119,12 +119,12 @@ 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->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->laea_lon_0 = 0.0;
gridptr->laea_lat_0 = 0.0;
gridptr->laea_a = 0.0;
......@@ -2422,7 +2422,7 @@ 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->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->isRotated != g2->isRotated ) return differ;
......@@ -2455,11 +2455,11 @@ 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;
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;
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;
......@@ -2673,7 +2673,7 @@ static void gridComplete(grid_t *grid)
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);
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,
......@@ -2822,11 +2822,11 @@ int gridGenerate(const grid_t *grid)
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;
gridptr->lcc2_lat_1 = grid->lcc2_lat_1;
gridptr->lcc2_lat_2 = grid->lcc2_lat_2;
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;
......@@ -3847,12 +3847,12 @@ void gridDefLcc2(int gridID, double earth_radius, double lon_0, double lat_0, do
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;
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);
}
}
......@@ -3867,13 +3867,13 @@ void gridInqLcc2(int gridID, double *earth_radius, double *lon_0, double *lat_0,
gridNamePtr(gridptr->type));
else
{
if ( gridptr->lcc2_defined )
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;
*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);
......@@ -4348,7 +4348,7 @@ 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->lcc2.defined = (short)intBuffer[6];
gridP->laea_defined = intBuffer[7];
gridP->isCyclic = (short)intBuffer[8];
gridP->isRotated = (short)intBuffer[9];
......@@ -4404,11 +4404,11 @@ 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];
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];
gridP->laea_lon_0 = doubleBuffer[18];
gridP->laea_lat_0 = doubleBuffer[19];
gridP->laea_a = doubleBuffer[20];
......@@ -4551,7 +4551,7 @@ 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[6] = gridP->lcc2.defined;
intBuffer[7] = gridP->laea_defined;
intBuffer[8] = gridP->isCyclic;
intBuffer[9] = gridP->isRotated;
......@@ -4610,11 +4610,11 @@ 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;
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;
doubleBuffer[18] = gridP->laea_lon_0;
doubleBuffer[19] = gridP->laea_lat_0;
doubleBuffer[20] = gridP->laea_a;
......
......@@ -51,6 +51,16 @@ struct gridaxis_t {
const char *stdname;
};
// Lambert Conformal Conic 2
struct grid_lcc2_t {
short defined;
double lon_0;
double lat_0;
double lat_1;
double lat_2;
double a;
};
struct grid_t {
int self;
int type; /* grid type */
......@@ -76,13 +86,8 @@ struct grid_t {
int lcc_projflag;
int lcc_scanflag;
short lcc_defined;
short lcc2_defined;
struct grid_lcc2_t lcc2;
int laea_defined;
double lcc2_lon_0; /* Lambert Conformal Conic 2 */
double lcc2_lat_0;
double lcc2_lat_1;
double lcc2_lat_2;
double lcc2_a;
double laea_lon_0; /* Lambert Azimuthal Equal Area */
double laea_lat_0;
double laea_a;
......
......@@ -5398,7 +5398,7 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
double datt;
cdfGetAttDouble(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, 1, &datt);
grid->laea_a = datt;
grid->lcc2_a = datt;
grid->lcc2.a = datt;
}
else if ( strcmp(attname, "longitude_of_projection_origin") == 0 )
{
......@@ -5406,14 +5406,14 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
}
else if ( strcmp(attname, "longitude_of_central_meridian") == 0 )
{
cdfGetAttDouble(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, 1, &grid->lcc2_lon_0);
cdfGetAttDouble(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, 1, &grid->lcc2.lon_0);
}
else if ( strcmp(attname, "latitude_of_projection_origin") == 0 )
{
double datt;
cdfGetAttDouble(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, 1, &datt);
grid->laea_lat_0 = datt;
grid->lcc2_lat_0 = datt;
grid->lcc2.lat_0 = datt;
}
else if ( strcmp(attname, "standard_parallel") == 0 )
{
......@@ -5421,15 +5421,15 @@ void cdf_define_all_grids(stream_t *streamptr, int vlistID, ncdim_t *ncdims, int
{
double datt;
cdfGetAttDouble(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, 1, &datt);
grid->lcc2_lat_1 = datt;
grid->lcc2_lat_2 = datt;
grid->lcc2.lat_1 = datt;
grid->lcc2.lat_2 = datt;
}
else
{
double datt2[2];
cdfGetAttDouble(ncvars[ncvarid].ncid, ncvars[ncvarid].gmapid, attname, 2, datt2);
grid->lcc2_lat_1 = datt2[0];
grid->lcc2_lat_2 = datt2[1];
grid->lcc2.lat_1 = datt2[0];
grid->lcc2.lat_2 = datt2[1];
}
}
else if ( strcmp(attname, "grid_north_pole_latitude") == 0 )
......
Supports Markdown
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