Commit 8e3a40b2 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

vertintap: removed dpress.

parent 0236f406
......@@ -76,8 +76,7 @@ void *Vertintap(void *argument)
char stdname[CDI_MAX_NAME];
char varname[CDI_MAX_NAME];
double *vct = NULL;
double *ps_prog = NULL, *full_press = NULL, *dpress = NULL;
double *hyb_press = NULL;
double *ps_prog = NULL, *full_press = NULL;
bool extrapolate = false;
lista_t *flista = lista_new(FLT_LISTA);
......@@ -229,7 +228,7 @@ void *Vertintap(void *argument)
int maxlev = nhlevh > nplev ? nhlevh : nplev;
int *pnmiss = extrapolate ? (int *) Malloc(nplev*sizeof(int)) : NULL;
int *pnmiss = extrapolate ? NULL : (int *) Malloc(nplev*sizeof(int));
// check levels
if ( zaxisIDh != -1 )
......@@ -256,7 +255,6 @@ void *Vertintap(void *argument)
vert_index = (int *) Malloc(gridsize*nplev*sizeof(int));
ps_prog = (double *) Malloc(gridsize*sizeof(double));
full_press = (double *) Malloc(gridsize*nhlevf*sizeof(double));
dpress = (double *) Malloc(gridsize*nhlevf*sizeof(double));
}
else
cdoWarning("No 3D variable with generalized height level found!");
......@@ -308,7 +306,7 @@ void *Vertintap(void *argument)
}
}
if ( zaxisIDh != -1 && psID == -1 && dpressID )
if ( zaxisIDh != -1 && psID == -1 && dpressID != -1 )
cdoWarning("Surface pressure not found - set to vertical sum of %s!", var_stdname(pressure_thickness));
// cdoWarning("Surface pressure not found - set to upper level of %s!", var_stdname(air_pressure));
......@@ -350,7 +348,6 @@ void *Vertintap(void *argument)
*/
size_t offset = gridsize*levelID;
double *single1 = vardata1[varID] + offset;
pstreamReadRecord(streamID1, single1, &varnmiss[varID][levelID]);
vars[varID] = true;
......@@ -367,11 +364,10 @@ void *Vertintap(void *argument)
}
else if ( dpressID != -1 )
{
memcpy(dpress, vardata1[dpressID], gridsize*nhlevf*sizeof(double));
for ( i = 0; i < gridsize; i++ ) ps_prog[i] = 0;
for ( int k = 0; k < nhlevf; ++k )
for ( i = 0; i < gridsize; i++ )
ps_prog[i] += dpress[k*gridsize+i];
ps_prog[i] += vardata1[dpressID][k*gridsize+i];
}
else
{
......@@ -405,15 +401,13 @@ void *Vertintap(void *argument)
{
if ( vars[varID] )
{
int zaxisID = vlistInqVarZaxis(vlistID1, varID);
int nlevel = zaxisInqSize(zaxisID);
double missval = vlistInqVarMissval(vlistID1, varID);
int zaxisID = vlistInqVarZaxis(vlistID1, varID);
int nlevel = zaxisInqSize(zaxisID);
double missval = vlistInqVarMissval(vlistID1, varID);
if ( varinterp[varID] )
{
if ( nlevel == nhlevf )
{
hyb_press = full_press;
}
double *hyb_press = NULL;
if ( nlevel == nhlevf ) hyb_press = full_press;
else
{
int param = vlistInqVarParam(vlistID1, varID);
......@@ -467,7 +461,6 @@ void *Vertintap(void *argument)
if ( ps_prog ) Free(ps_prog);
if ( vert_index ) Free(vert_index);
if ( full_press ) Free(full_press);
if ( dpress ) Free(dpress);
if ( vct ) Free(vct);
Free(vars);
......
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