Index: wflow-py/wflow/wf_netcdfio.py =================================================================== diff -u -r5cfd4619803c1e781acb3032ea9d4e27f9620c59 -r7b23641f11fe15d03482a58d08d372f62d449618 --- wflow-py/wflow/wf_netcdfio.py (.../wf_netcdfio.py) (revision 5cfd4619803c1e781acb3032ea9d4e27f9620c59) +++ wflow-py/wflow/wf_netcdfio.py (.../wf_netcdfio.py) (revision 7b23641f11fe15d03482a58d08d372f62d449618) @@ -779,30 +779,29 @@ ) ncindex = pos - if var in self.alldat: - if ncindex == self.lstep: # Read new block of data in mem - logging.debug( - "reading new netcdf data block starting at: " + str(ncindex) - ) - for vars in self.alldat: - if len(vars) == 3: - self.alldat[vars] = self.dataset.variables[vars][ - ncindex : ncindex + self.maxsteps - ] - elif len(vars) == 4: - self.alldat[vars] = self.dataset.variables[vars][ - ncindex : ncindex + self.maxsteps, 0 - ] + 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)) + # for vars in self.alldat: + # self.alldat[vars] = self.dataset.variables[vars][ncindex:ncindex + self.maxsteps] + # + # self.fstep = ncindex + # self.lstep = ncindex + self.maxsteps - self.fstep = ncindex - self.lstep = ncindex + self.maxsteps + if len(self.alldat[var].dimensions) == 3: + np_step = self.alldat[var][ + ncindex - self.fstep, + self.latidx.min() : self.latidx.max() + 1, + self.lonidx.min() : self.lonidx.max() + 1, + ] + if len(self.alldat[var].dimensions) == 4: + np_step = self.alldat[var][ + ncindex - self.fstep, + 0, + self.latidx.min() : self.latidx.max() + 1, + self.lonidx.min() : self.lonidx.max() + 1, + ] - np_step = self.alldat[var][ - ncindex - self.fstep, - self.latidx.min() : self.latidx.max() + 1, - self.lonidx.min() : self.lonidx.max() + 1, - ] - miss = float(self.dataset.variables[var]._FillValue) if self.flip: return numpy2pcr(Scalar, flipud(np_step).copy(), miss), True