h1_summary2.c
changeset 3 d3122367777b
parent 1 2ce4ee911439
     1.1 --- a/h1_summary2.c	Mon Oct 01 15:49:25 2007 -0400
     1.2 +++ b/h1_summary2.c	Wed Oct 03 11:23:02 2007 -0400
     1.3 @@ -788,7 +788,7 @@
     1.4  	double *tbounds)
     1.5  {
     1.6  	int i, j;
     1.7 -	float hr[HOURS_PER_DAY];
     1.8 +	float hr[HOURS_PER_DAY], mean_time;
     1.9  	struct var *in_vnode, *out_vnode;
    1.10  	void *val;
    1.11  
    1.12 @@ -823,6 +823,12 @@
    1.13  					val = read_timeslice(in_ncid, in_vnode->ncvarid, in_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, ((input_dim_idx[in_vnode->dimids[0]])->len - 1));
    1.14  					if (!strcmp(in_vnode->name, time_bounds_name))
    1.15  						write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, tbounds, 0);
    1.16 +					else if (!strcmp(in_vnode->name, time_name)) {
    1.17 +						/* force the timestamp to be the
    1.18 +						 * mean of the time bounds */
    1.19 +						mean_time = (tbounds[0] + tbounds[1]) / 2.0;
    1.20 +						write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, &mean_time, 0);
    1.21 +					}
    1.22  					else
    1.23  						write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, val, 0);
    1.24  				}