Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • b383306/libcdi
  • mpim-sw/libcdi
  • m214007/libcdi
3 results
Show changes
Commits on Source (9)
......@@ -28,7 +28,7 @@ init_gcc ()
{
init_env
switch_for_module gcc/12.1.0 mpich/3.4.3-gcc-12.1.0
switch_for_module gcc/12.1.0 mpich/4.1.2-gcc-12.1.0
CC=gcc
CXX=g++
......@@ -38,9 +38,9 @@ init_gcc ()
MPI_LAUNCH="$(which mpirun)"
ECCODES_ROOT='/sw/bullseye-x64/packages/gcc-12.1.0/eccodes-2.26.0'
NETCDF_ROOT='/sw/bullseye-x64/packages/gcc-12.1.0/netcdf-c-4.9.0'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-gcc-12.1.0'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-gcc-12.1.0'
NETCDF_ROOT='/sw/bullseye-x64/packages/gcc-12.1.0/netcdf-c-4.9.2'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.2-mpich-4.1.2-gcc-12.1.0'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.10.0-mpich-4.1.2-gcc-12.1.0'
# The installations of NetCDF and ecCodes libraries do not provide '*.la'
# files, which would trigger the RPATH injection:
......@@ -54,7 +54,7 @@ init_nvhpc ()
{
init_env
switch_for_module nvhpc/22.3 mpich/3.4.3-nvhpc-22.3
switch_for_module nvhpc/23.7 mpich/4.1.2-nvhpc-23.7
CC=nvc
CXX=nvc++
......@@ -63,10 +63,10 @@ init_nvhpc ()
MPIFC=mpif90
MPI_LAUNCH="$(which mpirun)"
ECCODES_ROOT='/sw/bullseye-x64/packages/nvhpc-22.3/eccodes-2.26.0'
NETCDF_ROOT='/sw/bullseye-x64/packages/nvhpc-22.3/netcdf-c-4.9.0'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-nvhpc-22.3'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-nvhpc-22.3'
ECCODES_ROOT='/sw/bullseye-x64/packages/nvhpc-23.7/eccodes-2.26.0'
NETCDF_ROOT='/sw/bullseye-x64/packages/nvhpc-23.7/netcdf-c-4.9.2'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.2-mpich-4.1.2-nvhpc-23.7'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.10.0-mpich-4.1.2-nvhpc-23.7'
# The installations of NetCDF and ecCodes libraries do not provide '*.la'
# files, which would trigger the RPATH injection:
......@@ -93,9 +93,9 @@ init_clang ()
MPI_LAUNCH="$(which mpirun) --oversubscribe"
ECCODES_ROOT='/sw/bullseye-x64/packages/clang-14.0.6/eccodes-2.26.0'
NETCDF_ROOT='/sw/bullseye-x64/packages/clang-14.0.6/netcdf-c-4.9.0-openmpi-4.1.3'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-clang-14.0.6'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-clang-14.0.6'
NETCDF_ROOT='/sw/bullseye-x64/packages/clang-14.0.6/netcdf-c-4.9.2-openmpi-4.1.3'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.2-openmpi-4.1.3-clang-14.0.6'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.10.0-openmpi-4.1.3-clang-14.0.6'
# The installations of NetCDF and ecCodes libraries do not provide '*.la'
# files, which would trigger the RPATH injection:
......@@ -112,7 +112,7 @@ init_nag ()
init_env
switch_for_module nag/7.1 mpich/3.4.3-nag-7.1
switch_for_module nag/7.1.7125 mpich/4.1.2-nag-7.1.7125
CC=gcc
CXX=g++
......@@ -121,10 +121,10 @@ init_nag ()
MPIFC=mpif90
MPI_LAUNCH="$(which mpirun)"
ECCODES_ROOT='/sw/bullseye-x64/packages/nag-7.1/eccodes-2.26.0'
NETCDF_ROOT='/sw/bullseye-x64/packages/nag-7.1/netcdf-c-4.9.0-mpich-3.4.3'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.1-nag-7.1'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.9.3.1-nag-7.1'
ECCODES_ROOT='/sw/bullseye-x64/packages/nag-7.1.7125/eccodes-2.26.0'
NETCDF_ROOT='/sw/bullseye-x64/packages/nag-7.1.7125/netcdf-c-4.9.2-mpich-4.1.2'
PPM_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/ppm-1.0.8.2-mpich-4.1.2-nag-7.1.7125'
YAXT_ROOT='/data/mpi/sclab/sip/m300488/libcdi-ci-sw/yaxt-0.10.0-mpich-4.1.2-nag-7.1.7125'
# The installations of NetCDF and ecCodes libraries do not provide '*.la'
# files, which would trigger the RPATH injection:
......
......@@ -13,103 +13,107 @@ make_cmd='make -j22'
mkdir -p "${work_dir}" && cd "${work_dir}"
# Get PPM:
wget https://swprojects.dkrz.de/redmine/attachments/download/521/ppm-1.0.8.1.tar.gz
tar xvf ppm-1.0.8.1.tar.gz
ppm_src_dir="${work_dir}/ppm-1.0.8.1"
ppm_name_tag='ppm-1.0.8.1'
wget https://swprojects.dkrz.de/redmine/attachments/download/525/ppm-1.0.8.2.tar.gz
tar xvf ppm-1.0.8.2.tar.gz
ppm_src_dir="${work_dir}/ppm-1.0.8.2"
ppm_name_tag='ppm-1.0.8.2'
ppm_config_args='--enable-MPI --disable-netcdf --disable-hdf5 --disable-parmetis --disable-metis --disable-crypto'
# Get YAXT:
git clone -b release-0.9.3.1 https://gitlab.dkrz.de/dkrz-sw/yaxt.git
git -C yaxt cherry-pick 8c1b18bc9cfb3c7185017e37f8b39f7a61c94259
git clone -b release-0.10.0 https://gitlab.dkrz.de/dkrz-sw/yaxt.git
git -C yaxt cherry-pick 602493aad8c6e817f32c9a4889fc2a271573f896
yaxt_src_dir="${work_dir}/yaxt"
yaxt_name_tag='yaxt-0.9.3.1'
yaxt_name_tag='yaxt-0.10.0'
yaxt_config_args=''
export CC='mpicc'
export FC='mpif90'
# Install for GCC 12.1.0:
module load mpich/4.1.2-gcc-12.1.0
mpi_name_tag='mpich-4.1.2'
compiler_name_tag='gcc-12.1.0'
module load mpich/3.4.3-gcc-12.1.0
# Install PPM:
build_dir="${ppm_name_tag}-${compiler_name_tag}"
build_dir="${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -fallow-argument-mismatch'
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -fallow-argument-mismatch'
$make_cmd
$make_cmd check
$make_cmd install )
# Install YAXT:
build_dir="${yaxt_name_tag}-${compiler_name_tag}"
build_dir="${yaxt_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}"
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
$make_cmd
$make_cmd check
$make_cmd install )
module unload mpich/3.4.3-gcc-12.1.0
module unload mpich/4.1.2-gcc-12.1.0
# Install for NVHPC 22.3:
compiler_name_tag='nvhpc-22.3'
module load mpich/3.4.3-nvhpc-22.3
module load mpich/4.1.2-nvhpc-23.7
mpi_name_tag='mpich-4.1.2'
compiler_name_tag='nvhpc-23.7'
# Install PPM:
build_dir="${ppm_name_tag}-${compiler_name_tag}"
build_dir="${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -tp sandybridge' CFLAGS='-g -O2 -tp sandybridge'
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -tp sandybridge' CFLAGS='-g -O2 -tp sandybridge'
$make_cmd
$make_cmd check
$make_cmd install )
# Install YAXT:
build_dir="${yaxt_name_tag}-${compiler_name_tag}"
build_dir="${yaxt_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -tp sandybridge' CFLAGS='-g -O2 -tp sandybridge'
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${mpi_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -tp sandybridge' CFLAGS='-g -O2 -tp sandybridge'
$make_cmd
$make_cmd check
$make_cmd install )
module unload mpich/3.4.3-nvhpc-22.3
module unload mpich/4.1.2-nvhpc-23.7
# Install for Clang 14.0.6:
compiler_name_tag='clang-14.0.6'
module load openmpi/4.1.3-clang-14.0.6
mpi_name_tag='openmpi-4.1.3'
compiler_name_tag='clang-14.0.6'
# Install PPM:
build_dir="${ppm_name_tag}-${compiler_name_tag}"
build_dir="${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -no-pie'
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -no-pie'
$make_cmd
$make_cmd check
$make_cmd install )
# Install YAXT:
build_dir="${yaxt_name_tag}-${compiler_name_tag}"
build_dir="${yaxt_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -no-pie'
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${mpi_name_tag}-${compiler_name_tag}" FCFLAGS='-g -O2 -no-pie'
$make_cmd
$make_cmd check
$make_cmd install )
module unload openmpi/4.1.3-clang-14.0.6
# Install for NAG 7.1:
compiler_name_tag='nag-7.1'
module load mpich/3.4.3-nag-7.1
# Install for NAG 7.1.7125:
module load mpich/4.1.2-nag-7.1.7125
mpi_name_tag='mpich-4.1.2'
compiler_name_tag='nag-7.1.7125'
# Install PPM:
build_dir="${ppm_name_tag}-${compiler_name_tag}"
build_dir="${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${compiler_name_tag}" FC=no
"${ppm_src_dir}/configure" ${ppm_config_args} --prefix="${install_dir}/${ppm_name_tag}-${mpi_name_tag}-${compiler_name_tag}" FC=no
$make_cmd
$make_cmd check
$make_cmd install )
......@@ -118,9 +122,9 @@ mkdir "${build_dir}"
build_dir="${yaxt_name_tag}-${compiler_name_tag}"
mkdir "${build_dir}"
( cd "${build_dir}"
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${compiler_name_tag}"
"${yaxt_src_dir}/configure" ${yaxt_config_args} --prefix="${install_dir}/${yaxt_name_tag}-${mpi_name_tag}-${compiler_name_tag}"
$make_cmd
$make_cmd check
$make_cmd install )
module unload mpich/3.4.3-nag-7.1
module unload mpich/4.1.2-nag-7.1.7125
......@@ -42,6 +42,7 @@ Makefile.in
Makefile
# Build stage files:
*.L
*.la
*.lo
*.mod
......
2023-10-19 Uwe Schulzweida
* Version 2.3.0 released
2023-09-29 Uwe Schulzweida
* Add interface function streamDefShuffle()
2023-08-15 Uwe Schulzweida
* Version 2.2.4 released
......
......@@ -7,7 +7,7 @@
AC_PREREQ([2.69])
LT_PREREQ([2.4.6])
AC_INIT([cdi],[2.2.4],[https://mpimet.mpg.de/cdi])
AC_INIT([cdi],[2.3.0],[https://mpimet.mpg.de/cdi])
AC_DEFINE_UNQUOTED(CDI, ["$PACKAGE_VERSION"], [CDI version])
AC_CONFIG_AUX_DIR([config])
......
......@@ -36,11 +36,12 @@ cdf_def_var_filter(int ncid, int ncvarID, unsigned int id, size_t nparams, const
}
void
cdfDefVarDeflate(int ncid, int ncvarID, int compLevel)
cdfDefVarDeflate(int ncid, int ncvarID, int shuffle, int compLevel)
{
#ifdef HAVE_NETCDF4
// Set chunking, shuffle, and deflate.
int shuffle = (CDI_Shuffle > 0), deflate = 1;
int deflate = 1;
if (CDI_Shuffle > 0 && shuffle == 0) shuffle = 1;
if (compLevel < 1 || compLevel > 9) compLevel = 1;
......@@ -487,7 +488,7 @@ cdfDefVarCompression(const stream_t *streamptr, int ncvarID, nc_type xtype)
if (streamptr->filetype == CDI_FILETYPE_NC4 || streamptr->filetype == CDI_FILETYPE_NC4C
|| streamptr->filetype == CDI_FILETYPE_NCZARR)
{
cdfDefVarDeflate(streamptr->fileID, ncvarID, streamptr->complevel);
cdfDefVarDeflate(streamptr->fileID, ncvarID, streamptr->shuffle, streamptr->complevel);
}
else
{
......
......@@ -387,6 +387,8 @@ void streamDefByteorder(int streamID, int byteorder);
// streamInqByteorder: Get the byteorder
int streamInqByteorder(int streamID);
void streamDefShuffle(int streamID, int shuffle);
void streamDefFilter(int streamID, int filterId, int nparams, const int *params);
// streamDefCompType: Define compression type
......
......@@ -301,6 +301,7 @@ typedef struct
int localatts;
int unreduced;
int have_missval;
int shuffle;
// netcdf4/HDF5 filter
unsigned int filterId;
size_t numParams;
......
......@@ -1007,6 +1007,7 @@ streamDefaultValue(stream_t *streamptr)
streamptr->have_missval = cdiHaveMissval;
streamptr->comptype = CDI_COMPRESS_NONE;
streamptr->complevel = 0;
streamptr->shuffle = 0;
// netcdf4/HDF5 filter
streamptr->filterId = 0;
streamptr->numParams = 0;
......@@ -1201,30 +1202,34 @@ streamDestroy(stream_t *streamptr)
void (*streamCloseDelegate)(stream_t * streamptr, int recordBufIsToBeDeleted)
= (void (*)(stream_t *, int)) namespaceSwitchGet(NSSWITCH_STREAM_CLOSE_BACKEND).func;
if (streamptr->filetype != -1) streamCloseDelegate(streamptr, 1);
if (streamptr->filetype != CDI_FILETYPE_UNDEF) streamCloseDelegate(streamptr, 1);
if (streamptr->record)
{
if (streamptr->record->buffer) Free(streamptr->record->buffer);
Free(streamptr->record);
streamptr->record = NULL;
}
streamptr->filetype = 0;
streamptr->filetype = CDI_FILETYPE_UNDEF;
if (streamptr->filename)
{
Free(streamptr->filename);
streamptr->filename = NULL;
}
for (int index = 0; index < streamptr->nvars; index++)
if (streamptr->vars)
{
sleveltable_t *pslev = streamptr->vars[index].recordTable;
unsigned nsub = streamptr->vars[index].subtypeSize >= 0 ? (unsigned) streamptr->vars[index].subtypeSize : 0U;
for (size_t isub = 0; isub < nsub; isub++) deallocate_sleveltable_t(pslev + isub);
if (pslev) Free(pslev);
for (int index = 0; index < streamptr->nvars; index++)
{
sleveltable_t *pslev = streamptr->vars[index].recordTable;
unsigned nsub = streamptr->vars[index].subtypeSize >= 0 ? (unsigned) streamptr->vars[index].subtypeSize : 0U;
for (size_t isub = 0; isub < nsub; isub++) deallocate_sleveltable_t(pslev + isub);
if (pslev) Free(pslev);
}
Free(streamptr->vars);
streamptr->vars = NULL;
}
Free(streamptr->vars);
streamptr->vars = NULL;
if (streamptr->tsteps)
{
......@@ -1241,11 +1246,13 @@ streamDestroy(stream_t *streamptr)
}
Free(streamptr->tsteps);
streamptr->tsteps = NULL;
}
if (vlistID != -1)
{
if (streamptr->filemode != 'w' && vlistInqTaxis(vlistID) != -1) taxisDestroy(vlistInqTaxis(vlistID));
int taxisID = (streamptr->filemode != 'w') ? vlistInqTaxis(vlistID) : -1;
if (taxisID != -1) taxisDestroy(taxisID);
void (*mycdiVlistDestroy_)(int, bool) = (void (*)(int, bool)) namespaceSwitchGet(NSSWITCH_VLIST_DESTROY_).func;
mycdiVlistDestroy_(vlistID, true);
}
......@@ -1601,6 +1608,17 @@ streamInqVlist(int streamID)
return s->vlistID;
}
void
streamDefShuffle(int streamID, int shuffle)
{
stream_t *s = stream_to_pointer(streamID);
if (s->shuffle != shuffle)
{
s->shuffle = shuffle;
reshSetStatus(streamID, &streamOps, RESH_DESYNC_IN_USE);
}
}
void
streamDefFilter(int streamID, int filterId, int numParams, const int *params)
{
......
......@@ -47,7 +47,7 @@ void cdf_write_var_slice(stream_t *streamptr, int varID, int levelID, int memtyp
void cdf_write_var_chunk(stream_t *streamptr, int varID, int memtype, const int rect[][2], const void *data, size_t nmiss);
void cdfDefVarDeflate(int ncid, int ncvarid, int deflateLevel);
void cdfDefVarDeflate(int ncid, int ncvarid, int shuffle, int deflateLevel);
void cdfDefTime(stream_t *streamptr);
void cdf_scale_add(size_t size, double *data, double addoffset, double scalefactor);
......
......@@ -33,6 +33,8 @@ enum AxisType
T_AXIS = 5,
};
static int axisTypeChar[] = { '?', 'X', 'Y', 'Z', 'E', 'T' };
typedef struct
{
int dimid;
......@@ -689,8 +691,8 @@ cdf_set_dim(ncvar_t *ncvar, int dimid, int dimtype)
{
if (ncvar->dimtype[dimid] != CDI_UNDEFID && ncvar->dimtype[dimid] != dimtype)
{
Warning("Inconsistent dimension definition for %s! dimid = %d; type = %d; newtype = %d", ncvar->name, dimid,
ncvar->dimtype[dimid], dimtype);
Warning("Inconsistent dimension definition for %s! dimid=%d type=%c newtype=%c", ncvar->name, dimid,
axisTypeChar[ncvar->dimtype[dimid]], axisTypeChar[dimtype]);
}
ncvar->dimtype[dimid] = dimtype;
......@@ -3650,9 +3652,10 @@ cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int modelID, i
*/
if (ncvar->numberOfForecastsInEnsemble != -1)
{
cdiDefKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, ncvar->typeOfEnsembleForecast);
cdiDefKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, ncvar->numberOfForecastsInEnsemble);
cdiDefKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, ncvar->perturbationNumber);
if (ncvar->numberOfForecastsInEnsemble != -1)
cdiDefKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, ncvar->typeOfEnsembleForecast);
}
if (ncvar->extra[0] != 0) cdiDefKeyString(vlistID, varID, CDI_KEY_CHUNKS, ncvar->extra);
......
......@@ -544,7 +544,8 @@ cdfGridCompress(int fileID, int ncvarid, size_t gridsize, int filetype, int comp
&& (filetype == CDI_FILETYPE_NC4 || filetype == CDI_FILETYPE_NC4C || filetype == CDI_FILETYPE_NCZARR))
{
cdf_def_var_chunking(fileID, ncvarid, NC_CHUNKED, chunks);
cdfDefVarDeflate(fileID, ncvarid, 1);
int shuffle = 1, compLevel = 1;
cdfDefVarDeflate(fileID, ncvarid, shuffle, compLevel);
}
#endif
}
......
......@@ -2023,14 +2023,14 @@ cgribexDefEnsembleVar(int *isec1, int vlistID, int varID)
// Put2Byte(isec1[38]); // individual ensemble member
// Put2Byte(isec1[39]); // number of forecasts in ensemble
int perturbationNumber, numberOfForecastsInEnsemble, typeOfEnsembleForecast;
int r1 = cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber);
int r2 = cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble);
int r3 = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast);
if (r1 == 0 && r2 == 0 && r3 == 0)
if (ISEC1_CenterID == 252)
{
if (ISEC1_CenterID == 252)
int perturbationNumber, numberOfForecastsInEnsemble, typeOfEnsembleForecast;
int r1 = cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber);
int r2 = cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble);
int r3 = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast);
if (r1 == 0 && r2 == 0 && r3 == 0)
{
ISEC1_LocalFLag = 1;
isec1[36] = 1;
......
......@@ -423,21 +423,21 @@ param_to_name(int param, char *name)
}
static int
gribapiGetEnsembleInfo(grib_handle *gh, long *typeOfEnsembleForecast, long *numberOfForecastsInEnsemble, long *perturbationNumber)
gribapiGetEnsembleInfo(grib_handle *gh, long *numberOfForecastsInEnsemble, long *perturbationNumber, long *typeOfEnsembleForecast)
{
int status = 0;
if (grib_get_long(gh, "typeOfEnsembleForecast", typeOfEnsembleForecast) == 0)
if (grib_get_long(gh, "numberOfForecastsInEnsemble", numberOfForecastsInEnsemble) == 0)
{
GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", numberOfForecastsInEnsemble), 0);
if (*numberOfForecastsInEnsemble > 0) status = 1;
GRIB_CHECK(grib_get_long(gh, "perturbationNumber", perturbationNumber), 0);
if (*perturbationNumber > 0) status = 1;
grib_get_long(gh, "typeOfEnsembleForecast", typeOfEnsembleForecast);
}
if (status == 0)
{
*typeOfEnsembleForecast = 0;
*perturbationNumber = 0;
*numberOfForecastsInEnsemble = 0;
*numberOfForecastsInEnsemble = -1;
*perturbationNumber = -1;
*typeOfEnsembleForecast = -1;
}
return status;
......@@ -449,8 +449,8 @@ gribapiGetScanKeys(grib_handle *gh)
VarScanKeys scanKeys;
varScanKeysInit(&scanKeys);
long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0;
gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber);
long numberOfForecastsInEnsemble = -1, perturbationNumber = -1, typeOfEnsembleForecast = -1;
gribapiGetEnsembleInfo(gh, &numberOfForecastsInEnsemble, &perturbationNumber, &typeOfEnsembleForecast);
scanKeys.perturbationNumber = (short) perturbationNumber;
long typeOfGeneratingProcess = 0;
......@@ -518,16 +518,16 @@ gribapiGetKeys(grib_handle *gh, int varID)
*/
/*
Get the ensemble Info from the grib-2 Tables and update the intermediate datastructure.
Get the ensemble information from the grib-2 Tables and update the intermediate datastructure.
Further update to the "vlist" is handled in the same way as for GRIB-1 by "cdi_generate_vars"
*/
long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0;
gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber);
if (perturbationNumber > 0)
long numberOfForecastsInEnsemble = -1, perturbationNumber = -1, typeOfEnsembleForecast = -1;
gribapiGetEnsembleInfo(gh, &numberOfForecastsInEnsemble, &perturbationNumber, &typeOfEnsembleForecast);
if (numberOfForecastsInEnsemble > 0)
{
varDefKeyInt(varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, (int) typeOfEnsembleForecast);
varDefKeyInt(varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, (int) numberOfForecastsInEnsemble);
varDefKeyInt(varID, CDI_KEY_PERTURBATIONNUMBER, (int) perturbationNumber);
if (typeOfEnsembleForecast != -1) varDefKeyInt(varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, (int) typeOfEnsembleForecast);
}
long section2Length = 0;
......@@ -3288,12 +3288,12 @@ gribapiEncode(int memType, int varID, int levelID, int vlistID, int gridID, int
{
int status, perturbationNumber, numberOfForecastsInEnsemble, typeOfEnsembleForecast;
status = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast);
if (status == 0) grib_set_long(gh, "typeOfEnsembleForecast", typeOfEnsembleForecast);
status = cdiInqKeyInt(vlistID, varID, CDI_KEY_NUMBEROFFORECASTSINENSEMBLE, &numberOfForecastsInEnsemble);
if (status == 0) grib_set_long(gh, "numberOfForecastsInEnsemble", numberOfForecastsInEnsemble);
status = cdiInqKeyInt(vlistID, varID, CDI_KEY_PERTURBATIONNUMBER, &perturbationNumber);
if (status == 0) grib_set_long(gh, "perturbationNumber", perturbationNumber);
status = cdiInqKeyInt(vlistID, varID, CDI_KEY_TYPEOFENSEMBLEFORECAST, &typeOfEnsembleForecast);
if (status == 0) grib_set_long(gh, "typeOfEnsembleForecast", typeOfEnsembleForecast);
}
if (!gc->init) gribapiDefInstitut(gh, vlistID, varID);
......