Commit 109a643d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Check for CDI_FILETYPE_NC5.

parent 787f5fb5
......@@ -124,6 +124,9 @@ static int cdfOpenFile(const char *filename, const char *mode, int *filetype)
#ifdef NC_64BIT_OFFSET
if ( *filetype == CDI_FILETYPE_NC2 ) writemode |= NC_64BIT_OFFSET;
#endif
#ifdef NC_64BIT_DATA
if ( *filetype == CDI_FILETYPE_NC5 ) writemode |= NC_64BIT_DATA;
#endif
#ifdef HAVE_NETCDF4
if ( *filetype == CDI_FILETYPE_NC4 ) writemode |= NC_NETCDF4;
else if ( *filetype == CDI_FILETYPE_NC4C ) writemode |= NC_NETCDF4 | NC_CLASSIC_MODEL;
......@@ -154,18 +157,12 @@ int cdfOpen(const char *filename, const char *mode, int filetype)
Message("Open %s with mode %c", filename, *mode);
#ifdef HAVE_LIBNETCDF
if ( filetype == CDI_FILETYPE_NC2 )
{
#ifndef NC_64BIT_OFFSET
open_file = false;
if ( filetype == CDI_FILETYPE_NC2 ) open_file = false;
#endif
}
else if ( filetype == CDI_FILETYPE_NC5 )
{
#ifndef NC_64BIT_DATA
open_file = false;
if ( filetype == CDI_FILETYPE_NC5 ) open_file = false;
#endif
}
#endif
if ( open_file )
......
......@@ -97,7 +97,8 @@ void cdfDefVarMissval(stream_t *streamptr, int varID, int dtype, int lcheck)
if ( lcheck == 0 ||
streamptr->ncmode != 2 ||
streamptr->filetype == CDI_FILETYPE_NC ||
streamptr->filetype == CDI_FILETYPE_NC2 )
streamptr->filetype == CDI_FILETYPE_NC2||
streamptr->filetype == CDI_FILETYPE_NC5 )
cdf_put_att_double(fileID, ncvarid, "_FillValue", (nc_type) xtype, 1, &missval);
cdf_put_att_double(fileID, ncvarid, "missing_value", (nc_type) xtype, 1, &missval);
......
......@@ -29,6 +29,7 @@ static const char* fileType2String(int fileType)
case CDI_FILETYPE_NC2: return "CDI::Iterator::NetCDF2";
case CDI_FILETYPE_NC4: return "CDI::Iterator::NetCDF4";
case CDI_FILETYPE_NC4C: return "CDI::Iterator::NetCDF4C";
case CDI_FILETYPE_NC5: return "CDI::Iterator::NetCDF5";
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV: return "CDI::Iterator::SRV";
......@@ -63,6 +64,7 @@ static int string2FileType(const char* fileType, const char **outRestString)
check(fileType, "CDI::Iterator::NetCDF2", CDI_FILETYPE_NC2);
check(fileType, "CDI::Iterator::NetCDF4", CDI_FILETYPE_NC4);
check(fileType, "CDI::Iterator::NetCDF4C", CDI_FILETYPE_NC4C);
check(fileType, "CDI::Iterator::NetCDF5", CDI_FILETYPE_NC5);
check(fileType, "CDI::Iterator::SRV", CDI_FILETYPE_SRV);
check(fileType, "CDI::Iterator::EXT", CDI_FILETYPE_EXT);
check(fileType, "CDI::Iterator::IEG", CDI_FILETYPE_IEG);
......@@ -114,6 +116,7 @@ CdiIterator* cdiIterator_new(const char* path)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -203,6 +206,7 @@ CdiIterator* cdiIterator_clone(CdiIterator* me)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -284,6 +288,7 @@ char* cdiIterator_serialize(CdiIterator* me)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -343,6 +348,7 @@ CdiIterator* cdiIterator_deserialize(const char* description)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -415,6 +421,7 @@ int cdiIterator_nextField(CdiIterator* me)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -449,6 +456,7 @@ static char* cdiIterator_inqTime(CdiIterator* me, CdiTimeType timeType)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -609,6 +617,7 @@ int cdiIterator_inqLevelType(CdiIterator* me, int levelSelector, char **outName,
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -659,6 +668,7 @@ int cdiIterator_inqLevel(CdiIterator* me, int levelSelector, double* outValue1,
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -709,6 +719,7 @@ int cdiIterator_inqLevelUuid(CdiIterator* me, int* outVgridNumber, int* outLevel
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -758,6 +769,7 @@ int cdiIterator_inqTile(CdiIterator* me, int* outTileIndex, int* outTileAttribut
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -808,6 +820,7 @@ int cdiIterator_inqTileCount(CdiIterator* me, int* outTileCount, int* outTileAtt
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -938,6 +951,7 @@ char* cdiIterator_inqVariableName(CdiIterator* me)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -1008,6 +1022,7 @@ void cdiIterator_readField(CdiIterator* me, double* buffer, size_t* nmiss)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -1057,6 +1072,7 @@ void cdiIterator_readFieldF(CdiIterator* me, float* buffer, size_t* nmiss)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......@@ -1068,7 +1084,7 @@ void cdiIterator_readFieldF(CdiIterator* me, float* buffer, size_t* nmiss)
case CDI_FILETYPE_IEG:
#endif
cdiFallbackIterator_readFieldF(me, buffer, nmiss);
return;
return;
default:
Error(kUnexpectedFileTypeMessage);
}
......@@ -1102,6 +1118,7 @@ void cdiIterator_delete(CdiIterator* me)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
#endif
#ifdef HAVE_LIBSERVICE
case CDI_FILETYPE_SRV:
......
......@@ -1117,6 +1117,8 @@ readGetBuffers(size_t streamIdx, const struct cdiPioConf *conf)
case CDI_FILETYPE_NC:
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
writeNetCDFStream(streamIdx, map, &data, &currentDataBufSize, conf);
break;
#endif
......@@ -1262,6 +1264,7 @@ cdiPioServerStreamClose(stream_t *streamptr, int recordBufIsToBeDeleted)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
{
int rank, rankOpen = cdiPioSerialOpenFileMap(streamptr->self);
if (commInqIOMode() == PIO_NONE
......
#if defined (HAVE_CONFIG_H)
# include "config.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "dmemory.h"
......@@ -12,6 +12,7 @@ filetypeIsNetCDF(int filetype)
{
return filetype == CDI_FILETYPE_NC
|| filetype == CDI_FILETYPE_NC2
|| filetype == CDI_FILETYPE_NC5
|| filetype == CDI_FILETYPE_NC4
|| filetype == CDI_FILETYPE_NC4C;
}
......
......@@ -70,6 +70,7 @@ int cdiStreamReadVar(int streamID, int varID, int memtype, void *data, int *nmis
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
{
cdf_read_var(streamptr, varID, memtype, data, nmiss);
break;
......@@ -196,6 +197,7 @@ int cdiStreamReadVarSlice(int streamID, int varID, int levelID, int memtype, voi
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
{
cdf_read_var_slice(streamptr, varID, levelID, memtype, data, nmiss);
break;
......@@ -317,6 +319,7 @@ int stream_read_record(int streamID, int memtype, void *data, int *nmiss)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
cdf_read_record(streamptr, memtype, data, nmiss);
break;
#endif
......
#if defined (HAVE_CONFIG_H)
# include "config.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <limits.h>
......@@ -209,6 +209,7 @@ void streamDefRecord(int streamID, int varID, int levelID)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
if ( streamptr->accessmode == 0 ) cdfEndDef(streamptr);
cdfDefRecord(streamptr);
break;
......@@ -237,12 +238,14 @@ void streamCopyRecord(int streamID2, int streamID1)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
switch (filetype2)
{
case CDI_FILETYPE_NC:
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
// Warning("Streams have different file types (%s -> %s)!", strfiletype(filetype1), strfiletype(filetype2));
filetype = filetype2;
break;
......@@ -282,6 +285,7 @@ void streamCopyRecord(int streamID2, int streamID1)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
cdfCopyRecord(streamptr2, streamptr1);
break;
#endif
......
......@@ -72,6 +72,7 @@ int cdiStreamWriteVar_(int streamID, int varID, int memtype, const void *data, i
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
{
cdf_write_var(streamptr, varID, memtype, data, nmiss);
break;
......@@ -208,6 +209,7 @@ int cdiStreamWriteVarSlice(int streamID, int varID, int levelID, int memtype, co
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
cdf_write_var_slice(streamptr, varID, levelID, memtype, data, nmiss);
break;
#endif
......@@ -323,6 +325,7 @@ void cdiStreamWriteVarChunk_(int streamID, int varID, int memtype,
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
cdf_write_var_chunk(streamptr, varID, memtype, rect, data, nmiss);
break;
#endif
......@@ -374,6 +377,7 @@ int stream_write_record(int streamID, int memtype, const void *data, int nmiss)
case CDI_FILETYPE_NC2:
case CDI_FILETYPE_NC4:
case CDI_FILETYPE_NC4C:
case CDI_FILETYPE_NC5:
{
cdf_write_record(streamptr, memtype, data, nmiss);
break;
......
Supports Markdown
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