Commit 3a67fb42 authored by Uwe Schulzweida's avatar Uwe Schulzweida

libcdi update.

parents e831c434 fac9b69e
2016-08-18 Uwe Schulzweida
* using CDI library version 1.8.0rc2
* Version 1.8.0rc2 released
2016-08-16 Uwe Schulzweida
* setzaxis: added support for internal zaxis name height_<value>_<units>
2016-08-11 Uwe Schulzweida
* Changed handling of rotated lon/lat grids
2016-08-10 Uwe Schulzweida
* Changed default of option -f nc to netCDF2
......
......@@ -41,7 +41,7 @@ case "${HOSTNAME}" in
--with-libxml2=/usr \
--with-magics=$HOME/local/Magics-2.25.3 \
--with-proj=/opt/local \
--with-szlib=$HOME/local"
--with-szlib=$HOME/local/libaec-0.3.2"
if test "$COMP" = icpc ; then
${CONFPATH}configure --enable-cxx \
......@@ -175,7 +175,7 @@ case "${HOSTNAME}" in
CDOLIBS="--with-grib_api=/sw/squeeze-x64/grib_api-1.13.0-static-gccsys \
--with-netcdf=/sw/squeeze-x64/netcdf-4.2-static \
--with-hdf5=/sw/squeeze-x64/hdf5-1.8.8-static \
--with-szlib=/sw/squeeze-x64/szip-2.1 \
--with-szlib=/sw/squeeze-x64/libaec-0.3.2-gcc48 \
--with-udunits2=/sw/squeeze-x64/udunits-2.1.19 \
--with-proj=/sw/squeeze-x64/proj-4.7.0 LIBS=-lz"
......@@ -219,7 +219,7 @@ case "${HOSTNAME}" in
CDOLIBS="--with-grib_api=/sw/rhel6-x64/grib_api/grib_api-1.13.0-gcc48 \
--with-netcdf=/sw/rhel6-x64/netcdf/netcdf_c-4.3.2-gcc48 \
--with-hdf5=/sw/rhel6-x64/hdf5/hdf5-1.8.14-threadsafe-gcc48 \
--with-szlib=/sw/rhel6-x64/sys/szip-2.1-gcc48 \
--with-szlib=/sw/rhel6-x64/sys/libaec-0.3.2-gcc48 \
--with-udunits2=/sw/rhel6-x64/util/udunits-2.2.17-gcc48 \
--with-proj=/sw/rhel6-x64/graphics/proj4-4.9.1-gcc48"
# --with-magics=/sw/rhel6-x64/graphics/magicsxx-2.18.15-gfxonly-gcc48 \
......
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.68 for cdo 1.8.0rc1.
# Generated by GNU Autoconf 2.68 for cdo 1.8.0rc2.
#
# 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.8.0rc1'
PACKAGE_STRING='cdo 1.8.0rc1'
PACKAGE_VERSION='1.8.0rc2'
PACKAGE_STRING='cdo 1.8.0rc2'
PACKAGE_BUGREPORT='http://mpimet.mpg.de/cdo'
PACKAGE_URL=''
......@@ -1395,7 +1395,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.8.0rc1 to adapt to many kinds of systems.
\`configure' configures cdo 1.8.0rc2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
......@@ -1465,7 +1465,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cdo 1.8.0rc1:";;
short | recursive ) echo "Configuration of cdo 1.8.0rc2:";;
esac
cat <<\_ACEOF
......@@ -1613,7 +1613,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
cdo configure 1.8.0rc1
cdo configure 1.8.0rc2
generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
......@@ -2206,7 +2206,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.8.0rc1, which was
It was created by cdo $as_me 1.8.0rc2, which was
generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
......@@ -3155,7 +3155,7 @@ fi
# Define the identity of the package.
PACKAGE='cdo'
VERSION='1.8.0rc1'
VERSION='1.8.0rc2'
cat >>confdefs.h <<_ACEOF
......@@ -21644,7 +21644,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.8.0rc1, which was
This file was extended by cdo $as_me 1.8.0rc2, which was
generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
......@@ -21710,7 +21710,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.8.0rc1
cdo config.status 1.8.0rc2
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.8.0rc1], [http://mpimet.mpg.de/cdo])
AC_INIT([cdo], [1.8.0rc2], [http://mpimet.mpg.de/cdo])
AC_DEFINE_UNQUOTED(CDO, ["$PACKAGE_VERSION"], [CDO version])
......
......@@ -173,9 +173,6 @@ Keyword & Datatype & Description \\ \hline
\bf{ysize} & INTEGER & Size in y direction (number of latitudes). \\
\bf{xvals} & FLOAT ARRAY & X values of the grid cell center. \\
\bf{yvals} & FLOAT ARRAY & Y values of the grid cell center.\\
\bf{xnpole} & FLOAT & X value of the north pole (rotated grid). \\
\bf{ynpole} & FLOAT & Y value of the north pole (rotated grid). \\
\bf{angle} & FLOAT & Angle of the rotated north pole (default: 0). \\
\bf{nvertex} & INTEGER & Number of the vertices for all grid cells. \\
\bf{xbounds} & FLOAT ARRAY & X bounds of each gridbox. \\
\bf{ybounds} & FLOAT ARRAY & Y bounds of each gridbox. \\
......@@ -232,12 +229,6 @@ xvals & xsize & xsize & gridsize & gridsize \\
\hline
yvals & ysize & ysize & gridsize & gridsize \\
\hline
xnpole & 0 & & & \\
\hline
ynpole & 90 & & & \\
\hline
angle & 0 & & & \\
\hline
nvertex & 2 & 2 & 4 & {\bf nv} \\
\hline
xbounds & 2*xsize & 2*xsize & 4*gridsize & nv*gridsize \\
......@@ -295,28 +286,28 @@ The grid cell corners xbounds and ybounds have to rotate counterclockwise.
\end{lstlisting}
%\end{minipage}
\vspace{2mm}
% \vspace{2mm}
For a lon/lat grid with a rotated pole, the north pole must be defined.
As far as you define the keywords xnpole/ynpole all coordinate values
are for the rotated system.
% For a lon/lat grid with a rotated pole, the north pole must be defined.
% As far as you define the keywords xnpole/ynpole all coordinate values
% are for the rotated system.
\vspace{2mm}
% \vspace{2mm}
%\begin{minipage}[t]{\textwidth}
{\CDO} grid description example of a regional rotated lon/lat grid:
\begin{lstlisting}[frame=single, backgroundcolor=\color{pcolor1}, basicstyle=\footnotesize]
gridtype = lonlat
xsize = 81
ysize = 91
xfirst = -19.5
xinc = 0.5
yfirst = -25.0
yinc = 0.5
xnpole = -170
ynpole = 32.5
\end{lstlisting}
%\end{minipage}
% %\begin{minipage}[t]{\textwidth}
% {\CDO} grid description example of a regional rotated lon/lat grid:
% \begin{lstlisting}[frame=single, backgroundcolor=\color{pcolor1}, basicstyle=\footnotesize]
% gridtype = lonlat
% xsize = 81
% ysize = 91
% xfirst = -19.5
% xinc = 0.5
% yfirst = -25.0
% yinc = 0.5
% xnpole = -170
% ynpole = 32.5
% \end{lstlisting}
% %\end{minipage}
Example {\CDO} descriptions of a curvilinear and an unstructured grid can be found
in \htmlref{Appendix C}{appendixgrid}.
......
libcdi @ 43b311dc
Subproject commit 2e10423f6eacdcd16daa27f295440605e2f99fab
Subproject commit 43b311dc473065c8d3196fa57e8454f4042d4dfb
......@@ -47,9 +47,6 @@ void gen_index(int gridID1, int gridID2, int *index)
if ( gridtype1 == GRID_LONLAT || gridtype1 == GRID_GAUSSIAN )
{
if ( gridIsRotated(gridID1) )
cdoAbort("Rotated grids unsupported!");
int nlon1 = gridInqXsize(gridID1);
int nlat1 = gridInqYsize(gridID1);
......
......@@ -431,7 +431,7 @@ void ctl_xydef(FILE *gdp, int gridID, bool *yrev)
int nx, ny, ni;
double inc[] = { 1, 0.5, 0.2, 0.1, 0.05, 0.02, 0.01, 0.005, 0.002, 0.001 };
gridInqLCC(gridID, &originLon, &originLat, &lonParY, &lat1, &lat2, &xincm, &yincm,
gridInqParamLCC(gridID, &originLon, &originLat, &lonParY, &lat1, &lat2, &xincm, &yincm,
&projflag, &scanflag);
fprintf(gdp, "PDEF %d %d LCCR %g %g 1 1 %g %g %g %g %g\n",
xsize, ysize, originLat, originLon, lat1, lat2, lonParY, xincm, yincm);
......
......@@ -45,12 +45,10 @@ void grid_cell_area(int gridID, double *array)
if ( gridtype == GRID_LONLAT ||
gridtype == GRID_GAUSSIAN ||
gridtype == GRID_LAEA ||
projtype == CDI_PROJ_RLL ||
projtype == CDI_PROJ_LAEA ||
projtype == CDI_PROJ_SINU ||
projtype == CDI_PROJ_LCC ||
gridtype == GRID_SINUSOIDAL ||
gridtype == GRID_LCC ||
gridtype == GRID_GME ||
gridtype == GRID_CURVILINEAR ||
......
......@@ -150,9 +150,7 @@ void read_amsr(FILE *fp, int vlistID, int nvars, double *data[], int *nmiss)
static
void write_data(int streamID, int nvars, double *data[], int *nmiss)
{
int varID;
for ( varID = 0; varID < nvars; ++varID )
for ( int varID = 0; varID < nvars; ++varID )
{
streamDefRecord(streamID, varID, 0);
streamWriteRecord(streamID, data[varID], nmiss[varID]);
......@@ -163,9 +161,7 @@ static
int getDate(const char *name)
{
int date = 0;
char *pname;
pname = (char *)strchr(name, '_');
char *pname = (char *)strchr(name, '_');
if ( pname ) date = atoi(pname+1);
......@@ -175,57 +171,51 @@ int getDate(const char *name)
void *Importamsr(void *argument)
{
int streamID;
int tsID;
int gridID, zaxisID, taxisID, vlistID;
int gridsize;
int i;
int nvars;
int vdate = 0, vtime = 0;
int vtime = 0;
double xvals[NLON], yvals[NLAT];
double *data[MAX_VARS];
int nmiss[MAX_VARS];
FILE *fp;
size_t fsize;
cdoInitialize(argument);
fp = fopen(cdoStreamName(0)->args, "r");
FILE *fp = fopen(cdoStreamName(0)->args, "r");
if ( fp == NULL ) { perror(cdoStreamName(0)->args); exit(EXIT_FAILURE); }
fseek(fp, 0L, SEEK_END);
fsize = (size_t) ftell(fp);
size_t fsize = (size_t) ftell(fp);
fseek(fp, 0L, SEEK_SET);
vdate = getDate(cdoStreamName(0)->args);
int vdate = getDate(cdoStreamName(0)->args);
if ( vdate <= 999999 ) vdate = vdate*100 + 1;
streamID = streamOpenWrite(cdoStreamName(1), cdoFiletype());
int streamID = streamOpenWrite(cdoStreamName(1), cdoFiletype());
/*
Longitude is 0.25*xdim-0.125 degrees east
Latitude is 0.25*ydim-90.125
*/
gridsize = NLON*NLAT;
gridID = gridCreate(GRID_LONLAT, gridsize);
int gridsize = NLON*NLAT;
int gridID = gridCreate(GRID_LONLAT, gridsize);
gridDefXsize(gridID, NLON);
gridDefYsize(gridID, NLAT);
for ( i = 0; i < NLON; ++i ) xvals[i] = 0.25*(i+1) - 0.125;
for ( i = 0; i < NLAT; ++i ) yvals[i] = 0.25*(i+1) - 90.125;
for ( int i = 0; i < NLON; ++i ) xvals[i] = 0.25*(i+1) - 0.125;
for ( int i = 0; i < NLAT; ++i ) yvals[i] = 0.25*(i+1) - 90.125;
gridDefXvals(gridID, xvals);
gridDefYvals(gridID, yvals);
zaxisID = zaxisCreate(ZAXIS_SURFACE, 1);
int zaxisID = zaxisCreate(ZAXIS_SURFACE, 1);
taxisID = taxisCreate(TAXIS_ABSOLUTE);
int taxisID = taxisCreate(TAXIS_ABSOLUTE);
vlistID = vlistCreate();
int vlistID = vlistCreate();
vlistDefTaxis(vlistID, taxisID);
if ( fsize == 12441600 )
{
nvars = 6;
for ( i = 0; i < nvars; ++i ) data[i] = (double*) Malloc(gridsize*sizeof(double));
for ( int i = 0; i < nvars; ++i ) data[i] = (double*) Malloc(gridsize*sizeof(double));
init_amsr_day(vlistID, gridID, zaxisID, nvars);
......@@ -245,12 +235,12 @@ void *Importamsr(void *argument)
write_data(streamID, nvars, data, nmiss);
}
for ( i = 0; i < nvars; ++i ) Free(data[i]);
for ( int i = 0; i < nvars; ++i ) Free(data[i]);
}
else if ( fsize == 5184000 )
{
nvars = 5;
for ( i = 0; i < nvars; ++i ) data[i] = (double*) Malloc(gridsize*sizeof(double));
for ( int i = 0; i < nvars; ++i ) data[i] = (double*) Malloc(gridsize*sizeof(double));
init_amsr_averaged(vlistID, gridID, zaxisID, nvars);
......@@ -267,7 +257,7 @@ void *Importamsr(void *argument)
write_data(streamID, nvars, data, nmiss);
for ( i = 0; i < nvars; ++i ) Free(data[i]);
for ( int i = 0; i < nvars; ++i ) Free(data[i]);
}
else
cdoAbort("Unexpected file size for AMSR data!");
......
......@@ -70,10 +70,9 @@ void get_dim_vals(dsets_t *pfi, double *vals, int dimlen, int dim)
static
void rev_vals(double *vals, int n)
{
int i;
double dum;
for ( i = 0; i < n/2; ++i )
for ( int i = 0; i < n/2; ++i )
{
dum = vals[i];
vals[i] = vals[n-1-i];
......@@ -116,22 +115,20 @@ int y_is_gauss(double *gridyvals, int ysize)
Free(yvals);
}
return (lgauss);
return lgauss;
}
static
int define_grid(dsets_t *pfi)
{
int gridID, gridtype;
int nx, ny;
double *xvals, *yvals;
int lgauss = FALSE;
nx = pfi->dnum[0];
ny = pfi->dnum[1];
int nx = pfi->dnum[0];
int ny = pfi->dnum[1];
xvals = (double*) Malloc(nx*sizeof(double));
yvals = (double*) Malloc(ny*sizeof(double));
double *xvals = (double*) Malloc(nx*sizeof(double));
double *yvals = (double*) Malloc(ny*sizeof(double));
get_dim_vals(pfi, xvals, nx, 0);
get_dim_vals(pfi, yvals, ny, 1);
......@@ -153,22 +150,18 @@ int define_grid(dsets_t *pfi)
Free(xvals);
Free(yvals);
return (gridID);
return gridID;
}
static
int define_level(dsets_t *pfi, int nlev)
{
int zaxisID = -1;
int nz;
nz = pfi->dnum[2];
int nz = pfi->dnum[2];
if ( nz )
{
double *zvals = NULL;
zvals = (double*) Malloc(nz*sizeof(double));
double *zvals = (double*) Malloc(nz*sizeof(double));
get_dim_vals(pfi, zvals, nz, 2);
......@@ -193,75 +186,67 @@ int define_level(dsets_t *pfi, int nlev)
zaxisDefLevels(zaxisID, &level);
}
return (zaxisID);
return zaxisID;
}
void *Importbinary(void *argument)
{
int streamID;
int gridID = -1, zaxisID, zaxisIDsfc, taxisID, vlistID;
int i;
int nmiss = 0, n_nan;
int ivar;
int varID = -1, levelID, tsID;
int gridsize;
int status;
int datatype;
dsets_t pfi;
int vdate, vtime;
int tcur, told,fnum;
int tmin=0,tmax=0;
char *ch = NULL;
int nvars, nlevels, nrecs;
int recID;
int nlevels;
int e, flag;
size_t rc, recsize;
int recoffset;
char *rec = NULL;
struct gavar *pvar;
struct dt dtim, dtimi;
double missval;
double fmin, fmax;
double *array;
double sfclevel = 0;
int *recVarID, *recLevelID;
int *var_zaxisID;
int *var_dfrm = NULL;
char vdatestr[32], vtimestr[32];
cdoInitialize(argument);
dsets_init(&pfi);
status = read_gradsdes(cdoStreamName(0)->args, &pfi);
int status = read_gradsdes(cdoStreamName(0)->args, &pfi);
if ( cdoVerbose ) fprintf(stderr, "status %d\n", status);
//if ( status ) cdoAbort("Open failed on %s!", pfi.name);
if ( status ) cdoAbort("Open failed!");
nrecs = pfi.trecs;
nvars = pfi.vnum;
pvar = pfi.pvar1;
int nrecs = pfi.trecs;
int nvars = pfi.vnum;
struct gavar *pvar = pfi.pvar1;
if ( nvars == 0 ) cdoAbort("No variables found!");
gridID = define_grid(&pfi);
int gridID = define_grid(&pfi);
if ( cdoVerbose ) gridPrint(gridID, gridID, 1);
zaxisID = define_level(&pfi, 0);
int zaxisID = define_level(&pfi, 0);
if ( cdoVerbose ) zaxisPrint(zaxisID, zaxisID);
zaxisIDsfc = zaxisCreate(ZAXIS_SURFACE, 1);
int zaxisIDsfc = zaxisCreate(ZAXIS_SURFACE, 1);
zaxisDefLevels(zaxisIDsfc, &sfclevel);
vlistID = vlistCreate();
int vlistID = vlistCreate();
var_zaxisID = (int*) Malloc(nvars*sizeof(int));
recVarID = (int*) Malloc(nrecs*sizeof(int));
recLevelID = (int*) Malloc(nrecs*sizeof(int));
var_dfrm = (int*) Malloc(nrecs*sizeof(int));
int *var_zaxisID = (int*) Malloc(nvars*sizeof(int));
int *recVarID = (int*) Malloc(nrecs*sizeof(int));
int *recLevelID = (int*) Malloc(nrecs*sizeof(int));
int *var_dfrm = (int*) Malloc(nrecs*sizeof(int));
recID = 0;
int recID = 0;
for ( ivar = 0; ivar < nvars; ++ivar )
{
/*
......@@ -351,13 +336,13 @@ void *Importbinary(void *argument)
int calendar = CALENDAR_STANDARD;
taxisID = taxisCreate(TAXIS_RELATIVE);
int taxisID = taxisCreate(TAXIS_RELATIVE);
taxisDefCalendar(taxisID, calendar);
vlistDefTaxis(vlistID, taxisID);
streamID = streamOpenWrite(cdoStreamName(1), cdoFiletype());
int streamID = streamOpenWrite(cdoStreamName(1), cdoFiletype());
streamDefVlist(streamID, vlistID);
......
......@@ -161,7 +161,6 @@ int defLonLatGrid(int nx, int ny, double c0, double lts, double re)
double r0, s0;
double r, s;
double xla, phi;
double *xvals, *yvals, *xbounds, *ybounds;
get_grid_info(c0, re, &nrx, &nry, &r0, &s0, &c);
......@@ -171,10 +170,10 @@ int defLonLatGrid(int nx, int ny, double c0, double lts, double re)
return(-1);
}
xvals = (double*) Malloc(nx*sizeof(double));
yvals = (double*) Malloc(ny*sizeof(double));
xbounds = (double*) Malloc(nx*2*sizeof(double));
ybounds = (double*) Malloc(nx*2*sizeof(double));
double *xvals = (double*) Malloc(nx*sizeof(double));
double *yvals = (double*) Malloc(ny*sizeof(double));
double *xbounds = (double*) Malloc(nx*2*sizeof(double));
double *ybounds = (double*) Malloc(nx*2*sizeof(double));
for ( i = 0; i < nx; ++i )
{
......@@ -214,7 +213,7 @@ int defLonLatGrid(int nx, int ny, double c0, double lts, double re)
Free(xbounds);
Free(ybounds);
return (gridID);
return gridID;
}
static
......@@ -236,12 +235,10 @@ int defSinusoidalGrid(int nx, int ny, double xmin, double xmax, double ymin, dou
for ( int i = 0; i < ny; ++i )
yvals[i] = ymax - i*dy - dy/2;
#ifdef TEST_PROJECTION
int gridID = gridCreate(GRID_PROJECTION, nx*ny);
grid_def_param_sinu(gridID);
#else
int gridID = gridCreate(GRID_SINUSOIDAL, nx*ny);
#endif
gridDefXsize(gridID, nx);
gridDefYsize(gridID, ny);
gridDefXvals(gridID, xvals);
......@@ -268,20 +265,14 @@ int defLaeaGrid(int nx, int ny, double xmin, double xmax, double ymin, double ym
for ( int i = 0; i < ny; ++i )
yvals[i] = ymax - i*dy - dy/2;
#ifdef TEST_PROJECTION
int gridID = gridCreate(GRID_PROJECTION, nx*ny);
#else
int gridID = gridCreate(GRID_LAEA, nx*ny);
#endif
gridDefXsize(gridID, nx);
gridDefYsize(gridID, ny);
gridDefXvals(gridID, xvals);
gridDefYvals(gridID, yvals);
#ifdef TEST_PROJECTION
grid_def_param_laea(gridID, a, lon0, lat0);
#else
gridDefLaea(gridID, a, lon0, lat0);
#endif
Free(xvals);
Free(yvals);
......
......@@ -48,13 +48,10 @@ void init_vars(int vlistID, int gridID, int zaxisID, int nvars)
static
void init_data(int vlistID, int nvars, double *data[])
{
int gridsize;
double missval;
for ( int varID = 0; varID < nvars; ++varID )
{
gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID));
missval = vlistInqVarMissval(vlistID, varID);
int gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID));
double missval = vlistInqVarMissval(vlistID, varID);
for ( int i = 0; i < gridsize; ++i ) data[varID][i] = missval;
}
......@@ -63,18 +60,14 @@ void init_data(int vlistID, int nvars, double *data[])
static
void write_data(int streamID, int vlistID, int nvars, double *data[])
{