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_nan(grid._xarray, inds) grid._yarray = _sub_by_nan(grid._yarray, inds) new._coordcache[var].xy = grid return new
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: xind, yind = new.get_xyind_from_point(var, point) grid._xarray = _sub_by_nan(grid._xarray, xind) grid._yarray = _sub_by_nan(grid._yarray, yind) 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_nan(grid._xarray, inds[0][0]) grid._yarray = _sub_by_nan(grid._yarray, inds[0][0]) 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: xinds, yinds = new.get_xyind_from_bbox(var, bbox) grid._xarray = _sub_by_nan(grid._xarray, xinds[0][0]) grid._yarray = _sub_by_nan(grid._yarray, yinds[0][0]) new._coordcache[var].xy = grid return new