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

select: select also ps for variables on hybrid sigma pressure levels

parent 6b880ad4
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
* using CDI library version 1.7.0 * using CDI library version 1.7.0
* Version 1.7.0 released * Version 1.7.0 released
2015-08-14 Uwe Schulzweida
* select: select also ps for variables on hybrid sigma pressure levels
2015-08-12 Uwe Schulzweida 2015-08-12 Uwe Schulzweida
* selmon: does not work with negative years (bug fix) [report: Tim Brcher] * selmon: does not work with negative years (bug fix) [report: Tim Brcher]
......
...@@ -464,6 +464,31 @@ void par_check_word_flag(int npar, char **parlist, int *flaglist, const char *tx ...@@ -464,6 +464,31 @@ void par_check_word_flag(int npar, char **parlist, int *flaglist, const char *tx
} }
int vlist_get_psvarid(int nvars, int vlistID, int zaxisID)
{
int psvarid = -1;
char name[CDI_MAX_NAME];
char psname[CDI_MAX_NAME];
psname[0] = 0;
zaxisInqPsName(zaxisID, psname);
if ( psname[0] )
{
for ( int varID = 0; varID < nvars; ++varID )
{
vlistInqVarName(vlistID, varID, name);
if ( strcmp(name, psname) == 0 )
{
psvarid = varID;
break;
}
}
}
return psvarid;
}
void *Select(void *argument) void *Select(void *argument)
{ {
int streamID2 = CDI_UNDEFID; int streamID2 = CDI_UNDEFID;
...@@ -473,13 +498,11 @@ void *Select(void *argument) ...@@ -473,13 +498,11 @@ void *Select(void *argument)
int varID2, levelID2; int varID2, levelID2;
int recID, varID, levelID; int recID, varID, levelID;
int iparam; int iparam;
int nsel;
int vdate, vtime; int vdate, vtime;
int last_year = -999999999; int last_year = -999999999;
char paramstr[32]; char paramstr[32];
char varname[CDI_MAX_NAME]; char varname[CDI_MAX_NAME];
char stdname[CDI_MAX_NAME]; char stdname[CDI_MAX_NAME];
char **argnames = NULL;
int vlistID0 = -1, vlistID2 = -1; int vlistID0 = -1, vlistID2 = -1;
int i; int i;
int result = FALSE; int result = FALSE;
...@@ -541,8 +564,8 @@ void *Select(void *argument) ...@@ -541,8 +564,8 @@ void *Select(void *argument)
operatorInputArg(cdoOperatorEnter(operatorID)); operatorInputArg(cdoOperatorEnter(operatorID));
nsel = operatorArgc(); int nsel = operatorArgc();
argnames = operatorArgv(); char **argnames = operatorArgv();
if ( cdoVerbose ) if ( cdoVerbose )
for ( i = 0; i < nsel; i++ ) for ( i = 0; i < nsel; i++ )
...@@ -688,6 +711,19 @@ void *Select(void *argument) ...@@ -688,6 +711,19 @@ void *Select(void *argument)
} }
} }
for ( varID = 0; varID < nvars; varID++ )
{
if ( vars[varID] )
{
zaxisID = vlistInqVarZaxis(vlistID1, varID);
if ( zaxisInqType(zaxisID) == ZAXIS_HYBRID )
{
int psvarid = vlist_get_psvarid(nvars, vlistID1, zaxisID);
if ( psvarid != -1 && !vars[psvarid] ) vars[psvarid] = TRUE;
}
}
}
for ( varID = 0; varID < nvars; varID++ ) for ( varID = 0; varID < nvars; varID++ )
{ {
if ( vars[varID] ) if ( vars[varID] )
......
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