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

added support for TUNIT_30MINUTES

parent 51512a76
......@@ -272,16 +272,18 @@ void printInfo(int gridtype, int vdate, int vtime, char *varname, double level,
const char * tunit2str(int tunits)
{
if ( tunits == TUNIT_YEAR ) return ("years");
else if ( tunits == TUNIT_MONTH ) return ("months");
else if ( tunits == TUNIT_DAY ) return ("days");
else if ( tunits == TUNIT_12HOURS ) return ("12hours");
else if ( tunits == TUNIT_6HOURS ) return ("6hours");
else if ( tunits == TUNIT_3HOURS ) return ("3hours");
else if ( tunits == TUNIT_HOUR ) return ("hours");
else if ( tunits == TUNIT_MINUTE ) return ("minutes");
else if ( tunits == TUNIT_SECOND ) return ("seconds");
else return ("unknown");
if ( tunits == TUNIT_YEAR ) return ("years");
else if ( tunits == TUNIT_MONTH ) return ("months");
else if ( tunits == TUNIT_DAY ) return ("days");
else if ( tunits == TUNIT_12HOURS ) return ("12hours");
else if ( tunits == TUNIT_6HOURS ) return ("6hours");
else if ( tunits == TUNIT_3HOURS ) return ("3hours");
else if ( tunits == TUNIT_HOUR ) return ("hours");
else if ( tunits == TUNIT_30MINUTES ) return ("30minutes");
else if ( tunits == TUNIT_QUARTER ) return ("15minutes");
else if ( tunits == TUNIT_MINUTE ) return ("minutes");
else if ( tunits == TUNIT_SECOND ) return ("seconds");
else return ("unknown");
}
......
......@@ -198,14 +198,15 @@ extern "C" {
#define TUNIT_SECOND 1
#define TUNIT_MINUTE 2
#define TUNIT_HOUR 3
#define TUNIT_DAY 4
#define TUNIT_MONTH 5
#define TUNIT_YEAR 6
#define TUNIT_QUARTER 7
#define TUNIT_3HOURS 8
#define TUNIT_6HOURS 9
#define TUNIT_12HOURS 10
#define TUNIT_QUARTER 3
#define TUNIT_30MINUTES 4
#define TUNIT_HOUR 5
#define TUNIT_3HOURS 6
#define TUNIT_6HOURS 7
#define TUNIT_12HOURS 8
#define TUNIT_DAY 9
#define TUNIT_MONTH 10
#define TUNIT_YEAR 11
/* CALENDAR types */
......
......@@ -4,7 +4,7 @@
!
! Author:
! -------
! Uwe Schulzweida, MPI-MET, Hamburg, July 2014
! Uwe Schulzweida, MPI-MET, Hamburg, August 2014
!
INTEGER CDI_MAX_NAME
......@@ -336,22 +336,24 @@
PARAMETER (TUNIT_SECOND = 1)
INTEGER TUNIT_MINUTE
PARAMETER (TUNIT_MINUTE = 2)
INTEGER TUNIT_HOUR
PARAMETER (TUNIT_HOUR = 3)
INTEGER TUNIT_DAY
PARAMETER (TUNIT_DAY = 4)
INTEGER TUNIT_MONTH
PARAMETER (TUNIT_MONTH = 5)
INTEGER TUNIT_YEAR
PARAMETER (TUNIT_YEAR = 6)
INTEGER TUNIT_QUARTER
PARAMETER (TUNIT_QUARTER = 7)
PARAMETER (TUNIT_QUARTER = 3)
INTEGER TUNIT_30MINUTES
PARAMETER (TUNIT_30MINUTES = 4)
INTEGER TUNIT_HOUR
PARAMETER (TUNIT_HOUR = 5)
INTEGER TUNIT_3HOURS
PARAMETER (TUNIT_3HOURS = 8)
PARAMETER (TUNIT_3HOURS = 6)
INTEGER TUNIT_6HOURS
PARAMETER (TUNIT_6HOURS = 9)
PARAMETER (TUNIT_6HOURS = 7)
INTEGER TUNIT_12HOURS
PARAMETER (TUNIT_12HOURS = 10)
PARAMETER (TUNIT_12HOURS = 8)
INTEGER TUNIT_DAY
PARAMETER (TUNIT_DAY = 9)
INTEGER TUNIT_MONTH
PARAMETER (TUNIT_MONTH = 10)
INTEGER TUNIT_YEAR
PARAMETER (TUNIT_YEAR = 11)
!
! CALENDAR types
!
......
......@@ -150,14 +150,15 @@ module mo_cdi
integer :: TAXIS_FORECAST = 3
integer :: TUNIT_SECOND = 1
integer :: TUNIT_MINUTE = 2
integer :: TUNIT_HOUR = 3
integer :: TUNIT_DAY = 4
integer :: TUNIT_MONTH = 5
integer :: TUNIT_YEAR = 6
integer :: TUNIT_QUARTER = 7
integer :: TUNIT_3HOURS = 8
integer :: TUNIT_6HOURS = 9
integer :: TUNIT_12HOURS = 10
integer :: TUNIT_QUARTER = 3
integer :: TUNIT_30MINUTES = 4
integer :: TUNIT_HOUR = 5
integer :: TUNIT_3HOURS = 6
integer :: TUNIT_6HOURS = 7
integer :: TUNIT_12HOURS = 8
integer :: TUNIT_DAY = 9
integer :: TUNIT_MONTH = 10
integer :: TUNIT_YEAR = 11
integer :: CALENDAR_STANDARD = 0
integer :: CALENDAR_PROLEPTIC = 1
integer :: CALENDAR_360DAYS = 2
......@@ -3692,14 +3693,15 @@ module mo_cdi
public :: TAXIS_FORECAST
public :: TUNIT_SECOND
public :: TUNIT_MINUTE
public :: TUNIT_HOUR
public :: TUNIT_DAY
public :: TUNIT_MONTH
public :: TUNIT_YEAR
public :: TUNIT_QUARTER
public :: TUNIT_30MINUTES
public :: TUNIT_HOUR
public :: TUNIT_3HOURS
public :: TUNIT_6HOURS
public :: TUNIT_12HOURS
public :: TUNIT_DAY
public :: TUNIT_MONTH
public :: TUNIT_YEAR
public :: CALENDAR_STANDARD
public :: CALENDAR_PROLEPTIC
public :: CALENDAR_360DAYS
......
......@@ -960,7 +960,8 @@ void cdfDefTimeUnits(char *unitstr, taxis_t* taxis0, taxis_t* taxis)
cdiDecodeDate(rdate, &year, &month, &day);
cdiDecodeTime(rtime, &hour, &minute, &second);
if ( timeunit == TUNIT_QUARTER ) timeunit = TUNIT_MINUTE;
if ( timeunit == TUNIT_QUARTER ) timeunit = TUNIT_MINUTE;
if ( timeunit == TUNIT_30MINUTES ) timeunit = TUNIT_MINUTE;
if ( timeunit == TUNIT_3HOURS ||
timeunit == TUNIT_6HOURS ||
timeunit == TUNIT_12HOURS ) timeunit = TUNIT_HOUR;
......@@ -977,7 +978,8 @@ void cdfDefForecastTimeUnits(char *unitstr, int timeunit)
if ( timeunit == -1 ) timeunit = TUNIT_HOUR;
if ( timeunit == TUNIT_QUARTER ) timeunit = TUNIT_MINUTE;
if ( timeunit == TUNIT_QUARTER ) timeunit = TUNIT_MINUTE;
if ( timeunit == TUNIT_30MINUTES ) timeunit = TUNIT_MINUTE;
if ( timeunit == TUNIT_3HOURS ||
timeunit == TUNIT_6HOURS ||
timeunit == TUNIT_12HOURS ) timeunit = TUNIT_HOUR;
......
......@@ -92,13 +92,14 @@ int cgribexGetTimeUnit(int *isec1)
switch ( ISEC1_TimeUnit )
{
case ISEC1_TABLE4_MINUTE: timeunit = TUNIT_MINUTE; break;
case ISEC1_TABLE4_QUARTER: timeunit = TUNIT_QUARTER; break;
case ISEC1_TABLE4_HOUR: timeunit = TUNIT_HOUR; break;
case ISEC1_TABLE4_3HOURS: timeunit = TUNIT_3HOURS; break;
case ISEC1_TABLE4_6HOURS: timeunit = TUNIT_6HOURS; break;
case ISEC1_TABLE4_12HOURS: timeunit = TUNIT_12HOURS; break;
case ISEC1_TABLE4_DAY: timeunit = TUNIT_DAY; break;
case ISEC1_TABLE4_MINUTE: timeunit = TUNIT_MINUTE; break;
case ISEC1_TABLE4_QUARTER: timeunit = TUNIT_QUARTER; break;
case ISEC1_TABLE4_30MINUTES: timeunit = TUNIT_30MINUTES; break;
case ISEC1_TABLE4_HOUR: timeunit = TUNIT_HOUR; break;
case ISEC1_TABLE4_3HOURS: timeunit = TUNIT_3HOURS; break;
case ISEC1_TABLE4_6HOURS: timeunit = TUNIT_6HOURS; break;
case ISEC1_TABLE4_12HOURS: timeunit = TUNIT_12HOURS; break;
case ISEC1_TABLE4_DAY: timeunit = TUNIT_DAY; break;
default:
if ( lprint )
{
......@@ -1568,14 +1569,15 @@ int cgribexDefDateTime(int *isec1, int timeunit, int date, int time)
switch (timeunit)
{
case TUNIT_MINUTE: factor = 60; ISEC1_TimeUnit = ISEC1_TABLE4_MINUTE; break;
case TUNIT_QUARTER: factor = 900; ISEC1_TimeUnit = ISEC1_TABLE4_QUARTER; break;
case TUNIT_HOUR: factor = 3600; ISEC1_TimeUnit = ISEC1_TABLE4_HOUR; break;
case TUNIT_3HOURS: factor = 10800; ISEC1_TimeUnit = ISEC1_TABLE4_3HOURS; break;
case TUNIT_6HOURS: factor = 21600; ISEC1_TimeUnit = ISEC1_TABLE4_6HOURS; break;
case TUNIT_12HOURS: factor = 43200; ISEC1_TimeUnit = ISEC1_TABLE4_12HOURS; break;
case TUNIT_DAY: factor = 86400; ISEC1_TimeUnit = ISEC1_TABLE4_DAY; break;
default: factor = 3600; ISEC1_TimeUnit = ISEC1_TABLE4_HOUR; break;
case TUNIT_MINUTE: factor = 60; ISEC1_TimeUnit = ISEC1_TABLE4_MINUTE; break;
case TUNIT_QUARTER: factor = 900; ISEC1_TimeUnit = ISEC1_TABLE4_QUARTER; break;
case TUNIT_30MINUTES: factor = 1800; ISEC1_TimeUnit = ISEC1_TABLE4_30MINUTES; break;
case TUNIT_HOUR: factor = 3600; ISEC1_TimeUnit = ISEC1_TABLE4_HOUR; break;
case TUNIT_3HOURS: factor = 10800; ISEC1_TimeUnit = ISEC1_TABLE4_3HOURS; break;
case TUNIT_6HOURS: factor = 21600; ISEC1_TimeUnit = ISEC1_TABLE4_6HOURS; break;
case TUNIT_12HOURS: factor = 43200; ISEC1_TimeUnit = ISEC1_TABLE4_12HOURS; break;
case TUNIT_DAY: factor = 86400; ISEC1_TimeUnit = ISEC1_TABLE4_DAY; break;
default: factor = 3600; ISEC1_TimeUnit = ISEC1_TABLE4_HOUR; break;
}
return (factor);
......@@ -1588,7 +1590,7 @@ void cgribexDefTime(int *isec1, int vdate, int vtime, int tsteptype, int numavg,
int timerange = 0;
int timeunit = TUNIT_HOUR;
if ( taxisID != -1 )
if ( taxisID != -1 )
{
timetype = taxisInqType(taxisID);
timeunit = taxisInqTunit(taxisID);
......
......@@ -28,14 +28,15 @@ char *Timeunits[] = {
"undefined",
"seconds",
"minutes",
"hours",
"days",
"months",
"years",
"quarters",
"30minutes",
"hours",
"3hours",
"6hours",
"12hours",
"days",
"months",
"years",
};
......@@ -1053,8 +1054,9 @@ void cdiEncodeTimevalue(int days, int secs, int timeunit, double *timevalue)
{
*timevalue = days*86400. + secs;
}
else if ( timeunit == TUNIT_MINUTE ||
timeunit == TUNIT_QUARTER )
else if ( timeunit == TUNIT_MINUTE ||
timeunit == TUNIT_QUARTER ||
timeunit == TUNIT_30MINUTES )
{
*timevalue = days*1440. + secs/60.;
}
......
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