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

uv2dv: check for global Gaussian grids.

parent 7826b4b2
Pipeline #4444 passed with stages
in 16 minutes and 55 seconds
......@@ -190,26 +190,24 @@ Wind(void *process)
gridID1 = vlistInqVarGrid(vlistID1, varID1);
if (gridInqType(gridID1) != GRID_GAUSSIAN) cdoAbort("U-wind is not on Gaussian grid!");
if (gridID1 != vlistInqVarGrid(vlistID1, varID2)) cdoAbort("U and V wind must have the same grid represention!");
if (gridID1 != -1)
{
const long ntr1 = nlat2ntr(gridInqYsize(gridID1));
const auto numLPE = gridInqNP(gridID1);
const long nlon = gridInqXsize(gridID1);
const long nlat = gridInqYsize(gridID1);
const long ntr1 = nlat2ntr(nlat);
if (gridIDsp != -1)
if (ntr1 != gridInqTrunc(gridIDsp)) gridIDsp = -1;
if (nlat != (numLPE * 2)) cdoAbort("U and V fields on Gaussian grid are not global!");
if (gridIDsp == -1)
{
gridIDsp = gridCreate(GRID_SPECTRAL, (ntr1 + 1) * (ntr1 + 2));
gridDefTrunc(gridIDsp, ntr1);
gridDefComplexPacking(gridIDsp, 1);
}
}
if (gridIDsp != -1)
if (ntr1 != gridInqTrunc(gridIDsp)) gridIDsp = -1;
if (gridIDsp == -1 && gridInqType(vlistGrid(vlistID1, 0)) == GRID_GAUSSIAN_REDUCED)
cdoAbort("Gaussian reduced grid found. Use option -R to convert it to a regular grid!");
if (gridIDsp == -1)
{
gridIDsp = gridCreate(GRID_SPECTRAL, (ntr1 + 1) * (ntr1 + 2));
gridDefTrunc(gridIDsp, ntr1);
gridDefComplexPacking(gridIDsp, 1);
}
if (gridIDsp == -1) cdoAbort("No Gaussian grid data found!");
......@@ -217,8 +215,6 @@ Wind(void *process)
defineAttributesDV(vlistID2, gridID2, varID1, varID2);
const long nlon = gridInqXsize(gridID1);
const long nlat = gridInqYsize(gridID1);
ntr = gridInqTrunc(gridID2);
nlev = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID1));
......
......@@ -253,7 +253,7 @@ printGridNumPoints(int gridtype, int gridID, size_t gridsize, size_t xsize, size
else if (xsize && ysize)
fprintf(stdout, " (%zux%zu)", xsize, ysize);
const int numLPE = gridInqNP(gridID);
const auto numLPE = gridInqNP(gridID);
if (numLPE > 0)
{
if (gridtype == GRID_GAUSSIAN) fprintf(stdout, " F%d", numLPE);
......
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