Commit 43914cc5 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Changed interface for GME grid parameter.

parent 32ba0d6a
2016-08-15 Uwe Schulzweida
* Changed interface for GME grid parameter
2016-08-12 Uwe Schulzweida 2016-08-12 Uwe Schulzweida
* Removed obsolete grid type GRID_LCC2 * Removed obsolete grid type GRID_LCC2
......
...@@ -374,8 +374,8 @@ void printGridInfoKernel(int gridID, int index, bool lproj) ...@@ -374,8 +374,8 @@ void printGridInfoKernel(int gridID, int index, bool lproj)
} }
else if ( gridtype == GRID_GME ) else if ( gridtype == GRID_GME )
{ {
int ni = gridInqGMEni(gridID); int nd, ni, ni2, ni3;
int nd = gridInqGMEnd(gridID); gridInqParamGME(gridID, &nd, &ni, &ni2, &ni3);
#ifdef CDO #ifdef CDO
set_text_color(stdout, RESET, GREEN); set_text_color(stdout, RESET, GREEN);
#endif #endif
......
...@@ -850,15 +850,6 @@ int gridIsCircular(int gridID); ...@@ -850,15 +850,6 @@ int gridIsCircular(int gridID);
int gridInqTrunc(int gridID); int gridInqTrunc(int gridID);
void gridDefTrunc(int gridID, int trunc); void gridDefTrunc(int gridID, int trunc);
/* Hexagonal GME grid */
void gridDefGMEnd(int gridID, int nd);
int gridInqGMEnd(int gridID);
void gridDefGMEni(int gridID, int ni);
int gridInqGMEni(int gridID);
void gridDefGMEni2(int gridID, int ni2);
int gridInqGMEni2(int gridID);
void gridDefGMEni3(int gridID, int ni3);
int gridInqGMEni3(int gridID);
/* Reference of an unstructured grid */ /* Reference of an unstructured grid */
...@@ -895,10 +886,14 @@ void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]); ...@@ -895,10 +886,14 @@ void gridInqUUID(int gridID, unsigned char uuid[CDI_UUID_SIZE]);
#endif #endif
/* Rotated Lon/Lat grid */ /* Rotated Lon/Lat grid */
void gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle);
void gridDefParamRLL(int gridID, double xpole, double ypole, double angle); void gridDefParamRLL(int gridID, double xpole, double ypole, double angle);
void gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle);
/* Hexagonal GME grid */
void gridDefParamGME(int gridID, int nd, int ni, int ni2, int ni3);
void gridInqParamGME(int gridID, int *nd, int *ni, int *ni2, int *ni3);
/* Lambert Conformal Conic grid (GRIB version) */ /* Lambert Conformal Conic grid (GRIB version) */
void gridDefParamLCC(int gridID, double originLon, double originLat, double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag); void gridDefParamLCC(int gridID, double originLon, double originLat, double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag);
void gridInqParamLCC(int gridID, double *originLon, double *originLat, double *lonParY, double *lat1, double *lat2, double *xinc, double *yinc, int *projflag, int *scanflag); void gridInqParamLCC(int gridID, double *originLon, double *originLat, double *lonParY, double *lat1, double *lat2, double *xinc, double *yinc, int *projflag, int *scanflag);
......
...@@ -1855,11 +1855,14 @@ void gridDefParamRLL(int gridID, double xpole, double ypole, double angle) ...@@ -1855,11 +1855,14 @@ void gridDefParamRLL(int gridID, double xpole, double ypole, double angle)
@EndFunction @EndFunction
*/ */
int gridInqGMEnd(int gridID) void gridInqParamGME(int gridID, int *nd, int *ni, int *ni2, int *ni3)
{ {
grid_t *gridptr = gridID2Ptr(gridID); grid_t *gridptr = gridID2Ptr(gridID);
return gridptr->gme.nd; *nd = gridptr->gme.nd;
*ni = gridptr->gme.ni;
*ni2 = gridptr->gme.ni2;
*ni3 = gridptr->gme.ni3;
} }
/* /*
...@@ -1872,116 +1875,15 @@ int gridInqGMEnd(int gridID) ...@@ -1872,116 +1875,15 @@ int gridInqGMEnd(int gridID)
@EndFunction @EndFunction
*/ */
void gridDefGMEnd(int gridID, int nd) void gridDefParamGME(int gridID, int nd, int ni, int ni2, int ni3)
{ {
grid_t *gridptr = gridID2Ptr(gridID); grid_t *gridptr = gridID2Ptr(gridID);
if (gridptr->gme.nd != nd) if ( gridptr->gme.nd != nd )
{
gridptr->gme.nd = nd;
gridMark4Update(gridID);
}
}
/*
@Function
@Title
@Prototype
@Parameter
@Item Grid identifier
@EndFunction
*/
int gridInqGMEni(int gridID)
{
grid_t *gridptr = gridID2Ptr(gridID);
return gridptr->gme.ni;
}
/*
@Function
@Title
@Prototype
@Parameter
@Item Grid identifier
@EndFunction
*/
void gridDefGMEni(int gridID, int ni)
{
grid_t *gridptr = gridID2Ptr(gridID);
if ( gridptr->gme.ni != ni )
{
gridptr->gme.ni = ni;
gridMark4Update(gridID);
}
}
/*
@Function
@Title
@Prototype
@Parameter
@Item Grid identifier
@EndFunction
*/
int gridInqGMEni2(int gridID)
{
grid_t *gridptr = gridID2Ptr(gridID);
return gridptr->gme.ni2;
}
/*
@Function
@Title
@Prototype
@Parameter
@Item Grid identifier
@EndFunction
*/
void gridDefGMEni2(int gridID, int ni2)
{
grid_t *gridptr = gridID2Ptr(gridID);
if ( gridptr->gme.ni2 != ni2 )
{ {
gridptr->gme.nd = nd;
gridptr->gme.ni = ni;
gridptr->gme.ni2 = ni2; gridptr->gme.ni2 = ni2;
gridMark4Update(gridID);
}
}
/*
@Function
@Title
@Prototype
@Parameter
@Item Grid identifier
@EndFunction
*/
int gridInqGMEni3(int gridID)
{
grid_t *gridptr = gridID2Ptr(gridID);
return gridptr->gme.ni3;
}
void gridDefGMEni3(int gridID, int ni3)
{
grid_t *gridptr = gridID2Ptr(gridID);
if ( gridptr->gme.ni3 != ni3 )
{
gridptr->gme.ni3 = ni3; gridptr->gme.ni3 = ni3;
gridMark4Update(gridID); gridMark4Update(gridID);
} }
...@@ -2612,10 +2514,7 @@ void gridComplete(grid_t *grid) ...@@ -2612,10 +2514,7 @@ void gridComplete(grid_t *grid)
} }
case GRID_GME: case GRID_GME:
{ {
gridDefGMEnd(gridID, grid->gme.nd); gridDefParamGME(gridID, grid->gme.nd, grid->gme.ni, grid->gme.ni2, grid->gme.ni3);
gridDefGMEni(gridID, grid->gme.ni);
gridDefGMEni2(gridID, grid->gme.ni2);
gridDefGMEni3(gridID, grid->gme.ni3);
break; break;
} }
/* /*
......
...@@ -1814,10 +1814,12 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI ...@@ -1814,10 +1814,12 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
case GRID_GME: case GRID_GME:
{ {
ISEC2_GridType = GRIB1_GTYPE_GME; ISEC2_GridType = GRIB1_GTYPE_GME;
ISEC2_GME_ND = gridInqGMEnd(gridID); int nd = 0, ni = 0, ni2 = 0, ni3 = 0;
ISEC2_GME_NI = gridInqGMEni(gridID); gridInqParamGME(gridID, &nd, &ni, &ni2, &ni3);
ISEC2_GME_NI2 = gridInqGMEni2(gridID); ISEC2_GME_ND = nd;
ISEC2_GME_NI3 = gridInqGMEni3(gridID); ISEC2_GME_NI = ni;
ISEC2_GME_NI2 = ni2;
ISEC2_GME_NI3 = ni3;
ISEC2_GME_AFlag = 0; ISEC2_GME_AFlag = 0;
ISEC2_GME_LatPP = 90000; ISEC2_GME_LatPP = 90000;
ISEC2_GME_LonPP = 0; ISEC2_GME_LonPP = 0;
......
...@@ -2172,10 +2172,12 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype ...@@ -2172,10 +2172,12 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
{ {
GRIB_CHECK(my_grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_GME), 0); GRIB_CHECK(my_grib_set_long(gh, "gridDefinitionTemplateNumber", GRIB2_GTYPE_GME), 0);
GRIB_CHECK(my_grib_set_long(gh, "nd", gridInqGMEnd(gridID)), 0); int nd = 0, ni = 0, ni2 = 0, ni3 = 0;
GRIB_CHECK(my_grib_set_long(gh, "Ni", gridInqGMEni(gridID)), 0); gridInqParamGME(gridID, &nd, &ni, &ni2, &ni3);
GRIB_CHECK(my_grib_set_long(gh, "n2", gridInqGMEni2(gridID)), 0); GRIB_CHECK(my_grib_set_long(gh, "nd", nd), 0);
GRIB_CHECK(my_grib_set_long(gh, "n3", gridInqGMEni3(gridID)), 0); GRIB_CHECK(my_grib_set_long(gh, "Ni", ni), 0);
GRIB_CHECK(my_grib_set_long(gh, "n2", ni2), 0);
GRIB_CHECK(my_grib_set_long(gh, "n3", ni3), 0);
GRIB_CHECK(my_grib_set_long(gh, "latitudeOfThePolePoint", 90000000), 0); GRIB_CHECK(my_grib_set_long(gh, "latitudeOfThePolePoint", 90000000), 0);
GRIB_CHECK(my_grib_set_long(gh, "longitudeOfThePolePoint", 0), 0); GRIB_CHECK(my_grib_set_long(gh, "longitudeOfThePolePoint", 0), 0);
......
...@@ -63,18 +63,10 @@ static int defineGrid (void) ...@@ -63,18 +63,10 @@ static int defineGrid (void)
gridDefYunits ( gridID, "myYunits" ); gridDefYunits ( gridID, "myYunits" );
gridDefPrec ( gridID, DOUBLE_PRECISION ); gridDefPrec ( gridID, DOUBLE_PRECISION );
gridDefTrunc ( gridID, 1 ); gridDefTrunc ( gridID, 1 );
gridDefGMEnd ( gridID, 2 ); gridDefParamGME ( gridID, 2, 3, 4, 5 );
gridDefGMEni ( gridID, 3 );
gridDefGMEni2 ( gridID, 4 );
gridDefGMEni3 ( gridID, 5 );
gridDefNumber ( gridID, 6 ); gridDefNumber ( gridID, 6 );
gridDefPosition ( gridID, 7 ); gridDefPosition ( gridID, 7 );
gridDefReference ( gridID, "myReference" ); gridDefReference ( gridID, "myReference" );
/* gridDefLCC ( gridID, double originLon, double originLat, */
/* double lonParY, double lat1, double lat2, double xinc, double yinc, int projflag, int scanflag); */
/* gridDefLcc2 ( gridID, double earth_radius, double lon_0, */
/* double lat_0, double lat_1,double lat_2);*/
/* gridDefLaea ( gridID, double earth_radius, double lon_0, double lat_0); */
for ( i = 0; i < nlon*nlat; i++ ) for ( i = 0; i < nlon*nlat; i++ )
area_vec[i] = 0.1 * i; area_vec[i] = 0.1 * i;
gridDefArea ( gridID, ap ); gridDefArea ( gridID, ap );
......
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