Commit 396adbf2 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

vertint: skip vars on surface level

parent 13b8c309
...@@ -84,13 +84,7 @@ int getLayerThickness(int genbounds, int index, int zaxisID, int nlev, double *w ...@@ -84,13 +84,7 @@ int getLayerThickness(int genbounds, int index, int zaxisID, int nlev, double *w
double *thickness = (double *) malloc(nlev*sizeof(double)); double *thickness = (double *) malloc(nlev*sizeof(double));
zaxisInqLevels(zaxisID, levels); zaxisInqLevels(zaxisID, levels);
if ( zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL) ) if ( genbounds )
{
status = 1;
zaxisInqLbounds(zaxisID, lbounds);
zaxisInqUbounds(zaxisID, ubounds);
}
else if ( genbounds )
{ {
status = 2; status = 2;
lbounds[0] = levels[0]; lbounds[0] = levels[0];
...@@ -102,6 +96,12 @@ int getLayerThickness(int genbounds, int index, int zaxisID, int nlev, double *w ...@@ -102,6 +96,12 @@ int getLayerThickness(int genbounds, int index, int zaxisID, int nlev, double *w
ubounds[i] = bound; ubounds[i] = bound;
} }
} }
else if ( zaxisInqLbounds(zaxisID, NULL) && zaxisInqUbounds(zaxisID, NULL) )
{
status = 1;
zaxisInqLbounds(zaxisID, lbounds);
zaxisInqUbounds(zaxisID, ubounds);
}
else else
{ {
for ( i = 0; i < nlev; ++i ) for ( i = 0; i < nlev; ++i )
...@@ -287,20 +287,21 @@ void *Vertstat(void *argument) ...@@ -287,20 +287,21 @@ void *Vertstat(void *argument)
zaxisID = vars1[varID].zaxis; zaxisID = vars1[varID].zaxis;
double vweight = 1.0; double vweight = 1.0;
// if ( operatorID == VERTINT && !IS_SURFACE_LEVEL(zaxisID) ) if ( operatorID == VERTINT && !IS_SURFACE_LEVEL(zaxisID) )
if ( operatorID == VERTINT )
{ {
for ( int index = 0; index < nzaxis; ++index ) for ( int index = 0; index < nzaxis; ++index )
if ( vert[index].zaxisID == zaxisID ) if ( vert[index].zaxisID == zaxisID )
{ {
vweight = vert[index].weights[levelID];
if ( vert[index].status == 0 && tsID == 0 && levelID == 0 ) if ( vert[index].status == 0 && tsID == 0 && levelID == 0 )
{ {
char varname[CDI_MAX_NAME]; char varname[CDI_MAX_NAME];
vlistInqVarName(vlistID1, varID, varname); vlistInqVarName(vlistID1, varID, varname);
cdoWarning("Using constant vertical weights for variable %s!", varname); cdoWarning("Using constant vertical weights for variable %s!", varname);
} }
else
{
vweight = vert[index].weights[levelID];
}
break; break;
} }
...@@ -334,7 +335,7 @@ void *Vertstat(void *argument) ...@@ -334,7 +335,7 @@ void *Vertstat(void *argument)
field.grid = vars1[varID].grid; field.grid = vars1[varID].grid;
field.missval = vars1[varID].missval; field.missval = vars1[varID].missval;
if ( vweight < 1.e30 ) farcmul(&field, vweight); if ( operatorID == VERTINT && IS_NOT_EQUAL(vweight, 1.0) ) farcmul(&field, vweight);
if ( field.nmiss > 0 || samp1[varID].ptr ) if ( field.nmiss > 0 || samp1[varID].ptr )
{ {
......
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