def nearest_point(self, point): assert type(point) == Location4D new = self._copy() for var in new._current_variables: grid = new.getgridobj(var) if grid != None: inds, inds = new.get_xyind_from_point(var, point) grid._xarray = _sub_by_nan2(grid._xarray, inds) grid._yarray = _sub_by_nan2(grid._yarray, inds) new._coordcache[var].xy = grid return new
def restrict_bbox(self, bbox=None, **kwargs): assert bbox != None assert len(bbox) == 4 new = self._copy() for var in new._current_variables: grid = new.getgridobj(var) if grid != None: inds, inds = new.get_xyind_from_bbox(var, bbox) grid._xarray = _sub_by_nan2(grid._xarray, inds) grid._yarray = _sub_by_nan2(grid._yarray, inds) new._coordcache[var].xy = grid return new
def restrict_bbox(self, bbox = None, **kwargs): assert bbox != None assert len(bbox) == 4 new = self._copy() for var in new._current_variables: grid = new.getgridobj(var) if grid != None: inds, inds = new.get_xyind_from_bbox(var, bbox) grid._xarray = _sub_by_nan2(grid._xarray, inds) grid._yarray = _sub_by_nan2(grid._yarray, inds) new._coordcache[var].xy = grid return new