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

No commit message

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