Commit 3a2a339d authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

No commit message

No commit message
parent 15645451
......@@ -6,6 +6,7 @@
* add support for TUNIT_QUARTER (15 minutes)
* use env GRIB_INVENTORY_MODE=timestep to skip double entries
* grbDefTime: define tunit also for absolute time [report: Pruek Pongprueksa]
* set default calendar with env CDI_DEFAULT_CALENDAR
* change default calendar to CALENDAR_PROLEPTIC
* gridInqXinc: bug fix
* grid_check_cyclic: support for curvilinear grids without bounds
......
......@@ -791,11 +791,12 @@ void cdfDefTime(int streamID)
len = strlen(calstr);
if ( len )
cdf_put_att_text(fileID, time_varid, "calendar", len, calstr);
{
cdf_put_att_text(fileID, time_varid, "calendar", len, calstr);
if ( taxis->has_bounds )
if ( len )
cdf_put_att_text(fileID, time_bndsid, "calendar", len, calstr);
if ( taxis->has_bounds )
cdf_put_att_text(fileID, time_bndsid, "calendar", len, calstr);
}
}
if ( streamptr->ncmode == 2 ) cdf_enddef(fileID);
......
......@@ -15,11 +15,13 @@
#include "stream_int.h"
int cdiDefaultInstID = CDI_UNDEFID;
int cdiDefaultModelID = CDI_UNDEFID;
int cdiDefaultTableID = CDI_UNDEFID;
int cdiNcMissingValue = CDI_UNDEFID;
int cdiSplitLtype105 = CDI_UNDEFID;
int cdiDefaultCalendar = CALENDAR_PROLEPTIC;
int cdiDefaultInstID = CDI_UNDEFID;
int cdiDefaultModelID = CDI_UNDEFID;
int cdiDefaultTableID = CDI_UNDEFID;
int cdiNcMissingValue = CDI_UNDEFID;
int cdiSplitLtype105 = CDI_UNDEFID;
int cdiIgnoreAttCoordinates = FALSE;
int cdiInventoryMode = 1;
......@@ -135,6 +137,26 @@ void cdiInitialize(void)
}
}
envString = getenv("CDI_CALENDAR");
if ( envString )
{
if ( strncmp(envString, "standard", 8) == 0 )
cdiDefaultCalendar = CALENDAR_STANDARD;
else if ( strncmp(envString, "proleptic", 9) == 0 )
cdiDefaultCalendar = CALENDAR_PROLEPTIC;
else if ( strncmp(envString, "360days", 7) == 0 )
cdiDefaultCalendar = CALENDAR_360DAYS;
else if ( strncmp(envString, "365days", 7) == 0 )
cdiDefaultCalendar = CALENDAR_365DAYS;
else if ( strncmp(envString, "366days", 7) == 0 )
cdiDefaultCalendar = CALENDAR_366DAYS;
else if ( strncmp(envString, "none", 4) == 0 )
cdiDefaultCalendar = CALENDAR_NONE;
if ( CDI_Debug )
Message(func, "Default calendar set to %s!", envString);
}
envString = getenv("PARTAB_INTERN");
if ( envString ) cdiPartabIntern = atoi(envString);
......
......@@ -10,9 +10,10 @@
#include "stream_int.h"
#include "calendar.h"
extern int cdiDefaultCalendar;
static int DefaultTimeType = TAXIS_ABSOLUTE;
static int DefaultTimeUnit = TUNIT_HOUR;
static int DefaultCalendar = CALENDAR_PROLEPTIC;
char *Timeunits[] = {
......@@ -206,7 +207,7 @@ void taxis_init_ptr(TAXIS *taxisptr)
taxisptr->vtime = 0;
taxisptr->rdate = CDI_UNDEFID;
taxisptr->rtime = 0;
taxisptr->calendar = DefaultCalendar;
taxisptr->calendar = cdiDefaultCalendar;
taxisptr->unit = DefaultTimeUnit;
taxisptr->numavg = 0;
taxisptr->has_bounds = FALSE;
......
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