Commit 2db5cbf4 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cdfDefineCoordinates(): added attributes CDI_grid_type and CDI_grid_num_LPE for Gaussian grids.

parent 1e8cd19e
......@@ -405,7 +405,7 @@ void cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID,
{
const int fileID = streamptr->fileID;
if ( gridtype != GRID_GENERIC && gridtype != GRID_LONLAT && gridtype != GRID_GAUSSIAN &&
if ( gridtype != GRID_GENERIC && gridtype != GRID_LONLAT &&
gridtype != GRID_PROJECTION && gridtype != GRID_CURVILINEAR && gridtype != GRID_CHARXY )
{
const size_t len = strlen(gridNamePtr(gridtype));
......@@ -416,12 +416,15 @@ void cdfDefineCoordinates(const stream_t *streamptr, int ncvarID, int nczvarID,
cdf_get_gmapvarname(gridID, gmapvarname);
if ( gmapvarname[0] ) cdf_put_att_text(fileID, ncvarID, "grid_mapping", strlen(gmapvarname), gmapvarname);
if ( gridtype == GRID_GAUSSIAN_REDUCED )
if ( gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED )
{
const int numLPE = gridInqNP(gridID);
if (numLPE > 0)
cdf_put_att_int(fileID, ncvarID, "CDI_grid_num_LPE", NC_INT, 1, &numLPE);
}
if ( gridtype == GRID_GAUSSIAN_REDUCED )
{
const int ncyvarID = streamptr->ncgrid[gridindex].ncIDs[CDF_VARID_Y];
if (ncyvarID != CDI_UNDEFID)
{
......
......@@ -198,8 +198,7 @@ bool isGaussGrid(size_t ysize, double yinc, const double *yvals)
yv[i] = asin(yv[i])/M_PI*180.0;
for ( i = 0; i < ysize; i++ )
if ( fabs(yv[i] - yvals[i]) >
((yv[0] - yv[1])/500) ) break;
if ( fabs(yv[i] - yvals[i]) > ((yv[0] - yv[1])/500) ) break;
if ( i == ysize ) lgauss = true;
......@@ -207,8 +206,7 @@ bool isGaussGrid(size_t ysize, double yinc, const double *yvals)
if ( lgauss == false )
{
for ( i = 0; i < ysize; i++ )
if ( fabs(yv[i] - yvals[ysize-i-1]) >
((yv[0] - yv[1])/500) ) break;
if ( fabs(yv[i] - yvals[ysize-i-1]) > ((yv[0] - yv[1])/500) ) break;
if ( i == ysize ) lgauss = true;
}
......
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