Commit 984b8873 authored by Ralf Mueller's avatar Ralf Mueller
Browse files

[ngridpoints] add operators ngrid/ngridpoints incl. docu

parent ee80d041
......@@ -20,6 +20,8 @@ Operator catalog:
Ninfo nmon Number of months
Ninfo ndate Number of dates
Ninfo ntime Number of timesteps
Ninfo ngridpoints Number of gridpoints
Ninfo ngrids Number of horizontal grids
Showinfo showformat Show file format
Showinfo showcode Show code numbers
Showinfo showname Show variable names
......
......@@ -5,7 +5,7 @@
@Section = Information
@Class = Information
@Arguments = ifile
@Operators = npar nlevel nyear nmon ndate ntime
@Operators = npar nlevel nyear nmon ndate ntime ngridpoints ngrids
@BeginDescription
This module prints the number of variables, levels or times of the
......@@ -69,6 +69,24 @@ Prints the number of timesteps.
@EndOperator
@BeginOperator_ngridpoints
@Title = Number of gridpoints
@BeginDescription
Prints the number of gridpoints for each variable.
@EndDescription
@EndOperator
@BeginOperator_ngrids
@Title = Number of horizontal grids
@BeginDescription
Prints the number of horizontal grids.
@EndDescription
@EndOperator
@BeginExample
To print the number of parameters (variables) in a dataset use:
@BeginVerbatim
......
......@@ -24,6 +24,8 @@
Ninfo nmon Number of months
Ninfo ndate Number of dates
Ninfo ntime Number of timesteps
Ninfo ngridpoints Number of gridpoints
Ninfo ngrids Number of grids
*/
......@@ -35,13 +37,14 @@
void *Ninfo(void *argument)
{
enum {NYEAR, NMON, NDATE, NTIME, NPAR, NLEVEL};
enum {NYEAR, NMON, NDATE, NTIME, NPAR, NLEVEL, NGRIDPOINTS, NGRIDS};
int operatorID;
int operfunc;
int varID, zaxisID;
int varID, zaxisID, gridID;
int vdate;
int nrecs, nvars, ntsteps;
int nrecs, nvars, ntsteps, ngrids;
int levelsize;
int gridsize;
int tsID, ndate, date0 = 0;
int day, mon0 = 0, mon, nmon, year0 = 0, year, nyear;
int taxisID;
......@@ -50,12 +53,14 @@ void *Ninfo(void *argument)
cdoInitialize(argument);
cdoOperatorAdd("nyear", NYEAR, 0, NULL);
cdoOperatorAdd("nmon", NMON, 0, NULL);
cdoOperatorAdd("ndate", NDATE, 0, NULL);
cdoOperatorAdd("ntime", NTIME, 0, NULL);
cdoOperatorAdd("npar", NPAR, 0, NULL);
cdoOperatorAdd("nlevel", NLEVEL, 0, NULL);
cdoOperatorAdd("nyear" , NYEAR , 0 , NULL);
cdoOperatorAdd("nmon" , NMON , 0 , NULL);
cdoOperatorAdd("ndate" , NDATE , 0 , NULL);
cdoOperatorAdd("ntime" , NTIME , 0 , NULL);
cdoOperatorAdd("npar" , NPAR , 0 , NULL);
cdoOperatorAdd("nlevel" , NLEVEL , 0 , NULL);
cdoOperatorAdd("ngridpoints" , NGRIDPOINTS , 0 , NULL);
cdoOperatorAdd("ngrids" , NGRIDS , 0 , NULL);
operatorID = cdoOperatorID();
operfunc = cdoOperatorF1(operatorID);
......@@ -67,6 +72,7 @@ void *Ninfo(void *argument)
nvars = vlistNvars(vlistID);
taxisID = vlistInqTaxis(vlistID);
ntsteps = vlistNtsteps(vlistID);
ngrids = vlistNgrids(vlistID);
switch ( operfunc )
{
......@@ -145,6 +151,17 @@ void *Ninfo(void *argument)
fprintf(stdout, "%d\n", levelsize);
}
break;
case NGRIDPOINTS:
for ( varID = 0; varID < nvars; varID++ )
{
gridID = vlistInqVarGrid(vlistID, varID);
gridsize = gridInqSize(gridID);
fprintf(stdout, "%d\n", gridsize);
}
break;
case NGRIDS:
fprintf(stdout, "%d\n", ngrids);
break;
default:
cdoAbort("operator not implemented!");
break;
......
......@@ -366,7 +366,7 @@ void *Maggraph(void *argument);
#define MonarithOperators {"monadd", "monsub", "monmul", "mondiv"}
#define MrotuvOperators {"mrotuv"}
#define MrotuvbOperators {"mrotuvb"}
#define NinfoOperators {"nyear", "nmon", "ndate", "ntime", "ncode", "npar", "nlevel"}
#define NinfoOperators {"nyear", "nmon", "ndate", "ntime", "ncode", "npar", "nlevel", "ngridpoints", "ngrids"}
#define NmltestOperators {"nmltest"}
#define OutputOperators {"output", "outputint", "outputsrv", "outputext", "outputf", "outputts", \
"outputfld", "outputarr", "outputxyz"}
......
......@@ -95,7 +95,7 @@ static const char *DiffHelp[] = {
static const char *NinfoHelp[] = {
"NAME",
" npar, nlevel, nyear, nmon, ndate, ntime - ",
" npar, nlevel, nyear, nmon, ndate, ntime, ngridpoints, ngrids - ",
" Print the number of parameters, levels or times",
"",
"SYNOPSIS",
......@@ -106,18 +106,22 @@ static const char *NinfoHelp[] = {
" input dataset.",
"",
"OPERATORS",
" npar Number of parameters",
" Prints the number of parameters (variables).",
" nlevel Number of levels",
" Prints the number of levels for each variable.",
" nyear Number of years",
" Prints the number of different years.",
" nmon Number of months",
" Prints the number of different combinations of years and months.",
" ndate Number of dates",
" Prints the number of different dates.",
" ntime Number of timesteps",
" Prints the number of timesteps.",
" npar Number of parameters",
" Prints the number of parameters (variables).",
" nlevel Number of levels",
" Prints the number of levels for each variable.",
" nyear Number of years",
" Prints the number of different years.",
" nmon Number of months",
" Prints the number of different combinations of years and months.",
" ndate Number of dates",
" Prints the number of different dates.",
" ntime Number of timesteps",
" Prints the number of timesteps.",
" ngridpoints Number of gridpoints",
" Prints the number of gridpoints for each variable.",
" ngrids Number of horizontal grids",
" Prints the number of horizontal grids.",
NULL
};
......
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