# HG changeset patch # User Forrest Hoffman # Date 1191424982 14400 # Node ID d3122367777b7f7e74d714fafc68d798edc2afff # Parent 978f4510987d07cfbcfd98d124833be1135381da Changed h1_summary/h1_summary2 to write a timestamp that is centered on the time bounds. h1_summary and h1_summary2 previously wrote out a timestamp representing the last time entry in the last file to be summarized. Now, to follow convention, the timestamp is recomputed as the mean of the first and last time_bounds, where the first time_bounds value is the first value from the first time entry in the first file and the last time_bounds is the second value from the last time entry in the last file. diff -r 978f4510987d -r d3122367777b h1_summary.c --- a/h1_summary.c Mon Oct 01 15:49:25 2007 -0400 +++ b/h1_summary.c Wed Oct 03 11:23:02 2007 -0400 @@ -788,7 +788,7 @@ double *tbounds) { int i, j; - float hr[HOURS_PER_DAY]; + float hr[HOURS_PER_DAY], mean_time; struct var *in_vnode, *out_vnode; void *val; @@ -823,6 +823,12 @@ 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)); if (!strcmp(in_vnode->name, time_bounds_name)) write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, tbounds, 0); + else if (!strcmp(in_vnode->name, time_name)) { + /* force the timestamp to be the + * mean of the time bounds */ + mean_time = (tbounds[0] + tbounds[1]) / 2.0; + write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, &mean_time, 0); + } else write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, val, 0); } diff -r 978f4510987d -r d3122367777b h1_summary2.c --- a/h1_summary2.c Mon Oct 01 15:49:25 2007 -0400 +++ b/h1_summary2.c Wed Oct 03 11:23:02 2007 -0400 @@ -788,7 +788,7 @@ double *tbounds) { int i, j; - float hr[HOURS_PER_DAY]; + float hr[HOURS_PER_DAY], mean_time; struct var *in_vnode, *out_vnode; void *val; @@ -823,6 +823,12 @@ 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)); if (!strcmp(in_vnode->name, time_bounds_name)) write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, tbounds, 0); + else if (!strcmp(in_vnode->name, time_name)) { + /* force the timestamp to be the + * mean of the time bounds */ + mean_time = (tbounds[0] + tbounds[1]) / 2.0; + write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, &mean_time, 0); + } else write_timeslice(out_ncid, out_vnode->ncvarid, out_vnode->nctype, in_vnode->ndims, in_vnode->dimids, in_dim_idx, val, 0); }