Commit 4cc76609 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

vlistInqVarEnsemble: wrong return value (bug fix)

parent 8e6eaec9
......@@ -1744,63 +1744,33 @@ void vlistDefVarEnsemble(int vlistID, int varID, int ensID, int ensCount, int fo
vlistCheckVarID(__func__, vlistID, varID);
if ( vlistptr->vars[varID].ensdata == NULL )
vlistptr->vars[varID].ensdata = (ensinfo_t *) malloc( sizeof( ensinfo_t ) );
vlistptr->vars[varID].ensdata = (ensinfo_t *) malloc( sizeof( ensinfo_t ) );
vlistptr->vars[varID].ensdata->ens_index = ensID;
vlistptr->vars[varID].ensdata->ens_count = ensCount;
vlistptr->vars[varID].ensdata->forecast_init_type = forecast_type;
/*
int ens_index;
int ens_count;
int forecast_init_type;
*/
#ifdef DBG
if( DBG )
{
fprintf( stderr, "vlistDefVarEnsemble Inputs: \n EnsID %d\n Enscount %d\n Forecast init type %d\n", ensID,
ensCount, forecast_type );
fprintf( stderr, "vlistDefVarEnsemble outputs: \n EnsID %d\n Enscount %d\n Forecast init type %d\n",vlistptr->vars[varID].ensdata->ens_index,
vlistptr->vars[varID].ensdata->ens_count, vlistptr->vars[varID].ensdata->forecast_init_type );
}
#endif
}
int vlistInqVarEnsemble( int vlistID, int varID, int *ensID, int *ensCount, int *forecast_type )
{
vlist_t *vlistptr;
int status = 0;
vlistptr = vlist_to_pointer(vlistID);
vlistCheckVarID(__func__, vlistID, varID);
if( vlistptr->vars[varID].ensdata )
if ( vlistptr->vars[varID].ensdata )
{
*ensID = vlistptr->vars[varID].ensdata->ens_index;
*ensCount = vlistptr->vars[varID].ensdata->ens_count;
*forecast_type = vlistptr->vars[varID].ensdata->forecast_init_type;
}
else
return 1;
#ifdef DBG
if( DBG )
{
fprintf( stderr, "vlistInqVarEnsemble outputs: \n EnsID %d\n Enscount %d\n Forecast init type %d\n", *ensID,
*ensCount, *forecast_type );
/*
fprintf( stderr, " EnsID %d\n Enscount %d\n Forecast init type %d\n",vlistptr->vars[varID].ensdata->ens_index,
vlistptr->vars[varID].ensdata->ens_count, vlistptr->vars[varID].ensdata->forecast_init_type );
*/
status = 1;
}
#endif
return 0;
return (status);
}
......
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