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

gridWeights: warning with code number when using constant area weights

parent 665bfa13
......@@ -3,6 +3,7 @@
* using CDI library version 1.0.9
* Seltime: bug fix for input with time constant fields [report: Claas Teichmann]
* diff: check number of time steps
* gridWeights: warning with code number when using constant area weights
* Version 1.1.0 released
2007-10-29 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
......@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2006 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2007 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
......@@ -34,6 +34,8 @@ void *Fldrms(void *argument)
int streamID1, streamID2, streamID3;
int vlistID1, vlistID2, vlistID3;
int gridID1, gridID2, gridID3, lastgrid = -1;
int wstatus = FALSE;
int code = 0, oldcode = 0;
int index, ngrids;
int recID, nrecs;
int tsID, varID, levelID;
......@@ -129,11 +131,15 @@ void *Fldrms(void *argument)
field1.grid = vlistInqVarGrid(vlistID1, varID);
field2.grid = vlistInqVarGrid(vlistID2, varID);
if ( field1.grid != lastgrid )
if ( needWeights && field1.grid != lastgrid )
{
lastgrid = field1.grid;
if ( needWeights ) gridWeights(field1.grid, field1.weight);
wstatus = gridWeights(field1.grid, field1.weight);
}
code = vlistInqVarCode(vlistID1, varID);
if ( wstatus != 0 && tsID == 0 && code != oldcode )
cdoWarning("Using constant area weights for code %d!", oldcode=code);
field1.missval = vlistInqVarMissval(vlistID1, varID);
field2.missval = vlistInqVarMissval(vlistID1, varID);
field3.missval = vlistInqVarMissval(vlistID1, varID);
......
......@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2006 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2007 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
......@@ -44,6 +44,8 @@ void *Fldstat(void *argument)
int streamID1, streamID2;
int vlistID1, vlistID2;
int gridID2, lastgrid = -1;
int wstatus = FALSE;
int code = 0, oldcode = 0;
int index, ngrids;
int recID, nrecs;
int tsID, varID, levelID;
......@@ -140,8 +142,12 @@ void *Fldstat(void *argument)
if ( needWeights && field.grid != lastgrid )
{
lastgrid = field.grid;
if ( needWeights ) gridWeights(field.grid, field.weight);
wstatus = gridWeights(field.grid, field.weight);
}
code = vlistInqVarCode(vlistID1, varID);
if ( wstatus != 0 && tsID == 0 && code != oldcode )
cdoWarning("Using constant area weights for code %d!", oldcode=code);
field.missval = vlistInqVarMissval(vlistID1, varID);
/* RQ */
......
......@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2006 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2007 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
......@@ -44,6 +44,8 @@ void *Merstat(void *argument)
int streamID1, streamID2;
int vlistID1, vlistID2;
int gridID1, gridID2, lastgrid = -1;
int wstatus = FALSE;
int code = 0, oldcode = 0;
int nlonmax;
int index, ngrids;
int recID, nrecs;
......@@ -148,8 +150,12 @@ void *Merstat(void *argument)
if ( needWeights && field1.grid != lastgrid )
{
lastgrid = field1.grid;
gridWeights(field1.grid, field1.weight);
wstatus = gridWeights(field1.grid, field1.weight);
}
code = vlistInqVarCode(vlistID1, varID);
if ( wstatus != 0 && tsID == 0 && code != oldcode )
cdoWarning("Using constant area weights for code %d!", oldcode=code);
field1.missval = vlistInqVarMissval(vlistID1, varID);
field2.missval = vlistInqVarMissval(vlistID1, varID);
......
......@@ -238,7 +238,7 @@ void *Mrotuv(void *argument)
if ( nvars == 2 )
{
uid = 0;
uid = 1;
vid = 1;
}
else
cdoAbort("U and V not found in %s", cdoStreamName(0));
......
......@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2006 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2007 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
......@@ -68,6 +68,8 @@ void *Trms(void *argument)
int streamID1, streamID2, streamID3;
int vlistID1, vlistID2, vlistID3;
int gridID1, gridID3, lastgrid = -1;
int wstatus = FALSE;
int code = 0, oldcode = 0;
int zaxisID;
int index, ngrids, nzaxis;
int recID, nrecs;
......@@ -253,11 +255,15 @@ void *Trms(void *argument)
field1.zaxis = vlistInqVarZaxis(vlistID1, varID);
field1.grid = vlistInqVarGrid(vlistID1, varID);
field2.grid = vlistInqVarGrid(vlistID2, varID);
if ( field1.grid != lastgrid )
if ( needWeights && field1.grid != lastgrid )
{
lastgrid = field1.grid;
if ( needWeights ) gridWeights(field1.grid, field1.weight);
wstatus = gridWeights(field1.grid, field1.weight);
}
code = vlistInqVarCode(vlistID1, varID);
if ( wstatus != 0 && tsID == 0 && code != oldcode )
cdoWarning("Using constant area weights for code %d!", oldcode=code);
field1.missval = vlistInqVarMissval(vlistID1, varID);
field2.missval = vlistInqVarMissval(vlistID2, varID);
field3.missval = vlistInqVarMissval(vlistID3, varID);
......
......@@ -2,7 +2,7 @@
This file is part of CDO. CDO is a collection of Operators to
manipulate and analyse Climate model Data.
Copyright (C) 2003-2006 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2007 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
See COPYING file for copying and redistribution conditions.
This program is free software; you can redistribute it and/or modify
......@@ -34,6 +34,8 @@ void *Varrms(void *argument)
int streamID1, streamID2, streamID3;
int vlistID1, vlistID2, vlistID3;
int gridID1, gridID2, gridID3, lastgrid = -1;
int wstatus = FALSE;
int code = 0, oldcode = 0;
int index, ngrids;
int recID, nrecs;
int nvars, nlevel;
......@@ -158,11 +160,15 @@ void *Varrms(void *argument)
field1.zaxis = vlistInqVarZaxis(vlistID1, varID);
field1.grid = vlistInqVarGrid(vlistID1, varID);
field2.grid = vlistInqVarGrid(vlistID2, varID);
if ( field1.grid != lastgrid )
if ( needWeights && field1.grid != lastgrid )
{
lastgrid = field1.grid;
if ( needWeights ) gridWeights(field1.grid, field1.weight);
wstatus = gridWeights(field1.grid, field1.weight);
}
code = vlistInqVarCode(vlistID1, varID);
if ( wstatus != 0 && tsID == 0 && code != oldcode )
cdoWarning("Using constant area weights for code %d!", oldcode=code);
field1.missval = vlistInqVarMissval(vlistID1, varID);
field2.missval = vlistInqVarMissval(vlistID1, varID);
field3.missval = vlistInqVarMissval(vlistID1, varID);
......
......@@ -110,7 +110,7 @@ int cdoDefineZaxis(const char *zaxisfile);
int vlistIsSzipped(int vlistID);
void vlistCompare(int vlistID1, int vlistID2, int function);
void gridWeights(int gridID, double *weights);
int gridWeights(int gridID, double *weights);
void gaussaw(double pa[], double pw[], int nlat);
void genXbounds(int xsize, int ysize, double *grid_center_lon, double *grid_corner_lon);
void genYbounds(int xsize, int ysize, double *grid_center_lat, double *grid_corner_lat);
......
......@@ -1866,9 +1866,10 @@ void defineGrid(const char *gridarg)
}
void gridWeights(int gridID, double *weights)
int gridWeights(int gridID, double *weights)
{
static char func[] = "gridWeights";
int status = FALSE;
int i, j, len;
len = gridInqSize(gridID);
......@@ -1966,9 +1967,11 @@ void gridWeights(int gridID, double *weights)
}
else
{
cdoWarning("Using constant area weights!");
status = TRUE;
for ( i = 0; i < len; i++ ) weights[i] = 1;
}
}
return (status);
}
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