Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# for every axis. If there is no connection data, fnum will not
# be a key for self._connections.
if fnum in self._connections:
# it should always be a len 2 tuple
face_connection = self._connections[fnum][0 if is_left_edge else 1]
else:
face_connection = None
if (face_connection is None) or ignore_connections:
# no connection: use specified boundary condition instead
if self._facedim:
da_face = da.isel(**{self._facedim: slice(fnum, fnum + 1)})
else:
da_face = da
return _apply_boundary_condition(
da_face,
this_dim,
is_left_edge,
boundary=boundary,
fill_value=fill_value,
)
neighbor_fnum, neighbor_axis, reverse = face_connection
# check for consistency
if face_axis is None:
assert neighbor_fnum is None
# Build up a slice that selects the correct edge region for a
# given face. We work directly with variables rather than
# DataArrays in the hopes of greater efficiency, avoiding