Skip to content
Snippets Groups Projects
Commit 6e466df0 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gridGetPlanetRadius: read attribute earth_radius directly

parent 958bc53f
No related branches found
No related tags found
1 merge request!159M214003/develop
......@@ -610,22 +610,6 @@ cdo_proj_to_lonlat(char *proj_params, size_t nvals, double *xvals, double *yvals
double
gridGetPlanetRadius(int gridID)
{
double planetRadius = 0.0;
auto gridtype = gridInqType(gridID);
auto projtype = (gridtype == GRID_PROJECTION) ? gridInqProjType(gridID) : -1;
if (projtype == CDI_PROJ_LCC)
{
CDI_GridProjParams gpp;
gridInqParamsLCC(gridID, &gpp);
if (IS_EQUAL(gpp.b, gpp.mv)) planetRadius = gpp.a;
}
else if (projtype == CDI_PROJ_STERE)
{
CDI_GridProjParams gpp;
gridInqParamsSTERE(gridID, &gpp);
if (IS_EQUAL(gpp.b, gpp.mv)) planetRadius = gpp.a;
}
return planetRadius;
double radius{ 0 };
return (CDI_NOERR == cdiInqAttFlt(gridID, CDI_GLOBAL, "earth_radius", 1, &radius) && radius > 1) ? radius : 0.0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment