Commit 6e70972f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

spcut: only correct results with continuous wave numbers starting at 1 (bug fix)

parent 4e34849f
2011-01-18 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* spcut: only correct results with continuous wave numbers starting at 1 (bug fix)
2011-01-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* remaplib: fix data race in calculation of bin_addr (OpenMP)
......
......@@ -6,6 +6,7 @@ Version 1.5.0 (?? March 2011):
Fixed bugs:
* sellonlatbox: does not work as expected when selecting all longitutes
* detrend: integer overflow; wrong result for nts > 46340
* spcut: only correct results with continuous wave numbers starting at 1
* remaplib: fix data race in calculation of bin_addr (OpenMP)
Version 1.4.7 (06 January 2011):
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.66 for cdo 1.4.8rc2.
# Generated by GNU Autoconf 2.66 for cdo 1.4.8rc3.
#
# Report bugs to <http://code.zmaw.de/projects/cdo>.
#
......@@ -562,8 +562,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cdo'
PACKAGE_TARNAME='cdo'
PACKAGE_VERSION='1.4.8rc2'
PACKAGE_STRING='cdo 1.4.8rc2'
PACKAGE_VERSION='1.4.8rc3'
PACKAGE_STRING='cdo 1.4.8rc3'
PACKAGE_BUGREPORT='http://code.zmaw.de/projects/cdo'
PACKAGE_URL=''
 
......@@ -1339,7 +1339,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures cdo 1.4.8rc2 to adapt to many kinds of systems.
\`configure' configures cdo 1.4.8rc3 to adapt to many kinds of systems.
 
Usage: $0 [OPTION]... [VAR=VALUE]...
 
......@@ -1409,7 +1409,7 @@ fi
 
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cdo 1.4.8rc2:";;
short | recursive ) echo "Configuration of cdo 1.4.8rc3:";;
esac
cat <<\_ACEOF
 
......@@ -1545,7 +1545,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
cdo configure 1.4.8rc2
cdo configure 1.4.8rc3
generated by GNU Autoconf 2.66
 
Copyright (C) 2010 Free Software Foundation, Inc.
......@@ -2092,7 +2092,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
 
It was created by cdo $as_me 1.4.8rc2, which was
It was created by cdo $as_me 1.4.8rc3, which was
generated by GNU Autoconf 2.66. Invocation command line was
 
$ $0 $@
......@@ -2987,7 +2987,7 @@ fi
 
# Define the identity of the package.
PACKAGE='cdo'
VERSION='1.4.8rc2'
VERSION='1.4.8rc3'
 
 
cat >>confdefs.h <<_ACEOF
......@@ -18562,7 +18562,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by cdo $as_me 1.4.8rc2, which was
This file was extended by cdo $as_me 1.4.8rc3, which was
generated by GNU Autoconf 2.66. Invocation command line was
 
CONFIG_FILES = $CONFIG_FILES
......@@ -18628,7 +18628,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
cdo config.status 1.4.8rc2
cdo config.status 1.4.8rc3
configured by $0, generated by GNU Autoconf 2.66,
with options \\"\$ac_cs_config\\"
 
......
# Process this file with autoconf to produce a configure script.
AC_INIT([cdo], [1.4.8rc2], [http://code.zmaw.de/projects/cdo])
AC_INIT([cdo], [1.4.8rc3], [http://code.zmaw.de/projects/cdo])
CONFIG_ABORT=yes
AC_CONFIG_AUX_DIR(config)
......
......@@ -347,18 +347,49 @@ void *Output(void *argument)
}
else
{
nout = 0;
for ( i = 0; i < gridsize; i++ )
double minval, maxval;
minval = array[0];
maxval = array[0];
if ( gridInqType(gridID) == GRID_SPECTRAL && gridsize <= 156 )
{
if ( nout == 6 )
for ( i = 1; i < gridsize; i++ )
{
nout = 0;
if ( array[i] < minval ) minval = array[i];
if ( array[i] > maxval ) maxval = array[i];
}
}
if ( gridInqType(gridID) == GRID_SPECTRAL && gridsize <= 156 /* T11 */ &&
minval >= -1 && maxval <= 12 )
{
long m, n, ntr;
double *spc = array;
ntr = gridInqTrunc(gridID);
for ( m = 0; m <= ntr; m++ )
{
for ( n = m; n <= ntr; n++ )
{
fprintf(stdout, "%3d", (int) *spc++);
fprintf(stdout, "%3d", (int) *spc++);
}
fprintf(stdout, "\n");
}
fprintf(stdout, " %12.6g", array[i]);
nout++;
}
fprintf(stdout, "\n");
else
{
nout = 0;
for ( i = 0; i < gridsize; i++ )
{
if ( nout == 6 )
{
nout = 0;
fprintf(stdout, "\n");
}
fprintf(stdout, " %12.6g", array[i]);
nout++;
}
fprintf(stdout, "\n");
}
}
}
tsID++;
......
......@@ -34,8 +34,6 @@
#include "list.h"
#define MAX_NTR 9999
void *Spectral(void *argument)
{
int GP2SP, GP2SPL, SP2GP, SP2GPL, SP2SP, SPCUT;
......@@ -51,7 +49,7 @@ void *Spectral(void *argument)
int gridID;
int nmiss;
int ncut = 0;
int *wnums = NULL, waves[MAX_NTR];
int *wnums = NULL, *waves = NULL;
int *vars;
int lcopy = FALSE;
double *array1 = NULL, *array2 = NULL;
......@@ -198,26 +196,24 @@ void *Spectral(void *argument)
}
else if ( operatorID == SPCUT )
{
int i, j;
long i, j, maxntr;
gridID1 = gridIDsp;
operatorInputArg("wave numbers");
if ( gridID1 != -1 )
{
maxntr = 1+gridInqTrunc(gridID1);
ncut = args2intlist(operatorArgc(), operatorArgv(), ilist);
wnums = (int *) listArrayPtr(ilist);
for ( i = 0; i < MAX_NTR; i++ ) waves[i] = 1;
waves = (int *) malloc(maxntr*sizeof(int));
for ( i = 0; i < maxntr; i++ ) waves[i] = 1;
for ( i = 0; i < ncut; i++ )
{
j = wnums[i] - 1;
if ( j < 0 || j >= MAX_NTR )
cdoAbort("wave number %d out of range!", wnums[i]);
if ( j < 0 || j >= maxntr )
cdoAbort("wave number %d out of range (min=1, max=%d)!", wnums[i], maxntr);
waves[j] = 0;
}
/*
for ( i = 0; i < 200; i++ )
printf("%d %d\n", i+1, waves[i]);
*/
}
else
cdoAbort("No spectral data found!");
......@@ -303,6 +299,7 @@ void *Spectral(void *argument)
if ( array2 ) free(array2);
if ( array1 ) free(array1);
if ( vars ) free(vars);
if ( waves ) free(waves);
listDelete(ilist);
......
......@@ -440,7 +440,7 @@ void spcut(double *arrayIn, double *arrayOut, int trunc, int *waves)
{
for ( m = n; m <= trunc; m++ )
{
if ( waves[n] || waves[m] )
if ( waves[m] )
{
*arrayOut++ = *arrayIn++;
*arrayOut++ = *arrayIn++;
......
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