Commit 024f5409 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Added function set_calendar().

parent c5badb90
......@@ -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);
}
......@@ -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
......@@ -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 )
......
Supports Markdown
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