Commit 6c6efd51 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

setltype, chltype: added support for GRIB2

parent 2e68c843
...@@ -3,6 +3,10 @@ ...@@ -3,6 +3,10 @@
* using CDI library version 1.6.4 * using CDI library version 1.6.4
* Version 1.6.4 released * Version 1.6.4 released
2014-04-24 Uwe Schulzweida
* setltype, chltype: added support for GRIB2
2014-04-15 Uwe Schulzweida 2014-04-15 Uwe Schulzweida
* select/delete: add support for negative timesteps * select/delete: add support for negative timesteps
......
...@@ -278,7 +278,7 @@ void *Change(void *argument) ...@@ -278,7 +278,7 @@ void *Change(void *argument)
} }
else if ( operatorID == CHLTYPE ) else if ( operatorID == CHLTYPE )
{ {
int zaxistype, zaxistype1, zaxistype2, ltype, ltype1, ltype2, sameltype; int ltype, ltype1, ltype2;
nzaxis = vlistNzaxis(vlistID2); nzaxis = vlistNzaxis(vlistID2);
for ( index = 0; index < nzaxis; index++ ) for ( index = 0; index < nzaxis; index++ )
...@@ -286,26 +286,17 @@ void *Change(void *argument) ...@@ -286,26 +286,17 @@ void *Change(void *argument)
zaxisID1 = vlistZaxis(vlistID2, index); zaxisID1 = vlistZaxis(vlistID2, index);
zaxisID2 = zaxisDuplicate(zaxisID1); zaxisID2 = zaxisDuplicate(zaxisID1);
zaxistype = zaxisInqType(zaxisID1);
ltype = zaxisInqLtype(zaxisID1); ltype = zaxisInqLtype(zaxisID1);
for ( i = 0; i < nch; i += 2 ) for ( i = 0; i < nch; i += 2 )
{ {
sameltype = FALSE;
ltype1 = chltypes[i]; ltype1 = chltypes[i];
ltype2 = chltypes[i+1]; ltype2 = chltypes[i+1];
zaxistype1 = ltype2ztype(ltype1); if ( ltype1 == ltype )
zaxistype2 = ltype2ztype(ltype2);
if ( zaxistype1 == zaxistype ) sameltype = TRUE;
if ( !(zaxistype1 == ZAXIS_GENERIC && ltype1 == ltype) ) sameltype = FALSE;
if ( sameltype)
{ {
zaxisChangeType(zaxisID2, zaxistype2); zaxisChangeType(zaxisID2, ZAXIS_GENERIC);
if ( zaxistype == ZAXIS_GENERIC ) zaxisDefLtype(zaxisID2, ltype2); zaxisDefLtype(zaxisID2, ltype2);
vlistChangeZaxis(vlistID2, zaxisID1, zaxisID2); vlistChangeZaxis(vlistID2, zaxisID1, zaxisID2);
} }
} }
......
...@@ -163,10 +163,9 @@ void *Set(void *argument) ...@@ -163,10 +163,9 @@ void *Set(void *argument)
zaxisID1 = vlistZaxis(vlistID2, index); zaxisID1 = vlistZaxis(vlistID2, index);
zaxisID2 = zaxisDuplicate(zaxisID1); zaxisID2 = zaxisDuplicate(zaxisID1);
zaxistype = ltype2ztype(newval); zaxistype = ZAXIS_GENERIC;
zaxisChangeType(zaxisID2, zaxistype); zaxisChangeType(zaxisID2, zaxistype);
if ( zaxistype == ZAXIS_GENERIC ) zaxisDefLtype(zaxisID2, newval); zaxisDefLtype(zaxisID2, newval);
vlistChangeZaxis(vlistID2, zaxisID1, zaxisID2); vlistChangeZaxis(vlistID2, zaxisID1, zaxisID2);
} }
} }
......
...@@ -119,7 +119,6 @@ int readline(FILE *fp, char *line, int len); ...@@ -119,7 +119,6 @@ int readline(FILE *fp, char *line, int len);
int zaxis2ltype(int zaxisID); int zaxis2ltype(int zaxisID);
int ztype2ltype(int zaxistype); int ztype2ltype(int zaxistype);
int ltype2ztype(int ltype);
int nfc2nlat(int nfc, int ntr); int nfc2nlat(int nfc, int ntr);
......
...@@ -450,9 +450,8 @@ int zaxis2ltype(int zaxisID) ...@@ -450,9 +450,8 @@ int zaxis2ltype(int zaxisID)
int ztype2ltype(int zaxistype) int ztype2ltype(int zaxistype)
{ {
int ltype; int ltype = -1;
ltype = -1;
if ( zaxistype == ZAXIS_SURFACE ) ltype = 1; if ( zaxistype == ZAXIS_SURFACE ) ltype = 1;
else if ( zaxistype == ZAXIS_PRESSURE ) ltype = 100; else if ( zaxistype == ZAXIS_PRESSURE ) ltype = 100;
else if ( zaxistype == ZAXIS_ALTITUDE ) ltype = 103; else if ( zaxistype == ZAXIS_ALTITUDE ) ltype = 103;
...@@ -466,24 +465,3 @@ int ztype2ltype(int zaxistype) ...@@ -466,24 +465,3 @@ int ztype2ltype(int zaxistype)
return (ltype); return (ltype);
} }
int ltype2ztype(int ltype)
{
int zaxistype = -1;
if ( ltype == 1 ) zaxistype = ZAXIS_SURFACE;
else if ( ltype == 0 ) zaxistype = ZAXIS_SURFACE;
else if ( ltype == 100 ) zaxistype = ZAXIS_PRESSURE;
else if ( ltype == 103 ) zaxistype = ZAXIS_ALTITUDE;
else if ( ltype == 105 ) zaxistype = ZAXIS_HEIGHT;
else if ( ltype == 107 ) zaxistype = ZAXIS_SIGMA;
else if ( ltype == 109 ) zaxistype = ZAXIS_HYBRID;
else if ( ltype == 110 ) zaxistype = ZAXIS_HYBRID_HALF;
else if ( ltype == 111 ) zaxistype = ZAXIS_DEPTH_BELOW_LAND;
else if ( ltype == 113 ) zaxistype = ZAXIS_ISENTROPIC;
else if ( ltype == 160 ) zaxistype = ZAXIS_DEPTH_BELOW_SEA;
else zaxistype = ZAXIS_GENERIC;
return (zaxistype);
}
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