Skip to content

Commit 8d64e34

Browse files
yixinmaoJoe Hamman
authored and
Joe Hamman
committed
Fixed image driver history file name (#635)
* Fixed image driver history file name timetamp - now is timstep-beginning * Added release notes about PR #635 (fixing image driver history filename timestamp)
1 parent 96e3177 commit 8d64e34

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

docs/Development/ReleaseNotes.md

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ To check which release of VIC you are running:
2020

2121
#### Bug Fixes:
2222

23+
1. Fixed image driver history file name timestamp ([GH#635](https://github.com/UW-Hydro/VIC/pull/635))
24+
25+
After the fix, the timestamp appeared in the image driver output history filename is the beginning time of the time period in the file.
26+
2327
------------------------------
2428

2529
## VIC 5.0.0 [![DOI](https://zenodo.org/badge/7766/UW-Hydro/VIC.svg)](https://zenodo.org/badge/latestdoi/7766/UW-Hydro/VIC)

vic/drivers/shared_image/src/vic_init_output.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -231,25 +231,29 @@ initialize_history_file(nc_file_struct *nc,
231231
case FREQ_NDAYS:
232232
sprintf(stream->filename, "%s/%s.%04d-%02d-%02d.nc",
233233
filenames.result_dir,
234-
stream->prefix, ref_dmy->year, ref_dmy->month,
235-
ref_dmy->day);
234+
stream->prefix, stream->time_bounds[0].year,
235+
stream->time_bounds[0].month,
236+
stream->time_bounds[0].day);
236237
break;
237238
case FREQ_NMONTHS:
238239
// If FREQ_NMONTHS -- filename = result_dir/prefix.YYYY-MM.nc
239240
sprintf(stream->filename, "%s/%s.%04d-%02d.nc", filenames.result_dir,
240-
stream->prefix, ref_dmy->year, ref_dmy->month);
241+
stream->prefix, stream->time_bounds[0].year,
242+
stream->time_bounds[0].month);
241243
break;
242244
case FREQ_NYEARS:
243245
// If FREQ_NYEARS -- filename = result_dir/prefix.YYYY.nc
244246
sprintf(stream->filename, "%s/%s.%04d.nc", filenames.result_dir,
245-
stream->prefix, ref_dmy->year);
247+
stream->prefix, stream->time_bounds[0].year);
246248
break;
247249
default:
248250
// For all other cases -- filename = result_dir/prefix.YYYY-MM-DD-SSSSS.nc
249251
sprintf(stream->filename, "%s/%s.%04d-%02d-%02d-%05u.nc",
250252
filenames.result_dir,
251-
stream->prefix, ref_dmy->year, ref_dmy->month,
252-
ref_dmy->day, ref_dmy->dayseconds);
253+
stream->prefix, stream->time_bounds[0].year,
254+
stream->time_bounds[0].month,
255+
stream->time_bounds[0].day,
256+
stream->time_bounds[0].dayseconds);
253257
}
254258

255259
// open the netcdf file

0 commit comments

Comments
 (0)