Commit 87380ae6 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

mermean: bug fix for weights from 'zonmean'

parent 1b0ebd86
......@@ -4,6 +4,7 @@
* add support for GRID type Lambert Conformal Conic
* Sinusoidal and Lambert Azimuthal Equal Area grids with units [km]
* gridFromName: define GRID with one point lon=<LON>_lat=<LAT>
* mermean: bug fix for weights from 'zonmean' (report: Michael Sigmond)
* remap: read grid corners only if needed
* Version 1.3.1 released
......
......@@ -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-2008 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2009 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
......
......@@ -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-2008 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2009 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
......@@ -776,7 +776,7 @@ void *Outputgmt(void *argument)
if ( lgrid_gen_bounds )
{
if ( ! (lzon || lmer) )
genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon);
genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon, 0);
genYbounds(nlon, nlat, grid_center_lat, grid_corner_lat);
}
else
......
......@@ -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-2008 Uwe Schulzweida, Uwe.Schulzweida@zmaw.de
Copyright (C) 2003-2009 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
......
......@@ -117,7 +117,7 @@ void vlistCompare(int vlistID1, int vlistID2, int function);
int gridWeights(int gridID, double *weights);
int gridGenArea(int gridID, double *area);
void gaussaw(double pa[], double pw[], int nlat);
void genXbounds(int xsize, int ysize, double *grid_center_lon, double *grid_corner_lon);
void genXbounds(int xsize, int ysize, double *grid_center_lon, double *grid_corner_lon, double dlon);
void genYbounds(int xsize, int ysize, double *grid_center_lat, double *grid_corner_lat);
void writeNCgrid(const char *gridfile, int gridID, int *imask);
void defineZaxis(const char *zaxisarg);
......
......@@ -1112,7 +1112,12 @@ int gridGenArea(int gridID, double *area)
{
int nlon = gridInqXsize(gridID);
int nlat = gridInqYsize(gridID);
genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon);
double dlon = 0;
if ( nlon == 1 )
{
dlon = 1;
}
genXbounds(nlon, nlat, grid_center_lon, grid_corner_lon, dlon);
genYbounds(nlon, nlat, grid_center_lat, grid_corner_lat);
}
else
......
......@@ -178,12 +178,12 @@ void remapVarsFree(REMAPVARS *rv)
/*****************************************************************************/
void genXbounds(int xsize, int ysize, double *grid_center_lon, double *grid_corner_lon)
void genXbounds(int xsize, int ysize, double *grid_center_lon, double *grid_corner_lon, double dlon)
{
int i, j, index;
double dlon, minlon, maxlon;
double minlon, maxlon;
dlon = 360./xsize;
if ( ! (dlon > 0) ) dlon = 360./xsize;
/*
if ( xsize == 1 || (grid_center_lon[xsize-1]-grid_center_lon[0]+dlon) < 359 )
cdoAbort("Cannot calculate Xbounds for %d vals with dlon = %g", xsize, dlon);
......@@ -751,7 +751,7 @@ void remapGridInit(int map_type, int gridID1, int gridID2, REMAPGRID *rg)
{
if ( lgrid1_gen_bounds )
{
genXbounds(rg->grid1_dims[0], rg->grid1_dims[1], rg->grid1_center_lon, rg->grid1_corner_lon);
genXbounds(rg->grid1_dims[0], rg->grid1_dims[1], rg->grid1_center_lon, rg->grid1_corner_lon, 0);
genYbounds(rg->grid1_dims[0], rg->grid1_dims[1], rg->grid1_center_lat, rg->grid1_corner_lat);
}
else
......@@ -827,7 +827,7 @@ void remapGridInit(int map_type, int gridID1, int gridID2, REMAPGRID *rg)
{
if ( lgrid2_gen_bounds )
{
genXbounds(rg->grid2_dims[0], rg->grid2_dims[1], rg->grid2_center_lon, rg->grid2_corner_lon);
genXbounds(rg->grid2_dims[0], rg->grid2_dims[1], rg->grid2_center_lon, rg->grid2_corner_lon, 0);
genYbounds(rg->grid2_dims[0], rg->grid2_dims[1], rg->grid2_center_lat, rg->grid2_corner_lat);
}
else
......
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