SafeguardedCodec( codec=codec, # any numcodecs codec safeguards=[ # we use a constant grid spacing and the valid boundary condition # to preserve an absolute error bound over the Laplacian, but not # on the data boundaries where data points do not have a left, # right, upper, or lower neighbour dict( kind="qoi_eb_stencil", qoi=|\qu\qu\qu| ( finite_difference( # type=0 refers to a central difference x, order=2, accuracy=2, type=0, axis=0, grid_spacing=c["dy"] ) + finite_difference( x, order=2, accuracy=2, type=0, axis=1, grid_spacing=c["dx"] ) ) |\qu\qu\qu|, neighbourhood=[ dict(axis=0, before=1, after=1, boundary="valid"), dict(axis=1, before=1, after=1, boundary="valid"), ], type="abs", eb=0.01, ), ], fixed_constants=dict(dx=dx, dy=dy), )