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

Replace std::vector<std::array> by cdoVlistInqVarName().

parent d3d42918
......@@ -171,15 +171,11 @@ void *Vertintap(void *argument)
if ( cdoVerbose )
{
std::vector<std::array<char, CDI_MAX_NAME>> varNames(nvars);
for ( varID = 0; varID < nvars; varID++ )
vlistInqVarName(vlistID1, varID, &varNames[varID][0]);
cdoPrint("Found:");
if ( psID != -1 ) cdoPrint(" %s -> %s", var_stdname(surface_air_pressure), &varNames[psID][0]);
if ( apressID != -1 ) cdoPrint(" %s -> %s", var_stdname(air_pressure), &varNames[apressID][0]);
if ( dpressID != -1 ) cdoPrint(" %s -> %s", var_stdname(pressure_thickness), &varNames[dpressID][0]);
if ( tempID != -1 ) cdoPrint(" %s -> %s", var_stdname(air_temperature), &varNames[tempID][0]);
if ( psID != -1 ) cdoPrint(" %s -> %s", var_stdname(surface_air_pressure), cdoVlistInqVarName(vlistID1, psID, varname));
if ( apressID != -1 ) cdoPrint(" %s -> %s", var_stdname(air_pressure), cdoVlistInqVarName(vlistID1, apressID, varname));
if ( dpressID != -1 ) cdoPrint(" %s -> %s", var_stdname(pressure_thickness), cdoVlistInqVarName(vlistID1, dpressID, varname));
if ( tempID != -1 ) cdoPrint(" %s -> %s", var_stdname(air_temperature), cdoVlistInqVarName(vlistID1, tempID, varname));
}
if ( apressID == -1 ) cdoAbort("%s not found!", var_stdname(air_pressure));
......
......@@ -383,17 +383,13 @@ void *Vertintml(void *argument)
if ( cdoVerbose )
{
std::vector<std::array<char, CDI_MAX_NAME>> varNames(nvars);
for ( varID = 0; varID < nvars; varID++ )
vlistInqVarName(vlistID1, varID, &varNames[varID][0]);
cdoPrint("Found:");
if ( tempID != -1 ) cdoPrint(" %s -> %s", var_stdname(air_temperature), &varNames[tempID][0]);
if ( psID != -1 ) cdoPrint(" %s -> %s", var_stdname(surface_air_pressure), &varNames[psID][0]);
if ( lnpsID != -1 ) cdoPrint(" LOG(%s) -> %s", var_stdname(surface_air_pressure), &varNames[lnpsID][0]);
if ( sgeopotID != -1 ) cdoPrint(" %s -> %s", var_stdname(surface_geopotential), &varNames[sgeopotID][0]);
if ( geopotID != -1 ) cdoPrint(" %s -> %s", var_stdname(geopotential), &varNames[geopotID][0]);
if ( gheightID != -1 ) cdoPrint(" %s -> %s", var_stdname(geopotential_height), &varNames[gheightID][0]);
if ( tempID != -1 ) cdoPrint(" %s -> %s", var_stdname(air_temperature), cdoVlistInqVarName(vlistID1, tempID, varname));
if ( psID != -1 ) cdoPrint(" %s -> %s", var_stdname(surface_air_pressure), cdoVlistInqVarName(vlistID1, psID, varname));
if ( lnpsID != -1 ) cdoPrint(" LOG(%s) -> %s", var_stdname(surface_air_pressure), cdoVlistInqVarName(vlistID1, lnpsID, varname));
if ( sgeopotID != -1 ) cdoPrint(" %s -> %s", var_stdname(surface_geopotential), cdoVlistInqVarName(vlistID1, sgeopotID, varname));
if ( geopotID != -1 ) cdoPrint(" %s -> %s", var_stdname(geopotential), cdoVlistInqVarName(vlistID1, geopotID, varname));
if ( gheightID != -1 ) cdoPrint(" %s -> %s", var_stdname(geopotential_height), cdoVlistInqVarName(vlistID1, gheightID, varname));
}
if ( tempID != -1 || gheightID != -1 ) sgeopot_needed = true;
......
......@@ -179,6 +179,7 @@ int literal_get_datatype(const char *literal);
int literal_to_int(const char *literal);
double literal_to_double(const char *literal);
char *cdoVlistInqVarName(int vlistID, int varID, char *name);
#ifdef __cplusplus
extern "C" {
......
......@@ -19,9 +19,16 @@
#include "cdo_int.h"
char *cdoVlistInqVarName(int vlistID, int varID, char *name)
{
vlistInqVarName(vlistID, varID, name);
return name;
}
double cdoZaxisInqLevel(int zaxisID, int levelID)
{
int zaxistype = zaxisInqType(zaxisID);
int zaxistype = zaxisInqType(zaxisID);
double level = zaxisInqLevels(zaxisID, NULL) ? zaxisInqLevel(zaxisID, levelID) :
(zaxistype == ZAXIS_SURFACE) ? 0 : levelID+1;
return level;
......
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