Commit e45c9153 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

set default missval of INT8/16/32 to SCHAR_MIN/SHRT_MIN/INT_MIN

parent b3675328
......@@ -3,6 +3,7 @@
* add support for GRID type SINUSOIDAL
* add support for GRID type LAEA
* add support of GRIB level type MEANSEA
* set default missval of INT8/16/32 to SCHAR_MIN/SHRT_MIN/INT_MIN
* move grid_lcc, grid_gme, grid_rot code to CDO
* move gridToCurvilinear and gridToCell code to CDO
* cdf_inq_contents: check zaxis type "depth_blow_sea/land" (bug fix)
......
......@@ -2,6 +2,8 @@
# include "config.h"
#endif
#include <limits.h>
#include "dmemory.h"
#include "cdi.h"
#include "stream_int.h"
......@@ -696,9 +698,35 @@ void vlistDefVarDatatype(int vlistID, int varID, int datatype)
vlistCheckVarID(func, vlistID, varID);
vlistptr->vars[varID].datatype = datatype;
vlistptr->vars[varID].datatype = datatype;
if ( vlistptr->vars[varID].missvalused == FALSE )
{
switch (datatype)
{
case DATATYPE_INT8:
vlistptr->vars[varID].missval = SCHAR_MIN;
break;
case DATATYPE_UINT8:
vlistptr->vars[varID].missval = UCHAR_MAX;
break;
case DATATYPE_INT16:
vlistptr->vars[varID].missval = SHRT_MIN;
break;
case DATATYPE_UINT16:
vlistptr->vars[varID].missval = USHRT_MAX;
break;
case DATATYPE_INT32:
vlistptr->vars[varID].missval = INT_MIN;
break;
case DATATYPE_UINT32:
vlistptr->vars[varID].missval = UINT_MAX;
break;
}
}
}
void vlistDefVarInstitut(int vlistID, int varID, int instID)
{
VLIST *vlistptr;
......@@ -708,6 +736,7 @@ void vlistDefVarInstitut(int vlistID, int varID, int instID)
vlistptr->vars[varID].instID = instID;
}
int vlistInqVarInstitut(int vlistID, int varID)
{
VLIST *vlistptr;
......@@ -717,6 +746,7 @@ int vlistInqVarInstitut(int vlistID, int varID)
return (vlistptr->vars[varID].instID);
}
void vlistDefVarModel(int vlistID, int varID, int modelID)
{
VLIST *vlistptr;
......@@ -726,6 +756,7 @@ void vlistDefVarModel(int vlistID, int varID, int modelID)
vlistptr->vars[varID].modelID = modelID;
}
int vlistInqVarModel(int vlistID, int varID)
{
VLIST *vlistptr;
......@@ -735,6 +766,7 @@ int vlistInqVarModel(int vlistID, int varID)
return (vlistptr->vars[varID].modelID);
}
void vlistDefVarTable(int vlistID, int varID, int tableID)
{
VLIST *vlistptr;
......@@ -744,6 +776,7 @@ void vlistDefVarTable(int vlistID, int varID, int tableID)
vlistptr->vars[varID].tableID = tableID;
}
int vlistInqVarTable(int vlistID, int varID)
{
int tableID;
......@@ -945,6 +978,7 @@ void vlistDefVarMissval(int vlistID, int varID, double missval)
vlistptr->vars[varID].missvalused = TRUE;
}
void vlistDefVarScalefactor(int vlistID, int varID, double scalefactor)
{
static char func[] = "vlistDefVarScalefactor";
......
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