Commit ccfee14f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

time axis: added support for NC_FLOAT.

parent 2b02a478
2016-09-19 Uwe Schulzweida
* time axis: added support for NC_FLOAT
2016-09-15 Uwe Schulzweida
* zaxis: added support for user defined attributes
......
......@@ -3809,8 +3809,12 @@ int cdfInqContents(stream_t *streamptr)
{
taxis_t *taxis = &streamptr->tsteps[0].taxis;
ptaxisDefName(taxis, ncvars[nctimevarid].name);
if ( ncvars[nctimevarid].longname[0] )
ptaxisDefLongname(taxis, ncvars[nctimevarid].longname);
int datatype = (ncvars[nctimevarid].xtype == NC_FLOAT) ? DATATYPE_FLT32 : DATATYPE_FLT64;
ptaxisDefDatatype(taxis, datatype);
}
if ( nctimevarid != UNDEFID )
......
......@@ -246,7 +246,9 @@ void cdfDefTime(stream_t* streamptr)
cdf_def_dim(fileID, taxis_name, NC_UNLIMITED, &time_dimid);
streamptr->basetime.ncdimid = time_dimid;
cdf_def_var(fileID, taxis_name, NC_DOUBLE, 1, &time_dimid, &time_varid);
nc_type xtype = (taxis->datatype == DATATYPE_FLT32) ? NC_FLOAT : NC_DOUBLE;
cdf_def_var(fileID, taxis_name, xtype, 1, &time_dimid, &time_varid);
streamptr->basetime.ncvarid = time_varid;
......@@ -291,7 +293,7 @@ void cdfDefTime(stream_t* streamptr)
{
int leadtimeid;
cdf_def_var(fileID, "leadtime", NC_DOUBLE, 1, &time_dimid, &leadtimeid);
cdf_def_var(fileID, "leadtime", xtype, 1, &time_dimid, &leadtimeid);
streamptr->basetime.leadtimeid = leadtimeid;
......
......@@ -151,6 +151,7 @@ void taxisDefaultValue(taxis_t* taxisptr)
{
taxisptr->self = CDI_UNDEFID;
taxisptr->used = false;
taxisptr->datatype = DATATYPE_FLT64;
taxisptr->type = DefaultTimeType;
taxisptr->vdate = 0;
taxisptr->vtime = 0;
......@@ -878,6 +879,12 @@ taxis_t *taxisPtr(int taxisID)
}
void ptaxisDefDatatype(taxis_t *taxisptr, int datatype)
{
taxisptr->datatype = datatype;
}
void ptaxisDefName(taxis_t *taxisptr, const char *name)
{
if ( name )
......@@ -1347,6 +1354,7 @@ void ptaxisCopy(taxis_t *dest, taxis_t *source)
/* memcpy(dest, source, sizeof(taxis_t)); */
dest->used = source->used;
dest->datatype = source->datatype;
dest->type = source->type;
dest->vdate = source->vdate;
dest->vtime = source->vtime;
......
......@@ -13,6 +13,7 @@ typedef struct {
int self;
bool used;
short has_bounds;
int datatype; // datatype
int type; // time type
int vdate; // verification date
int vtime; // verification time
......@@ -30,8 +31,8 @@ typedef struct {
int vtime_ub; // upper bounds of vtime
int fc_unit; // forecast time unit
double fc_period; // forecast time period
char* name;
char* longname;
char *name;
char *longname;
}
taxis_t;
......@@ -44,6 +45,7 @@ double cdiEncodeTimeval(int date, int time, taxis_t* taxis);
void timeval2vtime(double timevalue, taxis_t* taxis, int* vdate, int* vtime);
double vtime2timeval(int vdate, int vtime, taxis_t *taxis);
void ptaxisDefDatatype(taxis_t *taxisptr, int datatype);
void ptaxisDefName(taxis_t *taxisptr, const char *name);
void ptaxisDefLongname(taxis_t *taxisptr, const char *name);
void taxisDestroyKernel(taxis_t *taxisptr);
......
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