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

added support for ZAXIS_DEPTH_BELOW_LAND units "mm"

parent 7294cd1d
......@@ -17,7 +17,7 @@
2012-04-26 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added support for ZAXIS_DEPTH_BELOW_LAND units "cm", "dm" and "m"
* added support for ZAXIS_DEPTH_BELOW_LAND units "mm", "cm", "dm" and "m"
2012-03-24 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
......@@ -2065,11 +2065,12 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
case ZAXIS_DEPTH_BELOW_LAND:
{
char units[128];
long factor;
double factor;
zaxisInqUnits(zaxisID, units);
if ( memcmp(units, "cm", 2) == 0 ) factor = 1;
if ( memcmp(units, "mm", 2) == 0 ) factor = 0.1;
else if ( memcmp(units, "cm", 2) == 0 ) factor = 1;
else if ( memcmp(units, "dm", 2) == 0 ) factor = 10;
else factor = 100; // meter
......
......@@ -617,8 +617,9 @@ double grib2GetLevel(grib_handle *gh, int leveltype)
{
GRIB_CHECK(grib_get_long(gh, "scaleFactorOfFirstFixedSurface", &factor), 0);
GRIB_CHECK(grib_get_double(gh, "scaledValueOfFirstFixedSurface", &dlevel), 0);
if ( factor == 0 ) dlevel *= 100; // m to cm
else if ( factor == 1 ) dlevel *= 10; // dm to cm
if ( factor == 0 ) dlevel *= 100; // m to cm
else if ( factor == 1 ) dlevel *= 10; // dm to cm
else if ( factor == 3 ) dlevel *= 0.1; // mm to cm
}
else
{
......@@ -2665,13 +2666,14 @@ void gribapiDefLevel(grib_handle *gh, int param, int zaxisID, int levelID)
case ZAXIS_DEPTH_BELOW_LAND:
{
char units[128];
long factor;
zaxisInqUnits(zaxisID, units);
if ( editionNumber <= 1 )
{
if ( memcmp(units, "cm", 2) == 0 ) factor = 1;
double factor;
if ( memcmp(units, "mm", 2) == 0 ) factor = 0.1;
else if ( memcmp(units, "cm", 2) == 0 ) factor = 1;
else if ( memcmp(units, "dm", 2) == 0 ) factor = 10;
else factor = 100; // meter
......@@ -2680,7 +2682,9 @@ void gribapiDefLevel(grib_handle *gh, int param, int zaxisID, int levelID)
}
else
{
if ( memcmp(units, "cm", 2) == 0 ) factor = 2;
long factor;
if ( memcmp(units, "mm", 2) == 0 ) factor = 3;
else if ( memcmp(units, "cm", 2) == 0 ) factor = 2;
else if ( memcmp(units, "dm", 2) == 0 ) factor = 1;
else factor = 0; // meter
......
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