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

GRIB: added support for time step unit: seconds

parent e71696bf
......@@ -3,6 +3,10 @@
* Version 1.6.0 released
* using CGRIBEX library version 1.6.0
2013-03-13 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* GRIB: added support for time step unit: seconds (Bug #3352)
2013-03-12 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Added support for level type CLOUD_BASE, CLOUD_TOP and ISOTHERM_ZERO [Feature #3247]
......
......@@ -147,27 +147,6 @@ double timeunit_factor(int tu1, int tu2)
return (factor);
}
static
int gribapiGetEndStep(grib_handle *gh, int startStep, int timeunits)
{
int endStep = startStep;
int timeunits2;
int status;
long unitsOfTime;
long lpar;
status = grib_get_long(gh, "stepUnits", &unitsOfTime);
timeunits2 = getTimeunits(unitsOfTime);
status = grib_get_long(gh, "endStep", &lpar);
if ( status == 0 )
endStep = (int) ((lpar * timeunit_factor(timeunits, timeunits2)) + 0.5);
return (endStep);
}
static
int gribapiGetTimeUnits(grib_handle *gh)
{
......@@ -206,6 +185,29 @@ int gribapiGetTimeUnits(grib_handle *gh)
return (timeunits);
}
static
int gribapiGetEndStep(grib_handle *gh, int startStep, int timeunits)
{
int endStep = startStep;
int timeunits2;
int status;
long unitsOfTime;
long lpar;
// status = grib_get_long(gh, "stepUnits", &unitsOfTime);
// timeunits2 = getTimeunits(unitsOfTime);
timeunits2 = gribapiGetTimeUnits(gh);
status = grib_get_long(gh, "endStep", &lpar);
if ( status == 0 )
endStep = (int) ((lpar * timeunit_factor(timeunits, timeunits2)) + 0.5);
// printf("%d %d %d %d %d %g\n", startStep, endStep, lpar, timeunits, timeunits2, timeunit_factor(timeunits, timeunits2));
return (endStep);
}
static
int gribapiTimeIsFC(grib_handle *gh)
{
......@@ -356,9 +358,7 @@ int gribapiGetValidityDateTime(grib_handle *gh, int *vdate, int *vtime)
julday_add_seconds(addsec, &julday, &secofday);
decode_caldaysec(grib_calendar, julday, secofday, &ryear, &rmonth, &rday, &rhour, &rminute, &rsecond);
/*
printf("new %d/%d/%d %d:%d\n", ryear, rmonth, rday, rhour, rminute);
*/
*vdate = cdiEncodeDate(ryear, rmonth, rday);
*vtime = cdiEncodeTime(rhour, rminute, rsecond);
}
......
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