diff --git a/src/cdi_limits.h b/src/cdi_limits.h index c458573e7c07ec034d12eddbbc1648741257f773..5f7be81f26b1371f40869721fd17c6d12b2ae9e9 100644 --- a/src/cdi_limits.h +++ b/src/cdi_limits.h @@ -8,7 +8,7 @@ #define MIN_TAXES 1024 /* minimum number of taxes */ #define MAX_TAXES 65536 /* maximum number of taxes */ #define MAX_ZAXES 1024 /* maximum number of zaxes */ -#define MAX_GRIDS 1024 /* maximum number of grids */ +#define MAX_GRIDS 8192 /* maximum number of grids */ #define MAX_INSTS 1024 /* maximum number of instituts */ #define MAX_MODELS 1024 /* maximum number of models */ #define MAX_GRIDS_PS 128 /* maximum number of different grids per stream */ diff --git a/src/stream_cdf.c b/src/stream_cdf.c index db43c73fc12d53749014d978802b2ecc8ee2d428..854f729c882ee6a3547b3920f1a0944d68688a0a 100644 --- a/src/stream_cdf.c +++ b/src/stream_cdf.c @@ -125,6 +125,10 @@ int get_timeunit(int len, char *ptu) else if ( memcmp(ptu, "calendar_month", 14) == 0 ) timeunit = TUNIT_MONTH; else if ( memcmp(ptu, "year", 4) == 0 ) timeunit = TUNIT_YEAR; } + else if ( len == 1 ) + { + if ( ptu[0] == 's' ) timeunit = TUNIT_SECOND; + } return (timeunit); } diff --git a/src/taxis.c b/src/taxis.c index 6f68907c5f9a2cd6c3b36e4e1f72aaf0a49a2b54..cf2ef71de047ffac5c11cd08a34aa6b9e41e9d7f 100644 --- a/src/taxis.c +++ b/src/taxis.c @@ -1214,6 +1214,28 @@ double vtime2timeval(int vdate, int vtime, taxis_t *taxis) } +void conv_timeval(double timevalue, int *rvdate, int *rvtime) +{ + int vdate = 0, vtime = 0; + int hour, minute, second; + int daysec; + + vdate = (int) timevalue; + if ( vdate < 0 ) + daysec = (int) (-(timevalue - vdate)*86400 + 0.01); + else + daysec = (int) ( (timevalue - vdate)*86400 + 0.01); + + hour = daysec / 3600; + minute = (daysec - hour*3600)/60; + second = daysec - hour*3600 - minute*60; + vtime = cdiEncodeTime(hour, minute, second); + + *rvdate = vdate; + *rvtime = vtime; +} + + void splitTimevalue(double timevalue, int timeunit, int *date, int *time) { static char func[] = "splitTimevalue"; @@ -1223,32 +1245,19 @@ void splitTimevalue(double timevalue, int timeunit, int *date, int *time) int daysec; static int lwarn = TRUE; - if ( timeunit == TUNIT_HOUR ) + if ( timeunit == TUNIT_SECOND ) + { + timevalue /= 86400; + conv_timeval(timevalue, &vdate, &vtime); + } + else if ( timeunit == TUNIT_HOUR ) { timevalue /= 24; - vdate = (int) timevalue; - if ( vdate < 0 ) - daysec = (int) (-(timevalue - vdate)*86400 + 0.01); - else - daysec = (int) ( (timevalue - vdate)*86400 + 0.01); - - hour = daysec / 3600; - minute = (daysec - hour*3600)/60; - second = daysec - hour*3600 - minute*60; - vtime = cdiEncodeTime(hour, minute, second); + conv_timeval(timevalue, &vdate, &vtime); } else if ( timeunit == TUNIT_DAY ) { - vdate = (int) timevalue; - if ( vdate < 0 ) - daysec = (int) (-(timevalue - vdate)*86400 + 0.01); - else - daysec = (int) ( (timevalue - vdate)*86400 + 0.01); - - hour = daysec / 3600; - minute = (daysec - hour*3600)/60; - second = daysec - hour*3600 - minute*60; - vtime = cdiEncodeTime(hour, minute, second); + conv_timeval(timevalue, &vdate, &vtime); } else if ( timeunit == TUNIT_MONTH ) {