lagrangian-filtering icon indicating copy to clipboard operation
lagrangian-filtering copied to clipboard

Possibly incorrect sampling with periodic kernel

Open angus-g opened this issue 2 years ago • 0 comments

The periodic kernel wraps around at the extreme gridpoints in the direction of periodicity. If a sample variable is specified on tracer points, this means that the half a grid cell on the outside is ignored, leading to artifacts in the output. We need to actually wrap the particles around only when they completely exit the grid, e.g.

ff.fieldset.add_constant("halo_west", ff._output_grid.lon[0] - (ff._output_grid.lon[1] - ff._output_grid.lon[0]) / 2)
ff.fieldset.add_constant("halo_east", ff._output_grid.lon[-1] + (ff._output_grid.lon[1] - ff._output_grid.lon[0]) / 2)
ff.fieldset.add_periodic_halo(zonal=True)

To do this correctly, we'd probably need the full supergrid (corners and centres) specification. Because of the halo cells added by the call to add_periodic_halo(), there is a bit of a buffer to make sure we're sufficiently outside the real grid before wrapping.

angus-g avatar Feb 27 '23 06:02 angus-g