diff --git a/docs/Development/ReleaseNotes.md b/docs/Development/ReleaseNotes.md index b8b3a823c..59637c99d 100644 --- a/docs/Development/ReleaseNotes.md +++ b/docs/Development/ReleaseNotes.md @@ -135,6 +135,8 @@ To check which release of VIC you are running: 1. Renamed "fcov" to "fcan" in image driver to better match variable code name ([GH#673](https://github.com/UW-Hydro/VIC/pull/673)) +1. NetCDF forcing files are now closed at the last timestep in stead of after the last timestep. ([GH#774](https://github.com/UW-Hydro/VIC/pull/774)) + ------------------------------ ## VIC 5.0.1 diff --git a/vic/drivers/image/src/vic_force.c b/vic/drivers/image/src/vic_force.c index 1209335e0..eb8dab57d 100644 --- a/vic/drivers/image/src/vic_force.c +++ b/vic/drivers/image/src/vic_force.c @@ -245,7 +245,7 @@ vic_force(void) if (mpi_rank == VIC_MPI_ROOT) { // Close forcing file if it is the last time step - if (current == global_param.nrecs) { + if (current == global_param.nrecs - 1) { status = nc_close(filenames.forcing[0].nc_id); check_nc_status(status, "Error closing %s", filenames.forcing[0].nc_filename); @@ -375,7 +375,7 @@ vic_force(void) if (mpi_rank == VIC_MPI_ROOT) { // Close forcing file if it is the last time step - if (current == global_param.nrecs) { + if (current == global_param.nrecs - 1) { status = nc_close(filenames.forcing[1].nc_id); check_nc_status(status, "Error closing %s", filenames.forcing[1].nc_filename);