Commit 3640d519 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gridGenAreaUnstruct: added support for GRID_GAUSSIAN_REDUCED.

parent 631cd2be
......@@ -400,12 +400,12 @@ gridGenAreaUnstruct(int gridID, double *area)
bool lgrid_gen_bounds = false;
bool lgriddestroy = false;
size_t gridsize = gridInqSize(gridID);
const size_t gridsize = gridInqSize(gridID);
int gridtype = gridInqType(gridID);
if (gridtype != GRID_UNSTRUCTURED && gridtype != GRID_CURVILINEAR)
{
if (gridtype == GRID_GME)
if (gridtype == GRID_GME || gridtype == GRID_GAUSSIAN_REDUCED)
{
lgriddestroy = true;
gridID = gridToUnstructured(gridID, 1);
......@@ -437,7 +437,7 @@ gridGenAreaUnstruct(int gridID, double *area)
gridtype = gridInqType(gridID);
size_t nv = (gridtype == GRID_UNSTRUCTURED) ? gridInqNvertex(gridID) : 4;
const size_t nv = (gridtype == GRID_UNSTRUCTURED) ? gridInqNvertex(gridID) : 4;
if (gridInqYvals(gridID, nullptr) == 0 || gridInqXvals(gridID, nullptr) == 0)
{
......@@ -474,11 +474,9 @@ gridGenAreaUnstruct(int gridID, double *area)
{
if (lgrid_gen_bounds)
{
size_t nlon = gridInqXsize(gridID);
size_t nlat = gridInqYsize(gridID);
double dlon = 0;
if (nlon == 1) dlon = 1;
const size_t nlon = gridInqXsize(gridID);
const size_t nlat = gridInqYsize(gridID);
const double dlon = (nlon == 1) ? 1 : 0;
grid_cell_center_to_bounds_X2D(xunitstr, nlon, nlat, grid_center_lon.data(), grid_corner_lon.data(), dlon);
grid_cell_center_to_bounds_Y2D(yunitstr, nlon, nlat, grid_center_lat.data(), grid_corner_lat.data());
}
......@@ -503,7 +501,7 @@ gridGenAreaUnstruct(int gridID, double *area)
#ifdef _OPENMP
#pragma omp parallel for default(none) \
shared(findex, gridsize, area, nv, grid_corner_lon, grid_corner_lat, grid_center_lon, grid_center_lat)
shared(findex, area, grid_corner_lon, grid_corner_lat, grid_center_lon, grid_center_lat)
#endif
for (size_t i = 0; i < gridsize; ++i)
{
......@@ -541,7 +539,8 @@ gridGenArea(const int gridID, double *area)
status = gridGenAreaReg2D(gridID, area, lweights);
}
else if (projtype == CDI_PROJ_RLL || projtype == CDI_PROJ_LAEA || projtype == CDI_PROJ_SINU || projtype == CDI_PROJ_LCC
|| projtype == CDI_PROJ_STERE || gridtype == GRID_GME || gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED)
|| projtype == CDI_PROJ_STERE || gridtype == GRID_GME || gridtype == GRID_CURVILINEAR || gridtype == GRID_UNSTRUCTURED
|| gridtype == GRID_GAUSSIAN_REDUCED)
{
status = gridGenAreaUnstruct(gridID, area);
}
......
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