Commit c06e90a0 authored by Fabian Wachsmann's avatar Fabian Wachsmann
Browse files

Merge branch 'develop' into cmor3

parents cfa00059 5f5e6cf3
......@@ -3,6 +3,11 @@
* Using CDI library version 1.9.1
* Version 1.9.1 release
2017-09-09 Uwe Schulzweida
* selindexbox: breaks uvRelativeToGrid flag [Bug #7901]
* grid_copy_attributes: copy flag uvRelativeToGrid
2017-09-01 Uwe Schulzweida
* Implementation of option --reduce_dim for z axis
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for cdo 1.9.1rc1.
# Generated by GNU Autoconf 2.68 for cdo 1.9.1rc2.
#
# Report bugs to <http://mpimet.mpg.de/cdo>.
#
......@@ -570,8 +570,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cdo'
PACKAGE_TARNAME='cdo'
PACKAGE_VERSION='1.9.1rc1'
PACKAGE_STRING='cdo 1.9.1rc1'
PACKAGE_VERSION='1.9.1rc2'
PACKAGE_STRING='cdo 1.9.1rc2'
PACKAGE_BUGREPORT='http://mpimet.mpg.de/cdo'
PACKAGE_URL=''
......@@ -1401,7 +1401,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.9.1rc1 to adapt to many kinds of systems.
\`configure' configures cdo 1.9.1rc2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1471,7 +1471,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cdo 1.9.1rc1:";;
short | recursive ) echo "Configuration of cdo 1.9.1rc2:";;
esac
cat <<\_ACEOF
......@@ -1623,7 +1623,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
cdo configure 1.9.1rc1
cdo configure 1.9.1rc2
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
......@@ -2216,7 +2216,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.9.1rc1, which was
It was created by cdo $as_me 1.9.1rc2, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
......@@ -3165,7 +3165,7 @@ fi
# Define the identity of the package.
PACKAGE='cdo'
VERSION='1.9.1rc1'
VERSION='1.9.1rc2'
cat >>confdefs.h <<_ACEOF
......@@ -22983,7 +22983,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.9.1rc1, which was
This file was extended by cdo $as_me 1.9.1rc2, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -23049,7 +23049,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.9.1rc1
cdo config.status 1.9.1rc2
configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
......
......@@ -4,7 +4,7 @@
# autoconf 2.68
# libtool 2.4.2
AC_INIT([cdo], [1.9.1rc1], [http://mpimet.mpg.de/cdo])
AC_INIT([cdo], [1.9.1rc2], [http://mpimet.mpg.de/cdo])
AC_DEFINE_UNQUOTED(CDO, ["$PACKAGE_VERSION"], [CDO version])
......
......@@ -4,9 +4,9 @@
GRIB1 standard:
max record length: 2**23 - 1 (---> 8388607)
P8 : gridsize max: <8388607, 4000x2000
P16: gridsize max: <8388607/2, 2880x1440
max record length: 2**24 (---> 16777216)
P8 : gridsize max: <16777216, 5760x2880
P16: gridsize max: <16777216/2, 4000x2000
ECMWF extension:
max record length: (2**23 - 1)*120 (---> 1006632840)
......
......@@ -8,7 +8,8 @@
@Operators = sp2gp sp2gpl gp2sp gp2spl sp2sp
@BeginDescription
This module transforms fields on Gaussian grids to spectral coefficients and vice versa.
This module transforms fields on a global regular Gaussian grids to spectral coefficients and vice versa.
Missing values are not supported.
@EndDescription
@EndModule
......@@ -17,7 +18,7 @@ This module transforms fields on Gaussian grids to spectral coefficients and vic
@Title = Spectral to gridpoint
@BeginDescription
Convert all fields with spectral coefficients to a regular Gaussian grid. The number of
Convert all fields with spectral coefficients to a global regular Gaussian grid. The number of
latitudes of the resulting Gaussian grid is calculated from the triangular truncation by:
@IfMan
......@@ -37,7 +38,7 @@ latitudes of the resulting Gaussian grid is calculated from the triangular trunc
@Title = Spectral to gridpoint (linear)
@BeginDescription
Convert all fields with spectral coefficients to a regular Gaussian grid. The number of
Convert all fields with spectral coefficients to a global regular Gaussian grid. The number of
latitudes of the resulting Gaussian grid is calculated from the triangular truncation by:
@IfMan
......
......@@ -11,7 +11,7 @@
This module converts relative divergence and vorticity to U and V wind and vice versa.
Divergence and vorticity are spherical harmonic coefficients in spectral space and
U and V are on a global regular Gaussian grid. The Gaussian latitudes need to be ordered from
north to south.
north to south. Missing values are not supported.
@EndDescription
@EndModule
......
......@@ -28,16 +28,16 @@
#include "interpol.h"
static
int readnextpos(FILE *fp, int calendar, juldate_t *juldate, double *xpos, double *ypos)
{
int year = 0, month = 0, day = 0, hour = 0, minute = 0, second = 0;
int stat;
*xpos = 0;
*ypos = 0;
stat = fscanf(fp, "%d-%d-%d %d:%d:%d %lf %lf",
&year, &month, &day, &hour, &minute, &second, xpos, ypos);
int stat = fscanf(fp, "%d-%d-%d %d:%d:%d %lf %lf",
&year, &month, &day, &hour, &minute, &second, xpos, ypos);
if ( stat != EOF )
{
......@@ -53,16 +53,11 @@ int readnextpos(FILE *fp, int calendar, juldate_t *juldate, double *xpos, double
void *Intgridtraj(void *argument)
{
int gridID1;
int nlevel;
int varID, levelID;
int vdate, vtime;
int offset;
int nmiss;
double point;
double *single1, *single2;
double *vardatap;
double xpos, ypos;
double missval;
int calendar = CALENDAR_STANDARD;
cdoInitialize(argument);
......@@ -91,7 +86,7 @@ void *Intgridtraj(void *argument)
int *recVarID = (int*) Malloc(nrecords*sizeof(int));
int *recLevelID = (int*) Malloc(nrecords*sizeof(int));
int gridsize = vlistGridsizeMax(vlistID1);
size_t gridsize = vlistGridsizeMax(vlistID1);
double *array = (double*) Malloc(gridsize*sizeof(double));
double **vardata1 = (double**) Malloc(nvars*sizeof(double*));
......@@ -100,7 +95,7 @@ void *Intgridtraj(void *argument)
for ( varID = 0; varID < nvars; varID++ )
{
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
size_t nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID1, varID));
vardata1[varID] = (double*) Malloc(gridsize*nlevel*sizeof(double));
vardata2[varID] = (double*) Malloc(gridsize*nlevel*sizeof(double));
}
......@@ -139,8 +134,8 @@ void *Intgridtraj(void *argument)
{
pstreamInqRecord(streamID1, &varID, &levelID);
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
offset = gridsize*levelID;
single1 = vardata1[varID] + offset;
size_t offset = gridsize*levelID;
double *single1 = vardata1[varID] + offset;
pstreamReadRecord(streamID1, single1, &nmiss);
if ( nmiss ) cdoAbort("Missing values unsupported for this operator!");
}
......@@ -160,8 +155,8 @@ void *Intgridtraj(void *argument)
recLevelID[recID] = levelID;
gridsize = gridInqSize(vlistInqVarGrid(vlistID1, varID));
offset = gridsize*levelID;
single2 = vardata2[varID] + offset;
size_t offset = gridsize*levelID;
double *single2 = vardata2[varID] + offset;
pstreamReadRecord(streamID1, single2, &nmiss);
if ( nmiss ) cdoAbort("Missing values unsupported for this operator!");
}
......@@ -189,14 +184,14 @@ void *Intgridtraj(void *argument)
{
varID = recVarID[recID];
levelID = recLevelID[recID];
missval = vlistInqVarMissval(vlistID1, varID);
double missval = vlistInqVarMissval(vlistID1, varID);
gridID1 = vlistInqVarGrid(vlistID1, varID);
gridsize = gridInqSize(gridID1);
offset = gridsize*levelID;
single1 = vardata1[varID] + offset;
single2 = vardata2[varID] + offset;
size_t offset = gridsize*levelID;
double *single1 = vardata1[varID] + offset;
double *single2 = vardata2[varID] + offset;
for ( int i = 0; i < gridsize; i++ )
for ( size_t i = 0; i < gridsize; i++ )
array[i] = single1[i]*fac1 + single2[i]*fac2;
field1.grid = gridID1;
......@@ -221,7 +216,7 @@ void *Intgridtraj(void *argument)
juldate1 = juldate2;
for ( varID = 0; varID < nvars; varID++ )
{
vardatap = vardata1[varID];
double *vardatap = vardata1[varID];
vardata1[varID] = vardata2[varID];
vardata2[varID] = vardatap;
}
......
......@@ -64,7 +64,7 @@ void *Vertintap(void *argument)
enum {func_pl, func_hl};
enum {type_lin, type_log};
int nrecs;
int i, k, offset;
int i;
int varID, levelID;
int zaxisIDp, zaxisIDh = -1;
int nhlev = 0, nhlevf = 0, nhlevh = 0, nlevel;
......@@ -72,15 +72,12 @@ void *Vertintap(void *argument)
int apressID = -1, dpressID = -1;
int psID = -1, tempID = -1;
//int sortlevels = TRUE;
int *pnmiss = NULL;
char paramstr[32];
char stdname[CDI_MAX_NAME];
char varname[CDI_MAX_NAME];
double *vct = NULL;
double *single1, *single2;
double *ps_prog = NULL, *full_press = NULL, *dpress = NULL;
double *hyb_press = NULL;
int Extrapolate = 0;
double *ps_prog = NULL, *full_press = NULL;
bool extrapolate = false;
lista_t *flista = lista_new(FLT_LISTA);
cdoInitialize(argument);
......@@ -104,14 +101,14 @@ void *Vertintap(void *argument)
if ( envstr && isdigit((int) envstr[0]) )
{
Extrapolate = atoi(envstr);
if ( Extrapolate == 1 )
if ( atoi(envstr) == 1 ) extrapolate = true;
if ( extrapolate )
cdoPrint("Extrapolation of missing values enabled!");
}
}
else if ( operatorID == AP2PLX || operatorID == AP2HLX || operatorID == AP2PLX_LP )
{
Extrapolate = 1;
extrapolate = true;
}
operatorInputArg(cdoOperatorEnter(operatorID));
......@@ -231,8 +228,7 @@ void *Vertintap(void *argument)
int maxlev = nhlevh > nplev ? nhlevh : nplev;
if ( Extrapolate == 0 )
pnmiss = (int *) Malloc(nplev*sizeof(int));
int *pnmiss = extrapolate ? NULL : (int *) Malloc(nplev*sizeof(int));
// check levels
if ( zaxisIDh != -1 )
......@@ -259,14 +255,13 @@ void *Vertintap(void *argument)
vert_index = (int *) Malloc(gridsize*nplev*sizeof(int));
ps_prog = (double *) Malloc(gridsize*sizeof(double));
full_press = (double *) Malloc(gridsize*nhlevf*sizeof(double));
dpress = (double *) Malloc(gridsize*nhlevf*sizeof(double));
}
else
cdoWarning("No 3D variable with generalized height level found!");
if ( operfunc == func_hl )
{
double *phlev =(double*) Malloc(nplev*sizeof(double));
double *phlev = (double*) Malloc(nplev*sizeof(double));
height2pressure(phlev, plev, nplev);
if ( cdoVerbose )
......@@ -278,7 +273,7 @@ void *Vertintap(void *argument)
}
if ( opertype == type_log )
for ( k = 0; k < nplev; k++ ) plev[k] = log(plev[k]);
for ( int k = 0; k < nplev; k++ ) plev[k] = log(plev[k]);
for ( varID = 0; varID < nvars; varID++ )
{
......@@ -311,7 +306,7 @@ void *Vertintap(void *argument)
}
}
if ( zaxisIDh != -1 && psID == -1 && dpressID )
if ( zaxisIDh != -1 && psID == -1 && dpressID != -1 )
cdoWarning("Surface pressure not found - set to vertical sum of %s!", var_stdname(pressure_thickness));
// cdoWarning("Surface pressure not found - set to upper level of %s!", var_stdname(air_pressure));
......@@ -351,9 +346,8 @@ void *Vertintap(void *argument)
printf("levelID %d\n", levelID);
}
*/
offset = gridsize*levelID;
single1 = vardata1[varID] + offset;
size_t offset = gridsize*levelID;
double *single1 = vardata1[varID] + offset;
pstreamReadRecord(streamID1, single1, &varnmiss[varID][levelID]);
vars[varID] = true;
......@@ -370,11 +364,10 @@ void *Vertintap(void *argument)
}
else if ( dpressID != -1 )
{
memcpy(dpress, vardata1[dpressID], gridsize*nhlevf*sizeof(double));
for ( i = 0; i < gridsize; i++ ) ps_prog[i] = 0;
for ( k = 0; k < nhlevf; ++k )
for ( int k = 0; k < nhlevf; ++k )
for ( i = 0; i < gridsize; i++ )
ps_prog[i] += dpress[k*gridsize+i];
ps_prog[i] += vardata1[dpressID][k*gridsize+i];
}
else
{
......@@ -394,30 +387,27 @@ void *Vertintap(void *argument)
{
for ( i = 0; i < gridsize; i++ ) ps_prog[i] = log(ps_prog[i]);
for ( k = 0; k < nhlevf; k++ )
for ( int k = 0; k < nhlevf; k++ )
for ( i = 0; i < gridsize; i++ )
full_press[k*gridsize+i] = log(full_press[k*gridsize+i]);
}
genind(vert_index, plev, full_press, gridsize, nplev, nhlevf);
if ( Extrapolate == 0 )
genindmiss(vert_index, plev, gridsize, nplev, ps_prog, pnmiss);
if ( !extrapolate ) genindmiss(vert_index, plev, gridsize, nplev, ps_prog, pnmiss);
}
for ( varID = 0; varID < nvars; varID++ )
{
if ( vars[varID] )
{
int zaxisID = vlistInqVarZaxis(vlistID1, varID);
int nlevel = zaxisInqSize(zaxisID);
double missval = vlistInqVarMissval(vlistID1, varID);
int zaxisID = vlistInqVarZaxis(vlistID1, varID);
int nlevel = zaxisInqSize(zaxisID);
double missval = vlistInqVarMissval(vlistID1, varID);
if ( varinterp[varID] )
{
if ( nlevel == nhlevf )
{
hyb_press = full_press;
}
double *hyb_press = NULL;
if ( nlevel == nhlevf ) hyb_press = full_press;
else
{
int param = vlistInqVarParam(vlistID1, varID);
......@@ -434,8 +424,7 @@ void *Vertintap(void *argument)
interp_X(vardata1[varID], vardata2[varID], hyb_press,
vert_index, plev, nplev, gridsize, nlevel, missval);
if ( Extrapolate == 0 )
memcpy(varnmiss[varID], pnmiss, nplev*sizeof(int));
if ( !extrapolate ) memcpy(varnmiss[varID], pnmiss, nplev*sizeof(int));
}
}
}
......@@ -447,8 +436,8 @@ void *Vertintap(void *argument)
int nlevel = zaxisInqSize(vlistInqVarZaxis(vlistID2, varID));
for ( levelID = 0; levelID < nlevel; levelID++ )
{
offset = gridsize*levelID;
single2 = vardata2[varID] + offset;
size_t offset = gridsize*levelID;
double *single2 = vardata2[varID] + offset;
pstreamDefRecord(streamID2, varID, levelID);
pstreamWriteRecord(streamID2, single2, varnmiss[varID][levelID]);
}
......@@ -472,7 +461,6 @@ void *Vertintap(void *argument)
if ( ps_prog ) Free(ps_prog);
if ( vert_index ) Free(vert_index);
if ( full_press ) Free(full_press);
if ( dpress ) Free(dpress);
if ( vct ) Free(vct);
Free(vars);
......
......@@ -1006,7 +1006,6 @@ void check_stacksize()
{
struct rlimit rlim;
int status = getrlimit(RLIMIT_STACK, &rlim);
if ( status == 0 )
{
#define MIN_STACK_SIZE 67108864L /* 64MB */
......@@ -1026,6 +1025,7 @@ void check_stacksize()
}
else
fprintf(stderr, "Set stack size to %ld failed!\n", (long) min_stack_size);
fprintf(stderr, "\n");
}
}
}
......
......@@ -160,6 +160,8 @@ void grid_copy_attributes(int gridID1, int gridID2)
if ( string[0] ) cdiGridDefKeyStr(gridID2, CDI_KEY_XUNITS, strlen(string)+1, string);
string[0] = 0; cdiGridInqKeyStr(gridID1, CDI_KEY_YUNITS, CDI_MAX_NAME, string);
if ( string[0] ) cdiGridDefKeyStr(gridID2, CDI_KEY_YUNITS, strlen(string)+1, string);
if ( gridInqUvRelativeToGrid(gridID1) ) gridDefUvRelativeToGrid(gridID2, 1);
}
......
......@@ -88,7 +88,7 @@ int gridFromNCfile(const char *gridfile)
if ( grid_rank == 1 )
{
grid.type = GRID_UNSTRUCTURED;
if ( (size_t)grid_dims[0] != grid_size ) return(gridID);
if ( (size_t)grid_dims[0] != grid_size ) return gridID;
}
else
{
......@@ -98,7 +98,7 @@ int gridFromNCfile(const char *gridfile)
grid.xsize = grid_dims[0];
grid.ysize = grid_dims[1];
if ( (size_t)grid_dims[0]*grid_dims[1] != grid_size ) return(gridID);
if ( (size_t)grid_dims[0]*grid_dims[1] != grid_size ) return gridID;
}
/* allocate grid coordinates and read data */
......
......@@ -591,7 +591,7 @@ void printZaxisInfo(int vlistID)
if ( number > 0 )
{
fprintf(stdout, "%33s : ", "zaxis");
fprintf(stdout, "number = %d\n", number);
fprintf(stdout, "number=%d\n", number);
}
unsigned char uuidOfVGrid[CDI_UUID_SIZE];
......
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