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

outputcenter: support of zonal and meridional fields

parent da823214
......@@ -3,10 +3,11 @@
* using CDI library version 1.0.3
* New operator: intntime [request: Michael Boettinger]
* inttime: extention for months and years [request: Holger Goettel]
* outputcenter: support of zonal and meridional fields
* zonavg: bug fix for non gaussian or lonlat grids
* remaplib.sort_add: don't sort if num_links <= 1
* remaplib.remap_bi?: check that src_add is valid
* Remap: use REMAP_NON_GLOBAL only for gridsize > 1
* pstreamDefVlist: remove Read -> Write data-race on pstreamptr->vlistID
* Version 1.0.3 released
2006-09-18 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
No preview for this file type
......@@ -54,8 +54,4 @@ To interpolate this time series to a one hourly dataset, use:
@BeginVerbatim
cdo inttime,1987-01-01,12:00,1hour ifile ofile
@EndVerbatim
The same result with @oper{intntime}:
@BeginVerbatim
cdo intntime,6 ifile ofile
@EndVerbatim
@EndExample
......@@ -34,7 +34,7 @@
void *Filedes(void *argument)
{
int GRIDDES, ZAXISDES, VCT, VARDES, TAXISDES, FILEDES, VLIST, PARTAB;
int GRIDDES, GRIDDES2, ZAXISDES, VCT, VARDES, TAXISDES, FILEDES, VLIST, PARTAB;
int operatorID;
int streamID = 0;
int zaxisID;
......@@ -45,6 +45,7 @@ void *Filedes(void *argument)
cdoInitialize(argument);
GRIDDES = cdoOperatorAdd("griddes", 0, 0, NULL);
GRIDDES2 = cdoOperatorAdd("griddes2", 0, 0, NULL);
ZAXISDES = cdoOperatorAdd("zaxisdes", 0, 0, NULL);
TAXISDES = cdoOperatorAdd("taxisdes", 0, 0, NULL);
VCT = cdoOperatorAdd("vct", 0, 0, NULL);
......@@ -64,10 +65,12 @@ void *Filedes(void *argument)
ngrids = vlistNgrids(vlistID);
nzaxis = vlistNzaxis(vlistID);
if ( operatorID == GRIDDES )
if ( operatorID == GRIDDES || operatorID == GRIDDES2 )
{
int opt = 0;
if ( operatorID == GRIDDES ) opt = 1;
for ( index = 0; index < ngrids; index++ )
gridPrint(vlistGrid(vlistID, index));
gridPrint(vlistGrid(vlistID, index), opt);
}
else if ( operatorID == ZAXISDES )
{
......
......@@ -18,13 +18,13 @@
/*
This module contains the following operators:
Gradsdes gradsdes GrADS data descriptor file
Gradsdes gradsdes1 GrADS data descriptor file (version 1 map)
Gradsdes gradsdes2 GrADS data descriptor file (version 2 map)
*/
#if defined (HAVE_CONFIG_H)
# include "config.h"
# include "config.h" /* VERSION */
#endif
#include <string.h>
......@@ -533,7 +533,7 @@ void *Gradsdes(void *argument)
gdp = fopen(ctlfile, "w");
if ( gdp == NULL ) cdoAbort("Open failed on %s", ctlfile);
fprintf(gdp, "* Generated automatically by cdo version %s\n", VERSION);
fprintf(gdp, "* Generated automatically by CDO version %s\n", VERSION);
fprintf(gdp, "*\n");
/* DSET */
......
......@@ -41,6 +41,7 @@ cdo_SOURCES = Arith.c \
Mergegrid.c \
Mergetime.c \
Merstat.c \
Mrotuv.c \
Ninfo.c \
Nmltest.c \
Output.c \
......
......@@ -121,6 +121,7 @@ cdo_SOURCES = Arith.c \
Mergegrid.c \
Mergetime.c \
Merstat.c \
Mrotuv.c \
Ninfo.c \
Nmltest.c \
Output.c \
......@@ -266,38 +267,39 @@ am_cdo_OBJECTS = Arith.$(OBJEXT) Arithc.$(OBJEXT) Arithdays.$(OBJEXT) \
Intntime.$(OBJEXT) Intyear.$(OBJEXT) Invert.$(OBJEXT) \
Maskbox.$(OBJEXT) Mastrfu.$(OBJEXT) Math.$(OBJEXT) \
Merge.$(OBJEXT) Mergegrid.$(OBJEXT) Mergetime.$(OBJEXT) \
Merstat.$(OBJEXT) Ninfo.$(OBJEXT) Nmltest.$(OBJEXT) \
Output.$(OBJEXT) Outputgmt.$(OBJEXT) Pinfo.$(OBJEXT) \
Remap.$(OBJEXT) Replace.$(OBJEXT) Rotuv.$(OBJEXT) \
Runstat.$(OBJEXT) Seasstat.$(OBJEXT) Selbox.$(OBJEXT) \
Select.$(OBJEXT) Seloperator.$(OBJEXT) Selrec.$(OBJEXT) \
Selstat.$(OBJEXT) Seltime.$(OBJEXT) Set.$(OBJEXT) \
Setbox.$(OBJEXT) Setgatt.$(OBJEXT) Setgrid.$(OBJEXT) \
Sethalo.$(OBJEXT) Setmiss.$(OBJEXT) Setrcaname.$(OBJEXT) \
Settime.$(OBJEXT) Setzaxis.$(OBJEXT) Showinfo.$(OBJEXT) \
Sinfo.$(OBJEXT) Sort.$(OBJEXT) Specinfo.$(OBJEXT) \
Spectral.$(OBJEXT) Split.$(OBJEXT) Splitrec.$(OBJEXT) \
Splittime.$(OBJEXT) Splityear.$(OBJEXT) Subtrend.$(OBJEXT) \
Templates.$(OBJEXT) Test.$(OBJEXT) Timsort.$(OBJEXT) \
Timstat.$(OBJEXT) Trend.$(OBJEXT) Trms.$(OBJEXT) \
Vardup.$(OBJEXT) Vargen.$(OBJEXT) Varrms.$(OBJEXT) \
Vertint.$(OBJEXT) Vertstat.$(OBJEXT) Wind.$(OBJEXT) \
Writegrid.$(OBJEXT) Writerandom.$(OBJEXT) Ydaystat.$(OBJEXT) \
Ymonarith.$(OBJEXT) Ymonstat.$(OBJEXT) Yseasstat.$(OBJEXT) \
Zonstat.$(OBJEXT) cdilib.$(OBJEXT) commandline.$(OBJEXT) \
exception.$(OBJEXT) expr_yacc.$(OBJEXT) expr_lex.$(OBJEXT) \
expr.$(OBJEXT) cdo.$(OBJEXT) cdo_pthread.$(OBJEXT) \
cdo_vlist.$(OBJEXT) field.$(OBJEXT) fieldc.$(OBJEXT) \
field2.$(OBJEXT) fieldmer.$(OBJEXT) fieldzon.$(OBJEXT) \
grid.$(OBJEXT) history.$(OBJEXT) institution.$(OBJEXT) \
interpol.$(OBJEXT) job.$(OBJEXT) modules.$(OBJEXT) \
namelist.$(OBJEXT) normal.$(OBJEXT) pipe.$(OBJEXT) \
process.$(OBJEXT) remaplib.$(OBJEXT) timer.$(OBJEXT) \
realtime.$(OBJEXT) pstream.$(OBJEXT) table.$(OBJEXT) \
userlog.$(OBJEXT) util.$(OBJEXT) legendre.$(OBJEXT) \
fourier.$(OBJEXT) specspace.$(OBJEXT) readline.$(OBJEXT) \
julian.$(OBJEXT) vinterp.$(OBJEXT) zaxis.$(OBJEXT) \
pthread_debug.$(OBJEXT) color.$(OBJEXT) list.$(OBJEXT)
Merstat.$(OBJEXT) Mrotuv.$(OBJEXT) Ninfo.$(OBJEXT) \
Nmltest.$(OBJEXT) Output.$(OBJEXT) Outputgmt.$(OBJEXT) \
Pinfo.$(OBJEXT) Remap.$(OBJEXT) Replace.$(OBJEXT) \
Rotuv.$(OBJEXT) Runstat.$(OBJEXT) Seasstat.$(OBJEXT) \
Selbox.$(OBJEXT) Select.$(OBJEXT) Seloperator.$(OBJEXT) \
Selrec.$(OBJEXT) Selstat.$(OBJEXT) Seltime.$(OBJEXT) \
Set.$(OBJEXT) Setbox.$(OBJEXT) Setgatt.$(OBJEXT) \
Setgrid.$(OBJEXT) Sethalo.$(OBJEXT) Setmiss.$(OBJEXT) \
Setrcaname.$(OBJEXT) Settime.$(OBJEXT) Setzaxis.$(OBJEXT) \
Showinfo.$(OBJEXT) Sinfo.$(OBJEXT) Sort.$(OBJEXT) \
Specinfo.$(OBJEXT) Spectral.$(OBJEXT) Split.$(OBJEXT) \
Splitrec.$(OBJEXT) Splittime.$(OBJEXT) Splityear.$(OBJEXT) \
Subtrend.$(OBJEXT) Templates.$(OBJEXT) Test.$(OBJEXT) \
Timsort.$(OBJEXT) Timstat.$(OBJEXT) Trend.$(OBJEXT) \
Trms.$(OBJEXT) Vardup.$(OBJEXT) Vargen.$(OBJEXT) \
Varrms.$(OBJEXT) Vertint.$(OBJEXT) Vertstat.$(OBJEXT) \
Wind.$(OBJEXT) Writegrid.$(OBJEXT) Writerandom.$(OBJEXT) \
Ydaystat.$(OBJEXT) Ymonarith.$(OBJEXT) Ymonstat.$(OBJEXT) \
Yseasstat.$(OBJEXT) Zonstat.$(OBJEXT) cdilib.$(OBJEXT) \
commandline.$(OBJEXT) exception.$(OBJEXT) expr_yacc.$(OBJEXT) \
expr_lex.$(OBJEXT) expr.$(OBJEXT) cdo.$(OBJEXT) \
cdo_pthread.$(OBJEXT) cdo_vlist.$(OBJEXT) field.$(OBJEXT) \
fieldc.$(OBJEXT) field2.$(OBJEXT) fieldmer.$(OBJEXT) \
fieldzon.$(OBJEXT) grid.$(OBJEXT) history.$(OBJEXT) \
institution.$(OBJEXT) interpol.$(OBJEXT) job.$(OBJEXT) \
modules.$(OBJEXT) namelist.$(OBJEXT) normal.$(OBJEXT) \
pipe.$(OBJEXT) process.$(OBJEXT) remaplib.$(OBJEXT) \
timer.$(OBJEXT) realtime.$(OBJEXT) pstream.$(OBJEXT) \
table.$(OBJEXT) userlog.$(OBJEXT) util.$(OBJEXT) \
legendre.$(OBJEXT) fourier.$(OBJEXT) specspace.$(OBJEXT) \
readline.$(OBJEXT) julian.$(OBJEXT) vinterp.$(OBJEXT) \
zaxis.$(OBJEXT) pthread_debug.$(OBJEXT) color.$(OBJEXT) \
list.$(OBJEXT)
cdo_OBJECTS = $(am_cdo_OBJECTS)
cdo_DEPENDENCIES =
cdo_LDFLAGS =
......@@ -327,49 +329,50 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/Maskbox.Po ./$(DEPDIR)/Mastrfu.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Math.Po ./$(DEPDIR)/Merge.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Mergegrid.Po ./$(DEPDIR)/Mergetime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Merstat.Po ./$(DEPDIR)/Ninfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Nmltest.Po ./$(DEPDIR)/Output.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Outputgmt.Po ./$(DEPDIR)/Pinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Remap.Po ./$(DEPDIR)/Replace.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Rotuv.Po ./$(DEPDIR)/Runstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Seasstat.Po ./$(DEPDIR)/Selbox.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Select.Po ./$(DEPDIR)/Seloperator.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Selrec.Po ./$(DEPDIR)/Selstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Seltime.Po ./$(DEPDIR)/Set.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setbox.Po ./$(DEPDIR)/Setgatt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setgrid.Po ./$(DEPDIR)/Sethalo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setmiss.Po ./$(DEPDIR)/Setrcaname.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Settime.Po ./$(DEPDIR)/Setzaxis.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Showinfo.Po ./$(DEPDIR)/Sinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Sort.Po ./$(DEPDIR)/Specinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Spectral.Po ./$(DEPDIR)/Split.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Splitrec.Po ./$(DEPDIR)/Splittime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Splityear.Po ./$(DEPDIR)/Subtrend.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Templates.Po ./$(DEPDIR)/Test.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Timsort.Po ./$(DEPDIR)/Timstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Trend.Po ./$(DEPDIR)/Trms.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vardup.Po ./$(DEPDIR)/Vargen.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Varrms.Po ./$(DEPDIR)/Vertint.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vertstat.Po ./$(DEPDIR)/Wind.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Writegrid.Po ./$(DEPDIR)/Writerandom.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ydaystat.Po ./$(DEPDIR)/Ymonarith.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ymonstat.Po ./$(DEPDIR)/Yseasstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Zonstat.Po ./$(DEPDIR)/cdilib.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdo.Po ./$(DEPDIR)/cdo_pthread.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdo_vlist.Po ./$(DEPDIR)/color.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/commandline.Po ./$(DEPDIR)/exception.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/expr.Po ./$(DEPDIR)/expr_lex.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/expr_yacc.Po ./$(DEPDIR)/field.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/field2.Po ./$(DEPDIR)/fieldc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fieldmer.Po ./$(DEPDIR)/fieldzon.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fourier.Po ./$(DEPDIR)/grid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/history.Po ./$(DEPDIR)/institution.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/interpol.Po ./$(DEPDIR)/job.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/julian.Po ./$(DEPDIR)/legendre.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/list.Po ./$(DEPDIR)/modules.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/namelist.Po ./$(DEPDIR)/normal.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pipe.Po ./$(DEPDIR)/process.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pstream.Po ./$(DEPDIR)/pthread_debug.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Merstat.Po ./$(DEPDIR)/Mrotuv.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ninfo.Po ./$(DEPDIR)/Nmltest.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Output.Po ./$(DEPDIR)/Outputgmt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Pinfo.Po ./$(DEPDIR)/Remap.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Replace.Po ./$(DEPDIR)/Rotuv.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Runstat.Po ./$(DEPDIR)/Seasstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Selbox.Po ./$(DEPDIR)/Select.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Seloperator.Po ./$(DEPDIR)/Selrec.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Selstat.Po ./$(DEPDIR)/Seltime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Set.Po ./$(DEPDIR)/Setbox.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setgatt.Po ./$(DEPDIR)/Setgrid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Sethalo.Po ./$(DEPDIR)/Setmiss.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setrcaname.Po ./$(DEPDIR)/Settime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Setzaxis.Po ./$(DEPDIR)/Showinfo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Sinfo.Po ./$(DEPDIR)/Sort.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Specinfo.Po ./$(DEPDIR)/Spectral.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Split.Po ./$(DEPDIR)/Splitrec.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Splittime.Po ./$(DEPDIR)/Splityear.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Subtrend.Po ./$(DEPDIR)/Templates.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Test.Po ./$(DEPDIR)/Timsort.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Timstat.Po ./$(DEPDIR)/Trend.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Trms.Po ./$(DEPDIR)/Vardup.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vargen.Po ./$(DEPDIR)/Varrms.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Vertint.Po ./$(DEPDIR)/Vertstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Wind.Po ./$(DEPDIR)/Writegrid.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Writerandom.Po ./$(DEPDIR)/Ydaystat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Ymonarith.Po ./$(DEPDIR)/Ymonstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/Yseasstat.Po ./$(DEPDIR)/Zonstat.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdilib.Po ./$(DEPDIR)/cdo.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/cdo_pthread.Po ./$(DEPDIR)/cdo_vlist.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/color.Po ./$(DEPDIR)/commandline.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/exception.Po ./$(DEPDIR)/expr.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/expr_lex.Po ./$(DEPDIR)/expr_yacc.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/field.Po ./$(DEPDIR)/field2.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fieldc.Po ./$(DEPDIR)/fieldmer.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/fieldzon.Po ./$(DEPDIR)/fourier.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/grid.Po ./$(DEPDIR)/history.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/institution.Po ./$(DEPDIR)/interpol.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/job.Po ./$(DEPDIR)/julian.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/legendre.Po ./$(DEPDIR)/list.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/modules.Po ./$(DEPDIR)/namelist.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/normal.Po ./$(DEPDIR)/pipe.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/process.Po ./$(DEPDIR)/pstream.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/pthread_debug.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/readline.Po ./$(DEPDIR)/realtime.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/remaplib.Po ./$(DEPDIR)/specspace.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/table.Po ./$(DEPDIR)/timer.Po \
......@@ -484,6 +487,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mergegrid.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mergetime.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Merstat.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Mrotuv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Ninfo.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Nmltest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Output.Po@am__quote@
......
......@@ -29,6 +29,9 @@
- outputboundscpt:
*/
#if defined (HAVE_CONFIG_H)
# include "config.h" /* VERSION */
#endif
#include "cdi.h"
#include "cdo.h"
......@@ -43,9 +46,9 @@ void *Outputgmt(void *argument)
int OUTPUTCENTER, OUTPUTBOUNDS, OUTPUTBOUNDSCPT;
int operatorID;
int i;
int varID, recID;
int varID0, varID, recID;
int gridsize = 0;
int gridID, gridID0 = -1, code;
int gridID, code;
int nrecs;
int levelID;
int tsID;
......@@ -53,6 +56,7 @@ void *Outputgmt(void *argument)
int vlistID;
int nmiss;
int nlon, nlat, nalloc;
int nlev, lzon = FALSE, lmer = FALSE;
int gridcorners = 0, ic;
int status;
int lgrid_gen_bounds = FALSE, luse_grid_corner = FALSE;
......@@ -101,7 +105,87 @@ void *Outputgmt(void *argument)
vlistID = streamInqVlist(streamID);
taxisID = vlistInqTaxis(vlistID);
gridsize = vlistGridsizeMax(vlistID);
varID = 0;
vlistInqVarName(vlistID, varID, varname);
code = vlistInqVarCode(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
missval = vlistInqVarMissval(vlistID, varID);
if ( gridInqType(gridID) != GRID_LONLAT &&
gridInqType(gridID) != GRID_GAUSSIAN &&
gridInqType(gridID) != GRID_GME &&
gridInqType(gridID) != GRID_CURVILINEAR &&
gridInqType(gridID) != GRID_CELL )
cdoAbort("Output of %s data failed!", gridNamePtr(gridInqType(gridID)));
if ( gridInqType(gridID) != GRID_CELL && gridInqType(gridID) != GRID_CURVILINEAR )
{
if ( gridInqType(gridID) == GRID_GME )
{
gridID = gridToCell(gridID);
}
else
{
gridID = gridToCurvilinear(gridID);
lgrid_gen_bounds = TRUE;
}
}
gridsize = gridInqSize(gridID);
nlon = gridInqXsize(gridID);
nlat = gridInqYsize(gridID);
nlev = zaxisInqSize(zaxisID);
if ( gridInqType(gridID) == GRID_CELL )
{
if ( nlon == 1 && nlat > 1 && nlev > 1 ) lzon = TRUE;
if ( nlon > 1 && nlat == 1 && nlev > 1 ) lmer = TRUE;
}
if ( cdoVerbose && lzon ) cdoPrint("Process zonal data");
if ( cdoVerbose && lmer ) cdoPrint("Process meridional data");
if ( lzon || lmer )
{
if ( operatorID == OUTPUTBOUNDS || operatorID == OUTPUTBOUNDSCPT )
cdoAbort("Bounds not available for zonal/meridional data!");
}
if ( gridInqType(gridID) == GRID_CELL )
gridcorners = gridInqNvertex(gridID);
else
gridcorners = 4;
grid_center_lat = (double *) realloc(grid_center_lat, gridsize*sizeof(double));
grid_center_lon = (double *) realloc(grid_center_lon, gridsize*sizeof(double));
gridInqYvals(gridID, grid_center_lat);
gridInqXvals(gridID, grid_center_lon);
if ( luse_grid_corner )
{
if ( gridcorners == 0 ) cdoAbort("grid corner missing!");
nalloc = gridcorners*gridsize;
grid_corner_lat = (double *) realloc(grid_corner_lat, nalloc*sizeof(double));
grid_corner_lon = (double *) realloc(grid_corner_lon, nalloc*sizeof(double));
if ( gridInqYbounds(gridID, NULL) && gridInqXbounds(gridID, NULL) )
{
gridInqYbounds(gridID, grid_corner_lat);
gridInqXbounds(gridID, grid_corner_lon);
}
else
{
if ( lgrid_gen_bounds )
{
genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon);
genYbounds(nlon, nlat, grid_center_lat, grid_corner_lat);
}
else
cdoAbort("grid corner missing!");
}
}
array = (double *) malloc(gridsize*sizeof(double));
......@@ -115,92 +199,28 @@ void *Outputgmt(void *argument)
decode_date(vdate, &year, &month, &day);
decode_time(vtime, &hour, &minute);
fprintf(stdout, "# Generated by CDO version %s\n", VERSION);
fprintf(stdout, "#\n");
fprintf(stdout, "# File = %s\n", cdoStreamName(0));
fprintf(stdout, "# Date = %4.4d-%2.2d-%2.2d\n", year, month, day);
fprintf(stdout, "# Time = %2.2d:%2.2d\n", hour, minute);
fprintf(stdout, "# Name = %s\n", varname);
fprintf(stdout, "# Code = %d\n", code);
varID0 = varID;
for ( recID = 0; recID < nrecs; recID++ )
{
streamInqRecord(streamID, &varID, &levelID);
if ( recID > 0 ) continue;
vlistInqVarName(vlistID, varID, varname);
code = vlistInqVarCode(vlistID, varID);
gridID = vlistInqVarGrid(vlistID, varID);
zaxisID = vlistInqVarZaxis(vlistID, varID);
missval = vlistInqVarMissval(vlistID, varID);
if ( varID != varID0 ) continue;
if ( recID > 0 && !lzon && !lmer ) continue;
level = zaxisInqLevel(zaxisID, levelID);
fprintf(stdout, "# File = %s\n", cdoStreamName(0));
fprintf(stdout, "# Name = %s\n", varname);
fprintf(stdout, "# Code = %d\n", code);
fprintf(stdout, "# Level = %g\n", level);
fprintf(stdout, "# Date = %4.4d-%2.2d-%2.2d\n", year, month, day);
fprintf(stdout, "# Time = %2.2d:%2.2d\n", hour, minute);
fprintf(stdout, "#\n");
if ( gridID != gridID0 )
{
gridID0 = gridID;
if ( gridInqType(gridID) != GRID_LONLAT &&
gridInqType(gridID) != GRID_GAUSSIAN &&
gridInqType(gridID) != GRID_GME &&
gridInqType(gridID) != GRID_CURVILINEAR &&
gridInqType(gridID) != GRID_CELL )
cdoAbort("Output of %s data failed!", gridNamePtr(gridInqType(gridID)));
if ( gridInqType(gridID) != GRID_CELL && gridInqType(gridID) != GRID_CURVILINEAR )
{
if ( gridInqType(gridID) == GRID_GME )
{
gridID = gridToCell(gridID);
}
else
{
gridID = gridToCurvilinear(gridID);
lgrid_gen_bounds = TRUE;
}
}
gridsize = gridInqSize(gridID);
nlon = gridInqXsize(gridID);
nlat = gridInqYsize(gridID);
if ( gridInqType(gridID) == GRID_CELL )
gridcorners = gridInqNvertex(gridID);
else
gridcorners = 4;
grid_center_lat = (double *) realloc(grid_center_lat, gridsize*sizeof(double));
grid_center_lon = (double *) realloc(grid_center_lon, gridsize*sizeof(double));
gridInqYvals(gridID, grid_center_lat);
gridInqXvals(gridID, grid_center_lon);
if ( luse_grid_corner )
{
if ( gridcorners == 0 ) cdoAbort("grid corner missing!");
nalloc = gridcorners*gridsize;
grid_corner_lat = (double *) realloc(grid_corner_lat, nalloc*sizeof(double));
grid_corner_lon = (double *) realloc(grid_corner_lon, nalloc*sizeof(double));
if ( gridInqYbounds(gridID, NULL) && gridInqXbounds(gridID, NULL) )
{
gridInqYbounds(gridID, grid_corner_lat);
gridInqXbounds(gridID, grid_corner_lon);
}
else
{
if ( lgrid_gen_bounds )
{
genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon);
genYbounds(nlon, nlat, grid_center_lat, grid_corner_lat);
}
else
cdoAbort("grid corner missing!");
}
}
}
streamReadRecord(streamID, array, &nmiss);
if ( operatorID == OUTPUTCENTER )
......@@ -208,9 +228,16 @@ void *Outputgmt(void *argument)
for ( i = 0; i < gridsize; i++ )
{
if ( !DBL_IS_EQUAL(array[i], missval) )
fprintf(stdout, " %g %g %g\n", grid_center_lon[i], grid_center_lat[i], array[i]);
{
if ( lzon )
fprintf(stdout, " %g %g %g\n", grid_center_lat[i], level, array[i]);
else if ( lmer )
fprintf(stdout, " %g %g %g\n", grid_center_lon[i], level, array[i]);
else
fprintf(stdout, " %g %g %g\n", grid_center_lon[i], grid_center_lat[i], array[i]);
}
}
fprintf(stdout, "\n");
fprintf(stdout, "#\n");
}
else if ( operatorID == OUTPUTBOUNDS || operatorID == OUTPUTBOUNDSCPT )
{
......
......@@ -87,7 +87,7 @@ void *Zonstat(void *argument)
gridID1 = vlistGrid(vlistID1, index);
if ( gridInqType(gridID1) != GRID_LONLAT &&
gridInqType(gridID1) != GRID_GAUSSIAN &&
(gridInqType(gridID1) == GRID_GENERIC && gridInqYsize(gridID1) <= 1) )
!(gridInqType(gridID1) == GRID_GENERIC && gridInqYsize(gridID1) <= 1) )
cdoAbort("Unsupported gridtype: %s", gridNamePtr(gridInqType(gridID1)));
gridID2 = gridToZonal(gridID1);
......
......@@ -365,7 +365,7 @@ void gridCompress(int gridID);
void gridDefMask(int gridID, int *mask);
int gridInqMask(int gridID, int *mask);
void gridPrint(int gridID);
void gridPrint(int gridID, int opt);
int gridSize(void);
/* gridCreate: Create a horizontal Grid */
......
......@@ -75,6 +75,7 @@ void *Merge(void *argument);
void *Mergegrid(void *argument);
void *Mergetime(void *argument);
void *Merstat(void *argument);
void *Mrotuv(void *argument);
void *Ninfo(void *argument);
void *Nmltest(void *argument);
void *Output(void *argument);
......@@ -151,7 +152,7 @@ void *Zonstat(void *argument);
#define EnlargegridOperators {"enlargegrid"}
#define EnsstatOperators {"ensmin", "ensmax", "enssum", "ensmean", "ensavg", "ensvar", "ensstd"}
#define ExprOperators {"expr", "exprf"}
#define FiledesOperators {"filedes", "griddes", "zaxisdes", "vct", "vardes", "taxisdes", "vlist", "partab"}
#define FiledesOperators {"filedes", "griddes", "griddes2", "zaxisdes", "vct", "vardes", "taxisdes", "vlist", "partab"}
#define FillmissOperators {"fillmiss"}
#define FldrmsOperators {"fldrms"}
#define FldstatOperators {"fldmin", "fldmax", "fldsum", "fldmean", "fldavg", "fldvar", "fldstd"}
......@@ -173,6 +174,7 @@ void *Zonstat(void *argument);
#define MergegridOperators {"mergegrid"}
#define MergetimeOperators {"mergetime"}
#define MerstatOperators {"mermin", "mermax", "mersum", "mermean", "meravg", "mervar", "merstd"}
#define MrotuvOperators {"mrotuvb"}
#define NinfoOperators {"nyear", "nmon", "ndate", "ntime", "ncode", "nvar", "nlevel"}
#define NmltestOperators {"nmltest"}
#define OutputOperators {"output", "outputint", "outputsrv", "outputext", "outputf", "outputts", "outputfld"}
......@@ -285,6 +287,7 @@ static MODULES Modules[] =
{ Mergegrid, NULL, MergegridOperators, 2, 1 },
{ Mergetime, MergeHelp, MergetimeOperators, -1, 1 },
{ Merstat, MerstatHelp, MerstatOperators, 1, 1 },
{ Mrotuv, NULL, MrotuvOperators, 2, 1 },
{ Ninfo, NinfoHelp, NinfoOperators, 1, 0 },
{ Nmltest, NULL, NmltestOperators, 0, 0 },
{ Output, OutputHelp, OutputOperators, -1, 0 },
......
......@@ -817,6 +817,8 @@ void pstreamDefVlist(int pstreamID, int vlistID)
if ( cdoTimer ) timer_start(timer_write);
streamDefVlist(pstreamptr->fileID, vlistID);
if ( cdoTimer ) timer_stop(timer_write);
pstreamptr->vlistID = vlistID; /* used for -r/-a */
}
}
......
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