Commit 6fef6aca authored by Uwe Schulzweida's avatar Uwe Schulzweida

gridDefParamRLL: set x/y units to degrees

parent b8e80160
2019-12-03 Uwe Schulzweida
2021-01-25 Uwe Schulzweida
* using CGRIBEX library version 1.9.5
* Version 1.9.10 released
2021-01-07 Uwe Schulzweida
* gridDefParamRLL: set x/y units to degrees
2020-12-03 Uwe Schulzweida
* gridDefParamLCC: write latitude_of_projection_origin to lat_0 (bug fix)
2019-11-27 Uwe Schulzweida
2020-11-27 Uwe Schulzweida
* struct record_t: changed data type of levelID from short to int
2019-11-26 Uwe Schulzweida
2020-11-26 Uwe Schulzweida
* cdi.h: removed function gaussianLatitudes() from cdi interface
2019-10-09 Uwe Schulzweida
2020-10-09 Uwe Schulzweida
* using CGRIBEX library version 1.9.5
* Version 1.9.9 released
......
......@@ -1900,6 +1900,9 @@ void gridInqParamRLL(int gridID, double *xpole, double *ypole, double *angle)
*/
void gridDefParamRLL(int gridID, double xpole, double ypole, double angle)
{
cdiDefKeyString(gridID, CDI_XAXIS, CDI_KEY_UNITS, "degrees");
cdiDefKeyString(gridID, CDI_YAXIS, CDI_KEY_UNITS, "degrees");
cdiDefKeyString(gridID, CDI_GLOBAL, CDI_KEY_GRIDMAP_VARNAME, "rotated_pole");
const char *gmapname = "rotated_latitude_longitude";
......
......@@ -75,156 +75,152 @@ void streamGrbDefDataScanningMode(int scanmode)
int grib1ltypeToZaxisType(int grib_ltype)
{
int zaxistype = ZAXIS_GENERIC;
// clang-format off
switch ( grib_ltype )
{
case GRIB1_LTYPE_SURFACE: zaxistype = ZAXIS_SURFACE; break;
case GRIB1_LTYPE_CLOUD_BASE: zaxistype = ZAXIS_CLOUD_BASE; break;
case GRIB1_LTYPE_CLOUD_TOP: zaxistype = ZAXIS_CLOUD_TOP; break;
case GRIB1_LTYPE_ISOTHERM0: zaxistype = ZAXIS_ISOTHERM_ZERO; break;
case GRIB1_LTYPE_TROPOPAUSE: zaxistype = ZAXIS_TROPOPAUSE; break;
case GRIB1_LTYPE_TOA: zaxistype = ZAXIS_TOA; break;
case GRIB1_LTYPE_SEA_BOTTOM: zaxistype = ZAXIS_SEA_BOTTOM; break;
case GRIB1_LTYPE_ATMOSPHERE: zaxistype = ZAXIS_ATMOSPHERE; break;
case GRIB1_LTYPE_MEANSEA: zaxistype = ZAXIS_MEANSEA; break;
case GRIB1_LTYPE_SURFACE: return ZAXIS_SURFACE;
case GRIB1_LTYPE_CLOUD_BASE: return ZAXIS_CLOUD_BASE;
case GRIB1_LTYPE_CLOUD_TOP: return ZAXIS_CLOUD_TOP;
case GRIB1_LTYPE_ISOTHERM0: return ZAXIS_ISOTHERM_ZERO;
case GRIB1_LTYPE_TROPOPAUSE: return ZAXIS_TROPOPAUSE;
case GRIB1_LTYPE_TOA: return ZAXIS_TOA;
case GRIB1_LTYPE_SEA_BOTTOM: return ZAXIS_SEA_BOTTOM;
case GRIB1_LTYPE_ATMOSPHERE: return ZAXIS_ATMOSPHERE;
case GRIB1_LTYPE_MEANSEA: return ZAXIS_MEANSEA;
case GRIB1_LTYPE_99:
case GRIB1_LTYPE_ISOBARIC_PA:
case GRIB1_LTYPE_ISOBARIC: zaxistype = ZAXIS_PRESSURE; break;
case GRIB1_LTYPE_HEIGHT: zaxistype = ZAXIS_HEIGHT; break;
case GRIB1_LTYPE_ALTITUDE: zaxistype = ZAXIS_ALTITUDE; break;
case GRIB1_LTYPE_ISOBARIC: return ZAXIS_PRESSURE;
case GRIB1_LTYPE_HEIGHT: return ZAXIS_HEIGHT;
case GRIB1_LTYPE_ALTITUDE: return ZAXIS_ALTITUDE;
case GRIB1_LTYPE_SIGMA:
case GRIB1_LTYPE_SIGMA_LAYER: zaxistype = ZAXIS_SIGMA; break;
case GRIB1_LTYPE_SIGMA_LAYER: return ZAXIS_SIGMA;
case GRIB1_LTYPE_HYBRID:
case GRIB1_LTYPE_HYBRID_LAYER: zaxistype = ZAXIS_HYBRID; break;
case GRIB1_LTYPE_HYBRID_LAYER: return ZAXIS_HYBRID;
case GRIB1_LTYPE_LANDDEPTH:
case GRIB1_LTYPE_LANDDEPTH_LAYER: zaxistype = ZAXIS_DEPTH_BELOW_LAND; break;
case GRIB1_LTYPE_ISENTROPIC: zaxistype = ZAXIS_ISENTROPIC; break;
case GRIB1_LTYPE_SEADEPTH: zaxistype = ZAXIS_DEPTH_BELOW_SEA; break;
case GRIB1_LTYPE_LAKE_BOTTOM: zaxistype = ZAXIS_LAKE_BOTTOM; break;
case GRIB1_LTYPE_SEDIMENT_BOTTOM: zaxistype = ZAXIS_SEDIMENT_BOTTOM; break;
case GRIB1_LTYPE_SEDIMENT_BOTTOM_TA: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA; break;
case GRIB1_LTYPE_SEDIMENT_BOTTOM_TW: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW; break;
case GRIB1_LTYPE_MIX_LAYER: zaxistype = ZAXIS_MIX_LAYER; break;
case GRIB1_LTYPE_LANDDEPTH_LAYER: return ZAXIS_DEPTH_BELOW_LAND;
case GRIB1_LTYPE_ISENTROPIC: return ZAXIS_ISENTROPIC;
case GRIB1_LTYPE_SEADEPTH: return ZAXIS_DEPTH_BELOW_SEA;
case GRIB1_LTYPE_LAKE_BOTTOM: return ZAXIS_LAKE_BOTTOM;
case GRIB1_LTYPE_SEDIMENT_BOTTOM: return ZAXIS_SEDIMENT_BOTTOM;
case GRIB1_LTYPE_SEDIMENT_BOTTOM_TA: return ZAXIS_SEDIMENT_BOTTOM_TA;
case GRIB1_LTYPE_SEDIMENT_BOTTOM_TW: return ZAXIS_SEDIMENT_BOTTOM_TW;
case GRIB1_LTYPE_MIX_LAYER: return ZAXIS_MIX_LAYER;
}
// clang-format on
return zaxistype;
return ZAXIS_GENERIC;
}
int grib2ltypeToZaxisType(int grib_ltype)
{
int zaxistype = ZAXIS_GENERIC;
// clang-format off
switch ( grib_ltype )
{
case GRIB2_LTYPE_SURFACE: zaxistype = ZAXIS_SURFACE; break;
case GRIB2_LTYPE_CLOUD_BASE: zaxistype = ZAXIS_CLOUD_BASE; break;
case GRIB2_LTYPE_CLOUD_TOP: zaxistype = ZAXIS_CLOUD_TOP; break;
case GRIB2_LTYPE_ISOTHERM0: zaxistype = ZAXIS_ISOTHERM_ZERO; break;
case GRIB2_LTYPE_TROPOPAUSE: zaxistype = ZAXIS_TROPOPAUSE; break;
case GRIB2_LTYPE_TOA: zaxistype = ZAXIS_TOA; break;
case GRIB2_LTYPE_SEA_BOTTOM: zaxistype = ZAXIS_SEA_BOTTOM; break;
case GRIB2_LTYPE_ATMOSPHERE: zaxistype = ZAXIS_ATMOSPHERE; break;
case GRIB2_LTYPE_MEANSEA: zaxistype = ZAXIS_MEANSEA; break;
case GRIB2_LTYPE_ISOBARIC: zaxistype = ZAXIS_PRESSURE; break;
case GRIB2_LTYPE_HEIGHT: zaxistype = ZAXIS_HEIGHT; break;
case GRIB2_LTYPE_ALTITUDE: zaxistype = ZAXIS_ALTITUDE; break;
case GRIB2_LTYPE_SIGMA: zaxistype = ZAXIS_SIGMA; break;
case GRIB2_LTYPE_SURFACE: return ZAXIS_SURFACE;
case GRIB2_LTYPE_CLOUD_BASE: return ZAXIS_CLOUD_BASE;
case GRIB2_LTYPE_CLOUD_TOP: return ZAXIS_CLOUD_TOP;
case GRIB2_LTYPE_ISOTHERM0: return ZAXIS_ISOTHERM_ZERO;
case GRIB2_LTYPE_TROPOPAUSE: return ZAXIS_TROPOPAUSE;
case GRIB2_LTYPE_TOA: return ZAXIS_TOA;
case GRIB2_LTYPE_SEA_BOTTOM: return ZAXIS_SEA_BOTTOM;
case GRIB2_LTYPE_ATMOSPHERE: return ZAXIS_ATMOSPHERE;
case GRIB2_LTYPE_MEANSEA: return ZAXIS_MEANSEA;
case GRIB2_LTYPE_ISOBARIC: return ZAXIS_PRESSURE;
case GRIB2_LTYPE_HEIGHT: return ZAXIS_HEIGHT;
case GRIB2_LTYPE_ALTITUDE: return ZAXIS_ALTITUDE;
case GRIB2_LTYPE_SIGMA: return ZAXIS_SIGMA;
case GRIB2_LTYPE_HYBRID:
/* case GRIB2_LTYPE_HYBRID_LAYER: */ zaxistype = ZAXIS_HYBRID; break;
/* case GRIB2_LTYPE_HYBRID_LAYER: */ return ZAXIS_HYBRID;
case GRIB2_LTYPE_LANDDEPTH:
/* case GRIB2_LTYPE_LANDDEPTH_LAYER: */ zaxistype = ZAXIS_DEPTH_BELOW_LAND; break;
case GRIB2_LTYPE_ISENTROPIC: zaxistype = ZAXIS_ISENTROPIC; break;
case GRIB2_LTYPE_SNOW: zaxistype = ZAXIS_SNOW; break;
case GRIB2_LTYPE_SEADEPTH: zaxistype = ZAXIS_DEPTH_BELOW_SEA; break;
case GRIB2_LTYPE_LAKE_BOTTOM: zaxistype = ZAXIS_LAKE_BOTTOM; break;
case GRIB2_LTYPE_SEDIMENT_BOTTOM: zaxistype = ZAXIS_SEDIMENT_BOTTOM; break;
case GRIB2_LTYPE_SEDIMENT_BOTTOM_TA: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TA; break;
case GRIB2_LTYPE_SEDIMENT_BOTTOM_TW: zaxistype = ZAXIS_SEDIMENT_BOTTOM_TW; break;
case GRIB2_LTYPE_MIX_LAYER: zaxistype = ZAXIS_MIX_LAYER; break;
case GRIB2_LTYPE_REFERENCE: zaxistype = ZAXIS_REFERENCE; break;
/* case GRIB2_LTYPE_LANDDEPTH_LAYER: */ return ZAXIS_DEPTH_BELOW_LAND;
case GRIB2_LTYPE_ISENTROPIC: return ZAXIS_ISENTROPIC;
case GRIB2_LTYPE_SNOW: return ZAXIS_SNOW;
case GRIB2_LTYPE_SEADEPTH: return ZAXIS_DEPTH_BELOW_SEA;
case GRIB2_LTYPE_LAKE_BOTTOM: return ZAXIS_LAKE_BOTTOM;
case GRIB2_LTYPE_SEDIMENT_BOTTOM: return ZAXIS_SEDIMENT_BOTTOM;
case GRIB2_LTYPE_SEDIMENT_BOTTOM_TA: return ZAXIS_SEDIMENT_BOTTOM_TA;
case GRIB2_LTYPE_SEDIMENT_BOTTOM_TW: return ZAXIS_SEDIMENT_BOTTOM_TW;
case GRIB2_LTYPE_MIX_LAYER: return ZAXIS_MIX_LAYER;
case GRIB2_LTYPE_REFERENCE: return ZAXIS_REFERENCE;
}
// clang-format on
return zaxistype;
return ZAXIS_GENERIC;
}
int zaxisTypeToGrib1ltype(int zaxistype)
{
int grib_ltype = -1;
// clang-format off
switch (zaxistype)
{
case ZAXIS_SURFACE: grib_ltype = GRIB1_LTYPE_SURFACE; break;
case ZAXIS_GENERIC: grib_ltype = -1; break;
case ZAXIS_HYBRID: grib_ltype = -1; break;
case ZAXIS_HYBRID_HALF: grib_ltype = -1; break;
case ZAXIS_PRESSURE: grib_ltype = GRIB1_LTYPE_ISOBARIC; break;
case ZAXIS_HEIGHT: grib_ltype = GRIB1_LTYPE_HEIGHT; break;
case ZAXIS_DEPTH_BELOW_SEA: grib_ltype = GRIB1_LTYPE_SEADEPTH; break;
case ZAXIS_DEPTH_BELOW_LAND: grib_ltype = GRIB1_LTYPE_LANDDEPTH; break;
case ZAXIS_ISENTROPIC: grib_ltype = GRIB1_LTYPE_ISENTROPIC; break;
case ZAXIS_TRAJECTORY: grib_ltype = -1; break;
case ZAXIS_ALTITUDE: grib_ltype = GRIB1_LTYPE_ALTITUDE; break;
case ZAXIS_SIGMA: grib_ltype = GRIB1_LTYPE_SIGMA; break;
case ZAXIS_MEANSEA: grib_ltype = GRIB1_LTYPE_MEANSEA; break;
case ZAXIS_TROPOPAUSE: grib_ltype = GRIB1_LTYPE_TROPOPAUSE; break;
case ZAXIS_TOA: grib_ltype = GRIB1_LTYPE_TOA; break;
case ZAXIS_SEA_BOTTOM: grib_ltype = GRIB1_LTYPE_SEA_BOTTOM; break;
case ZAXIS_ATMOSPHERE: grib_ltype = GRIB1_LTYPE_ATMOSPHERE; break;
case ZAXIS_CLOUD_BASE: grib_ltype = GRIB1_LTYPE_CLOUD_BASE; break;
case ZAXIS_CLOUD_TOP: grib_ltype = GRIB1_LTYPE_CLOUD_TOP; break;
case ZAXIS_ISOTHERM_ZERO: grib_ltype = GRIB1_LTYPE_ISOTHERM0; break;
case ZAXIS_SNOW: grib_ltype = -1; break;
case ZAXIS_LAKE_BOTTOM: grib_ltype = GRIB1_LTYPE_LAKE_BOTTOM; break;
case ZAXIS_SEDIMENT_BOTTOM: grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM; break;
case ZAXIS_SEDIMENT_BOTTOM_TA: grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TA; break;
case ZAXIS_SEDIMENT_BOTTOM_TW: grib_ltype = GRIB1_LTYPE_SEDIMENT_BOTTOM_TW; break;
case ZAXIS_MIX_LAYER: grib_ltype = GRIB1_LTYPE_MIX_LAYER; break;
case ZAXIS_REFERENCE: grib_ltype = -1; break;
case ZAXIS_SURFACE: return GRIB1_LTYPE_SURFACE;
case ZAXIS_GENERIC: return -1;
case ZAXIS_HYBRID: return -1;
case ZAXIS_HYBRID_HALF: return -1;
case ZAXIS_PRESSURE: return GRIB1_LTYPE_ISOBARIC;
case ZAXIS_HEIGHT: return GRIB1_LTYPE_HEIGHT;
case ZAXIS_DEPTH_BELOW_SEA: return GRIB1_LTYPE_SEADEPTH;
case ZAXIS_DEPTH_BELOW_LAND: return GRIB1_LTYPE_LANDDEPTH;
case ZAXIS_ISENTROPIC: return GRIB1_LTYPE_ISENTROPIC;
case ZAXIS_TRAJECTORY: return -1;
case ZAXIS_ALTITUDE: return GRIB1_LTYPE_ALTITUDE;
case ZAXIS_SIGMA: return GRIB1_LTYPE_SIGMA;
case ZAXIS_MEANSEA: return GRIB1_LTYPE_MEANSEA;
case ZAXIS_TROPOPAUSE: return GRIB1_LTYPE_TROPOPAUSE;
case ZAXIS_TOA: return GRIB1_LTYPE_TOA;
case ZAXIS_SEA_BOTTOM: return GRIB1_LTYPE_SEA_BOTTOM;
case ZAXIS_ATMOSPHERE: return GRIB1_LTYPE_ATMOSPHERE;
case ZAXIS_CLOUD_BASE: return GRIB1_LTYPE_CLOUD_BASE;
case ZAXIS_CLOUD_TOP: return GRIB1_LTYPE_CLOUD_TOP;
case ZAXIS_ISOTHERM_ZERO: return GRIB1_LTYPE_ISOTHERM0;
case ZAXIS_SNOW: return -1;
case ZAXIS_LAKE_BOTTOM: return GRIB1_LTYPE_LAKE_BOTTOM;
case ZAXIS_SEDIMENT_BOTTOM: return GRIB1_LTYPE_SEDIMENT_BOTTOM;
case ZAXIS_SEDIMENT_BOTTOM_TA: return GRIB1_LTYPE_SEDIMENT_BOTTOM_TA;
case ZAXIS_SEDIMENT_BOTTOM_TW: return GRIB1_LTYPE_SEDIMENT_BOTTOM_TW;
case ZAXIS_MIX_LAYER: return GRIB1_LTYPE_MIX_LAYER;
case ZAXIS_REFERENCE: return -1;
}
// clang-format on
return grib_ltype;
return -1;
}
int zaxisTypeToGrib2ltype(int zaxistype)
{
int grib_ltype = -1;
// clang-format off
switch (zaxistype)
{
case ZAXIS_SURFACE: grib_ltype = GRIB2_LTYPE_SURFACE; break;
case ZAXIS_GENERIC: grib_ltype = -1; break;
case ZAXIS_HYBRID: grib_ltype = GRIB2_LTYPE_HYBRID; break;
case ZAXIS_HYBRID_HALF: grib_ltype = GRIB2_LTYPE_HYBRID; break;
case ZAXIS_PRESSURE: grib_ltype = GRIB2_LTYPE_ISOBARIC; break;
case ZAXIS_HEIGHT: grib_ltype = GRIB2_LTYPE_HEIGHT; break;
case ZAXIS_DEPTH_BELOW_SEA: grib_ltype = GRIB2_LTYPE_SEADEPTH; break;
case ZAXIS_DEPTH_BELOW_LAND: grib_ltype = GRIB2_LTYPE_LANDDEPTH; break;
case ZAXIS_ISENTROPIC: grib_ltype = GRIB2_LTYPE_ISENTROPIC; break;
case ZAXIS_TRAJECTORY: grib_ltype = -1; break;
case ZAXIS_ALTITUDE: grib_ltype = GRIB2_LTYPE_ALTITUDE; break;
case ZAXIS_SIGMA: grib_ltype = GRIB2_LTYPE_SIGMA; break;
case ZAXIS_MEANSEA: grib_ltype = GRIB2_LTYPE_MEANSEA; break;
case ZAXIS_TROPOPAUSE: grib_ltype = GRIB2_LTYPE_TROPOPAUSE; break;
case ZAXIS_TOA: grib_ltype = GRIB2_LTYPE_TOA; break;
case ZAXIS_SEA_BOTTOM: grib_ltype = GRIB2_LTYPE_SEA_BOTTOM; break;
case ZAXIS_ATMOSPHERE: grib_ltype = GRIB2_LTYPE_ATMOSPHERE; break;
case ZAXIS_CLOUD_BASE: grib_ltype = GRIB2_LTYPE_CLOUD_BASE; break;
case ZAXIS_CLOUD_TOP: grib_ltype = GRIB2_LTYPE_CLOUD_TOP; break;
case ZAXIS_ISOTHERM_ZERO: grib_ltype = GRIB2_LTYPE_ISOTHERM0; break;
case ZAXIS_SNOW: grib_ltype = GRIB2_LTYPE_SNOW; break;
case ZAXIS_LAKE_BOTTOM: grib_ltype = GRIB2_LTYPE_LAKE_BOTTOM; break;
case ZAXIS_SEDIMENT_BOTTOM: grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM; break;
case ZAXIS_SEDIMENT_BOTTOM_TA: grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TA; break;
case ZAXIS_SEDIMENT_BOTTOM_TW: grib_ltype = GRIB2_LTYPE_SEDIMENT_BOTTOM_TW; break;
case ZAXIS_MIX_LAYER: grib_ltype = GRIB2_LTYPE_MIX_LAYER; break;
case ZAXIS_REFERENCE: grib_ltype = GRIB2_LTYPE_REFERENCE; break;
case ZAXIS_SURFACE: return GRIB2_LTYPE_SURFACE;
case ZAXIS_GENERIC: return -1;
case ZAXIS_HYBRID: return GRIB2_LTYPE_HYBRID;
case ZAXIS_HYBRID_HALF: return GRIB2_LTYPE_HYBRID;
case ZAXIS_PRESSURE: return GRIB2_LTYPE_ISOBARIC;
case ZAXIS_HEIGHT: return GRIB2_LTYPE_HEIGHT;
case ZAXIS_DEPTH_BELOW_SEA: return GRIB2_LTYPE_SEADEPTH;
case ZAXIS_DEPTH_BELOW_LAND: return GRIB2_LTYPE_LANDDEPTH;
case ZAXIS_ISENTROPIC: return GRIB2_LTYPE_ISENTROPIC;
case ZAXIS_TRAJECTORY: return -1;
case ZAXIS_ALTITUDE: return GRIB2_LTYPE_ALTITUDE;
case ZAXIS_SIGMA: return GRIB2_LTYPE_SIGMA;
case ZAXIS_MEANSEA: return GRIB2_LTYPE_MEANSEA;
case ZAXIS_TROPOPAUSE: return GRIB2_LTYPE_TROPOPAUSE;
case ZAXIS_TOA: return GRIB2_LTYPE_TOA;
case ZAXIS_SEA_BOTTOM: return GRIB2_LTYPE_SEA_BOTTOM;
case ZAXIS_ATMOSPHERE: return GRIB2_LTYPE_ATMOSPHERE;
case ZAXIS_CLOUD_BASE: return GRIB2_LTYPE_CLOUD_BASE;
case ZAXIS_CLOUD_TOP: return GRIB2_LTYPE_CLOUD_TOP;
case ZAXIS_ISOTHERM_ZERO: return GRIB2_LTYPE_ISOTHERM0;
case ZAXIS_SNOW: return GRIB2_LTYPE_SNOW;
case ZAXIS_LAKE_BOTTOM: return GRIB2_LTYPE_LAKE_BOTTOM;
case ZAXIS_SEDIMENT_BOTTOM: return GRIB2_LTYPE_SEDIMENT_BOTTOM;
case ZAXIS_SEDIMENT_BOTTOM_TA: return GRIB2_LTYPE_SEDIMENT_BOTTOM_TA;
case ZAXIS_SEDIMENT_BOTTOM_TW: return GRIB2_LTYPE_SEDIMENT_BOTTOM_TW;
case ZAXIS_MIX_LAYER: return GRIB2_LTYPE_MIX_LAYER;
case ZAXIS_REFERENCE: return GRIB2_LTYPE_REFERENCE;
}
// clang-format on
return grib_ltype;
return -1;
}
......
......@@ -74,60 +74,27 @@ void iegReadRecord(stream_t *streamptr, double *data, size_t *nmiss)
static
int iegGetZaxisType(int iegleveltype)
{
int leveltype = 0;
switch ( iegleveltype )
// clang-format off
switch (iegleveltype)
{
case IEG_LTYPE_SURFACE:
{
leveltype = ZAXIS_SURFACE;
break;
}
case IEG_LTYPE_SURFACE: return ZAXIS_SURFACE;
case IEG_LTYPE_99:
case IEG_LTYPE_ISOBARIC:
{
leveltype = ZAXIS_PRESSURE;
break;
}
case IEG_LTYPE_HEIGHT:
{
leveltype = ZAXIS_HEIGHT;
break;
}
case IEG_LTYPE_ALTITUDE:
{
leveltype = ZAXIS_ALTITUDE;
break;
}
case IEG_LTYPE_ISOBARIC: return ZAXIS_PRESSURE;
case IEG_LTYPE_HEIGHT: return ZAXIS_HEIGHT;
case IEG_LTYPE_ALTITUDE: return ZAXIS_ALTITUDE;
case IEG_LTYPE_HYBRID:
case IEG_LTYPE_HYBRID_LAYER:
{
leveltype = ZAXIS_HYBRID;
break;
}
case IEG_LTYPE_HYBRID_LAYER: return ZAXIS_HYBRID;
case IEG_LTYPE_LANDDEPTH:
case IEG_LTYPE_LANDDEPTH_LAYER:
{
leveltype = ZAXIS_DEPTH_BELOW_LAND;
break;
}
case IEG_LTYPE_SEADEPTH:
{
leveltype = ZAXIS_DEPTH_BELOW_SEA;
break;
}
default:
{
leveltype = ZAXIS_GENERIC;
break;
}
case IEG_LTYPE_LANDDEPTH_LAYER: return ZAXIS_DEPTH_BELOW_LAND;
case IEG_LTYPE_SEADEPTH: return ZAXIS_DEPTH_BELOW_SEA;
}
return leveltype;
// clang-format on
return ZAXIS_GENERIC;
}
static void iegDefTime(int *pdb, int64_t date, int time, int taxisID)
static
void iegDefTime(int *pdb, int64_t date, int time, int taxisID)
{
int timetype = (taxisID != -1) ? taxisInqType(taxisID) : -1;
if ( timetype == TAXIS_ABSOLUTE || timetype == TAXIS_RELATIVE )
......@@ -136,11 +103,11 @@ static void iegDefTime(int *pdb, int64_t date, int time, int taxisID)
cdiDecodeDate(date, &year, &month, &day);
cdiDecodeTime(time, &hour, &minute, &second);
IEG_P_Year(pdb) = year;
IEG_P_Month(pdb) = month;
IEG_P_Day(pdb) = day;
IEG_P_Hour(pdb) = hour;
IEG_P_Minute(pdb) = minute;
IEG_P_Year(pdb) = year;
IEG_P_Month(pdb) = month;
IEG_P_Day(pdb) = day;
IEG_P_Hour(pdb) = hour;
IEG_P_Minute(pdb) = minute;
pdb[15] = 1;
pdb[16] = 0;
......@@ -152,9 +119,8 @@ static void iegDefTime(int *pdb, int64_t date, int time, int taxisID)
pdb[5] = 128;
}
/* find smallest power of 10 in [1000,10000000] that upon
* multiplication results in fractional part close to zero for all
* arguments */
/* find smallest power of 10 in [1000,10000000] that upon multiplication results in fractional part
close to zero for all arguments */
static double
calc_resfac(double xfirst, double xlast, double xinc, double yfirst, double ylast, double yinc)
{
......@@ -334,7 +300,7 @@ void iegDefLevel(int *pdb, int *gdb, double *vct, int zaxisID, int levelID)
cdiDefKeyString(zaxisID, CDI_GLOBAL, CDI_KEY_UNITS, "Pa");
}
/* IEG_G_NumVCP(gdb) = 0; */
// IEG_G_NumVCP(gdb) = 0;
switch (leveltype)
{
......@@ -355,7 +321,7 @@ void iegDefLevel(int *pdb, int *gdb, double *vct, int zaxisID, int levelID)
if ( vctsize > 100 )
{
static bool vct_warning = true;
/* IEG_G_NumVCP(gdb) = 0; */
// IEG_G_NumVCP(gdb) = 0;
if ( vct_warning )
{
Warning("VCT size of %d is too large (maximum is 100). Set to 0!", vctsize);
......@@ -540,7 +506,7 @@ void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vc
if ( iresfac == 0 ) iresfac = 1000;
const double resfac = 1./(double) iresfac;
/* if ( IEG_G_FirstLon != 0 || IEG_G_LastLon != 0 ) */
// if ( IEG_G_FirstLon != 0 || IEG_G_LastLon != 0 )
{
if ( xsize > 1 )
{
......@@ -549,11 +515,11 @@ void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vc
else
grid->x.inc = (IEG_G_LastLon(gdb) - IEG_G_FirstLon(gdb)) * resfac / (xsize - 1);
/* correct xinc if necessary */
// correct xinc if necessary
if ( IEG_G_FirstLon(gdb) == 0 && IEG_G_LastLon(gdb) > 354000 )
{
const double xinc = 360. / xsize;
/* FIXME: why not use grid->x.inc != xinc as condition? */
// FIXME: why not use grid->x.inc != xinc as condition?
if ( fabs(grid->x.inc-xinc) > 0.0 )
{
grid->x.inc = xinc;
......@@ -566,7 +532,7 @@ void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vc
grid->x.flag = 2;
}
grid->y.flag = 0;
/* if ( IEG_G_FirstLat != 0 || IEG_G_LastLat != 0 ) */
// if ( IEG_G_FirstLat != 0 || IEG_G_LastLat != 0 )
{
if ( ysize > 1 )
{
......@@ -1010,14 +976,14 @@ void iegReadVarSliceDP(stream_t *streamptr, int varID, int levID, double *data,
int vlistID = streamptr->vlistID;
int fileID = streamptr->fileID;
/* NOTE: tiles are not supported here! */
// NOTE: tiles are not supported here!
double missval = vlistInqVarMissval(vlistID, varID);
size_t gridsize = gridInqSize(vlistInqVarGrid(vlistID, varID));
int tsid = streamptr->curTsID;
off_t currentfilepos = fileGetPos(fileID);
/* NOTE: tiles are not supported here! */
// NOTE: tiles are not supported here!
int recID = streamptr->vars[varID].recordTable[0].recordID[levID];
off_t recpos = streamptr->tsteps[tsid].records[recID].position;
fileSetPos(fileID, recpos, SEEK_SET);
......
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