Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
a5c1ad78
Commit
a5c1ad78
authored
Apr 07, 2008
by
Uwe Schulzweida
Browse files
taxis.c: add support for non integer timevalues (TUNIT_MONTH/CALENDAR_360DAYS)
parent
960d5fb1
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a5c1ad78
...
...
@@ -6,6 +6,7 @@
* update: echam5 code table
* fileOpen: add O_BINARY if available [report: Klaus Wyser]
* file.c: _WIN32 support
* taxis.c: add support for non integer timevalues (TUNIT_MONTH/CALENDAR_360DAYS)
* stream_cdf: add ICON grid support
* stream_srv: add support for GRID_CELL (bug fix)
* cdfInqContents: support of lon/lat units radian
...
...
src/basetime.c
View file @
a5c1ad78
...
...
@@ -13,7 +13,7 @@
void
basetimeInit
(
BaseTime
*
basetime
)
{
static
char
func
[]
=
"
cdiInitTime
"
;
static
char
func
[]
=
"
basetimeInit
"
;
if
(
basetime
==
NULL
)
Error
(
func
,
"Internal problem! Basetime not allocated."
);
...
...
src/taxis.c
View file @
a5c1ad78
...
...
@@ -921,6 +921,12 @@ void timeval2vtime(double timevalue, TAXIS *taxis, int *vdate, int *vtime)
decode_date
(
rdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
rtime
,
&
hour
,
&
minute
);
if
(
timeunit
==
TUNIT_MONTH
&&
calendar
==
CALENDAR_360DAYS
)
{
timeunit
=
TUNIT_DAY
;
timevalue
*=
30
;
}
if
(
timeunit
==
TUNIT_MONTH
||
timeunit
==
TUNIT_YEAR
)
{
if
(
timeunit
==
TUNIT_YEAR
)
timevalue
*=
12
;
...
...
@@ -959,6 +965,7 @@ double vtime2timeval(int vdate, int vtime, TAXIS *taxis)
int
rdate
,
rtime
;
double
value
;
int
timeunit
;
int
timeunit0
;
int
calendar
;
int
julday1
,
secofday1
,
julday2
,
secofday2
,
days
,
secs
;
...
...
@@ -981,6 +988,13 @@ double vtime2timeval(int vdate, int vtime, TAXIS *taxis)
decode_date
(
vdate
,
&
year
,
&
month
,
&
day
);
decode_time
(
vtime
,
&
hour
,
&
minute
);
timeunit0
=
timeunit
;
if
(
timeunit
==
TUNIT_MONTH
&&
calendar
==
CALENDAR_360DAYS
)
{
timeunit
=
TUNIT_DAY
;
}
if
(
timeunit
==
TUNIT_MONTH
||
timeunit
==
TUNIT_YEAR
)
{
value
=
(
year
-
ryear
)
*
12
-
rmonth
+
month
;
...
...
@@ -995,6 +1009,11 @@ double vtime2timeval(int vdate, int vtime, TAXIS *taxis)
encode_timevalue
(
days
,
secs
,
timeunit
,
&
value
);
}
if
(
timeunit0
==
TUNIT_MONTH
&&
calendar
==
CALENDAR_360DAYS
)
{
value
/=
30
;
}
return
(
value
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment