Commit 40526e1a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

cleanup grib2 interface

parent 80a1fb14
2010-02-15 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* rotated grid: correct standard name [report: Michael Boettinger]
* cgribexDefTime: bug fix for timerange = -1
2010-02-10 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
......
......@@ -690,7 +690,7 @@ int main(int argc, char *argv[])
if (Progname == 0) Progname = argv[0];
else Progname++;
while ( (c = getopt(argc, argv, "f:t:w:z:cdhlmqrsvVZ")) != EOF )
while ( (c = getopt(argc, argv, "f:t:w:z:cdhlmqRrsvVZ")) != EOF )
{
switch (c)
{
......@@ -700,39 +700,42 @@ int main(int argc, char *argv[])
case 'f':
setDefaultFileType(optarg);
break;
case 'r':
Record = 1;
break;
case 'h':
usage();
exit (0);
case 'l':
Longinfo = 1;
break;
case 'm':
Move = 1;
break;
case 'v':
Vardis = 1;
break;
case 'V':
Version = 1;
break;
case 'q':
Quiet = 1;
break;
case 'R':
cdiDefGlobal("REGULARGRID", 1);
break;
case 'r':
Record = 1;
break;
case 's':
Shortinfo = 1;
break;
case 't':
rTable = optarg;
break;
case 'v':
Vardis = 1;
break;
case 'V':
Version = 1;
break;
case 'w':
wTable = optarg;
break;
case 'z':
defineCompress(optarg);
break;
case 'h':
usage();
exit (0);
}
}
......
......@@ -1872,6 +1872,8 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
static char func[] = "gribapiDefGrid";
int gridtype;
static short lwarn = TRUE;
size_t len;
const char *mesg;
// ISEC1_Sec2Or3Flag = 128;
......@@ -1927,7 +1929,6 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
{
int nlon = 0, nlat;
double latIncr;
size_t len;
if ( gridtype == GRID_GAUSSIAN_REDUCED )
{
......@@ -2004,9 +2005,15 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
//if ( ISEC2_LastLat > ISEC2_FirstLat ) ISEC2_ScanFlag += 64;
if ( ljpeg )
GRIB_CHECK(grib_set_string(gh, "typeOfPacking", "grid_jpeg", &len), 0);
{
mesg = "grid_jpeg"; len = strlen(mesg);
GRIB_CHECK(grib_set_string(gh, "typeOfPacking", mesg, &len), 0);
}
else
GRIB_CHECK(grib_set_string(gh, "typeOfPacking", "grid_simple", &len), 0);
{
mesg = "grid_simple"; len = strlen(mesg);
GRIB_CHECK(grib_set_string(gh, "typeOfPacking", mesg, &len), 0);
}
break;
}
......@@ -2044,7 +2051,6 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
case GRID_SPECTRAL:
{
int trunc = gridInqTrunc(gridID);
size_t len = 15;
GRIB_CHECK(grib_set_long(gh, "gridDefinitionTemplateNumber", GRIBAPI_GTYPE_SPECTRAL), 0);
GRIB_CHECK(grib_set_long(gh, "J", trunc), 0);
......@@ -2055,9 +2061,20 @@ void gribapiDefGrid(grib_handle *gh, int gridID, int ljpeg)
GRIB_CHECK(grib_set_long(gh, "numberOfValues", gridInqSize(gridID)), 0);
if ( gridInqComplexPacking(gridID) )
GRIB_CHECK(grib_set_long(gh, "complexPacking", 1), 0);
{
mesg = "spectral_complex"; len = strlen(mesg);
GRIB_CHECK(grib_set_string(gh, "typeOfPacking", mesg, &len), 0);
/*
GRIB_CHECK(grib_set_long(gh, "JS", 20), 0);
GRIB_CHECK(grib_set_long(gh, "KS", 20), 0);
GRIB_CHECK(grib_set_long(gh, "MS", 20), 0);
*/
}
else
GRIB_CHECK(grib_set_long(gh, "complexPacking", 0), 0);
{
mesg = "spectral_simple"; len = strlen(mesg);
GRIB_CHECK(grib_set_string(gh, "typeOfPacking", mesg, &len), 0);
}
break;
}
......
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