Index: examples/wflow_rhine_sbm_nc/wflow_sbm_NC.ini =================================================================== diff -u -ra509bea894d88eb107b36f7e83f6bf9b1a36096c -r77cf4f27a67426009f3cdc6df0af96528d662aee --- examples/wflow_rhine_sbm_nc/wflow_sbm_NC.ini (.../wflow_sbm_NC.ini) (revision a509bea894d88eb107b36f7e83f6bf9b1a36096c) +++ examples/wflow_rhine_sbm_nc/wflow_sbm_NC.ini (.../wflow_sbm_NC.ini) (revision 77cf4f27a67426009f3cdc6df0af96528d662aee) @@ -35,8 +35,8 @@ [run] # either a runinfo file or a start and end-time are required #runinfo=runinfo.xml -starttime=1991-01-01 00:00:00 -endtime=1991-12-31 00:00:00 +starttime=1991-02-01 00:00:00 +endtime=1991-03-01 00:00:00 # required, base timestep of the model timestepsecs = 86400 #start model with cold state @@ -79,7 +79,7 @@ netcdfinput= inmaps.nc #netcdfstatesinput = instates.nc #netcdfstaticinput = staticmaps.nc -netcdfwritebuffer=100 +netcdfwritebuffer=10 netcdf_least_significant_digit=2 #netcdf_format=NETCDF3_CLASSIC Index: wflow-py/wflow/wf_DynamicFramework.py =================================================================== diff -u -r5eaef8c3329dbaeb4f8b576cd04339101285351c -r77cf4f27a67426009f3cdc6df0af96528d662aee --- wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 5eaef8c3329dbaeb4f8b576cd04339101285351c) +++ wflow-py/wflow/wf_DynamicFramework.py (.../wf_DynamicFramework.py) (revision 77cf4f27a67426009f3cdc6df0af96528d662aee) @@ -474,6 +474,7 @@ self.DT = runDateTimeInfo(timestepsecs=timestepsecs, datetimestart=datetimestart, datetimeend=dte, mode='steps') + if lastTimeStep != 0: if firstTimestep == 0: firstTimestep = 1 @@ -1003,7 +1004,7 @@ st = configget(self._userModel().config, 'run', 'starttime', "None") - self.skipfirsttimestep = int(configget(self._userModel().config, 'run', 'skipfirst', "0")) + #self.skipfirsttimestep = int(configget(self._userModel().config, 'run', 'skipfirst', "0")) # Assume that we have set this via BMI if self.DT.setByBMI: Index: wflow-py/wflow/wf_netcdfio.py =================================================================== diff -u -r048e9fa4ca4b2c6a7c14169de0b192ea2ff9b983 -r77cf4f27a67426009f3cdc6df0af96528d662aee --- wflow-py/wflow/wf_netcdfio.py (.../wf_netcdfio.py) (revision 048e9fa4ca4b2c6a7c14169de0b192ea2ff9b983) +++ wflow-py/wflow/wf_netcdfio.py (.../wf_netcdfio.py) (revision 77cf4f27a67426009f3cdc6df0af96528d662aee) @@ -453,7 +453,7 @@ self.maxsteps = minimum(maxmb * len(a) / floatspermb + 1,maxlentime - 1) self.fstep = 0 self.lstep = self.fstep + self.maxsteps - + self.offset = 0 self.datetime = self.dataset.variables['time'][:] if hasattr(self.dataset.variables['time'],'units'): self.timeunits=self.dataset.variables['time'].units @@ -545,11 +545,19 @@ else: ncindex = timestep - 1 + + ncindex = ncindex + self.offset + if tsdatetime != None: - if tsdatetime != self.datetimelist[ncindex]: + if tsdatetime.replace(tzinfo=None) != self.datetimelist[ncindex].replace(tzinfo=None): logging.warn("Date/time does not match. Wanted " + str(tsdatetime) + " got " + str(self.datetimelist[ncindex])) - logging.warn("Index: " + str(ncindex) + " Par: " + var) + import bisect + pos = bisect.bisect_left(self.datetimelist,tsdatetime.replace(tzinfo=None)) + self.offset = pos - ncindex + logging.warn("Adjusting to the date/time at index and setting offset: " + str(pos) + ":" + str(self.offset) + ":" + str(self.datetimelist[pos])) + ncindex = pos + if self.alldat.has_key(var): if ncindex == self.lstep: # Read new block of data in mem logging.debug("reading new netcdf data block starting at: " + str(ncindex))