Skip to content
GitLab
Menu
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
024f5409
Commit
024f5409
authored
Jul 06, 2016
by
Uwe Schulzweida
Browse files
Added function set_calendar().
parent
c5badb90
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cdf_util.c
View file @
024f5409
...
...
@@ -288,3 +288,25 @@ void set_zaxistype(const char *attstring, int *zaxistype)
}
}
}
void
set_calendar
(
const
char
*
attstring
,
int
*
calendar
)
{
if
(
memcmp
(
attstring
,
"standard"
,
8
)
==
0
||
memcmp
(
attstring
,
"gregorian"
,
9
)
==
0
)
*
calendar
=
CALENDAR_STANDARD
;
else
if
(
memcmp
(
attstring
,
"none"
,
4
)
==
0
)
*
calendar
=
CALENDAR_NONE
;
else
if
(
memcmp
(
attstring
,
"proleptic"
,
9
)
==
0
)
*
calendar
=
CALENDAR_PROLEPTIC
;
else
if
(
memcmp
(
attstring
,
"360"
,
3
)
==
0
)
*
calendar
=
CALENDAR_360DAYS
;
else
if
(
memcmp
(
attstring
,
"365"
,
3
)
==
0
||
memcmp
(
attstring
,
"noleap"
,
6
)
==
0
)
*
calendar
=
CALENDAR_365DAYS
;
else
if
(
memcmp
(
attstring
,
"366"
,
3
)
==
0
||
memcmp
(
attstring
,
"all_leap"
,
8
)
==
0
)
*
calendar
=
CALENDAR_366DAYS
;
else
Warning
(
"calendar >%s< unsupported!"
,
attstring
);
}
src/cdf_util.h
View file @
024f5409
...
...
@@ -21,5 +21,6 @@ bool is_lat_axis(const char *units, const char *stdname);
void
set_gridtype
(
const
char
*
attstring
,
int
*
gridtype
);
void
set_zaxistype
(
const
char
*
attstring
,
int
*
zaxistype
);
void
set_calendar
(
const
char
*
attstring
,
int
*
calendar
);
#endif
src/stream_cdf_i.c
View file @
024f5409
...
...
@@ -3812,24 +3812,7 @@ int cdfInqContents(stream_t *streamptr)
cdfGetAttText
(
fileID
,
nctimevarid
,
"calendar"
,
attstringlen
,
attstring
);
strtolower
(
attstring
);
if
(
memcmp
(
attstring
,
"standard"
,
8
)
==
0
||
memcmp
(
attstring
,
"gregorian"
,
9
)
==
0
)
calendar
=
CALENDAR_STANDARD
;
else
if
(
memcmp
(
attstring
,
"none"
,
4
)
==
0
)
calendar
=
CALENDAR_NONE
;
else
if
(
memcmp
(
attstring
,
"proleptic"
,
9
)
==
0
)
calendar
=
CALENDAR_PROLEPTIC
;
else
if
(
memcmp
(
attstring
,
"360"
,
3
)
==
0
)
calendar
=
CALENDAR_360DAYS
;
else
if
(
memcmp
(
attstring
,
"365"
,
3
)
==
0
||
memcmp
(
attstring
,
"noleap"
,
6
)
==
0
)
calendar
=
CALENDAR_365DAYS
;
else
if
(
memcmp
(
attstring
,
"366"
,
3
)
==
0
||
memcmp
(
attstring
,
"all_leap"
,
8
)
==
0
)
calendar
=
CALENDAR_366DAYS
;
else
Warning
(
"calendar >%s< unsupported!"
,
attstring
);
set_calendar
(
attstring
,
&
calendar
);
}
if
(
streamptr
->
tsteps
[
0
].
taxis
.
type
==
TAXIS_FORECAST
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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