ocean-eddy-cpt / gcm-filters-paper

Manuscript on spatial filtering method
1 stars 0 forks source link

Make figure for example 3 (effective kernel) #9

Closed NoraLoose closed 3 years ago

NoraLoose commented 3 years ago

Example 3 in #1:

Apply the filter to a discrete delta function (data is 1 at one grid point, 0 elsewhere) on the POP 0.1 degree grid so that we can see the shape of the effective kernel. We could use this to show

NoraLoose commented 3 years ago

Here is a first attempt:

effective_kernel_boundary_aware

NoraLoose commented 3 years ago

For kernels that ignore boundaries, the lower 2 panels look like this:

effective_kernel_boundary_unaware

NoraLoose commented 3 years ago

The delta functions in the upper panel of the first plot have a value of 1, but the amplitudes of the effective kernel decrease pretty rapidly. So either we have to saturate the colorbar massively as above, or we plot on a log scale:

effective_kernel_boundary_aware_log

NoraLoose commented 3 years ago

I think it makes sense to show these kernels on the native model grid, so you can actually see the extent of the kernel in terms of grid boxes, equal to the filter width N. Alternatively, plotting on a lat/lon grid would give something like:

effective_kernel_boundary_aware_latlon

NoraLoose commented 3 years ago

I updated the effective kernel figure, so that it includes all three filter types that we implemented in gcm-filters so far: isotropic filter, anisotropic filter (aligned with grid), and fixed factor filter.

effective_kernel_log_N50

Interestingly, the effective kernels of fixed scale (1st column) vs. fixed factor (3rd column) look quite different, both in the ocean interior and along the boundaries. For the fixed scale filter, Gaussian and Taper filter kernels don't seem to show significant differences at all! Thoughts?

NoraLoose commented 3 years ago

I repeated the same analysis for n_steps=90. Some of the effective kernel shapes become quite funky. (This may be again an indication for us having to look into numerical accuracy/instability for large n_steps.)

effective_kernel_log_N90

iangrooms commented 3 years ago

I'm surprised to not see negative weights in the "isotropic taper" n_steps=50. What is the filter length scale?

NoraLoose commented 3 years ago

I just added the notebook that produced the plots. Filter length scale is 111.7 km. For the isotropic filters in the first column, I chose kappa=1. For the anisotropic filter in the second column, I chose kappa_w=1 and kappa_s=0.1.

iangrooms commented 3 years ago

I'm guessing that n_steps=50 is well below the default. If you look at figure 1 in the paper you can see that when n_steps is too low with the taper filter is doesn't have the negative weights and looks pretty similar to the Gaussian filter. I suggest making the filter scale smaller to see the negative weights.

NoraLoose commented 3 years ago

Yes, I think you are right. For a filter length scale of 111.7 km and dx_min=2.2 km (as in POP example above), the default for the Gaussian filter is n_steps=90, but for the Taper filter would be n_steps=319. I will choose a smaller filter length scale, which will decrease the default n_steps too.

NoraLoose commented 3 years ago

Here is the same figure again, but this time all panels use the default n_steps.

effective_kernel_scale_112km_fac_10_log

First column is filtered to 112km (1 degree latitude); Gaussian: n_steps=90, Taper: n_steps=319. Second column is as the first column, but filter scale in (grid-aligned) south direction is decreased by a factor of 10. nsteps are as in first column. Third column is filtered with fixed factor=10. (Since POP model output is nominally 0.1 degree, the width of the kernel is expected approximately comparable to the one in the first column.) Gaussian: n_steps=18, Taper: n_steps=64

I currently don't fully understand why there are problems with the "isotropic" Taper kernel (which in practice is not really isotropic), whereas the anisotropic Taper kernel looks as expected.

NoraLoose commented 3 years ago

Decreasing the filter scale from 112km to 30km seems to solve the problem:

effective_kernel_default_nsteps_30km_fac_10_log

Here, n_steps is again chosen as the default, and indicated in the figure captions. The third column is identical to previous figure (fixed factor = 10).

NoraLoose commented 3 years ago

Looking at the POP grid spacing makes me believe that this is actually not a problem with our filter but with the abrupt shift in dy right around nlat=1500 (around 40N) in the east Atlantic (see right plot). It seems I might have chosen an unlucky spot to look at effective kernels...

POP_grid
iangrooms commented 3 years ago

I think the weirdness with a filter scale of 112km is probably more a result of the numerical stability problems than the grid changes at 40N, though I could be wrong. I suggest to wait until we've resolved the stability problems (#24) and then try to re-do the figure using a 112km filter scale.

NoraLoose commented 3 years ago

@iangrooms, first I also suspected that numerical instabilities caused the weird filter shape. But if that was the cause, I would expect to see the same problem in the anisotropic Taper (it uses the same filter specs: length scale = 112km and n_steps=319), but the anisotropic Taper above looks fine.

To clear up this question, I repeated the analysis in the tropical Pacific, where the grid is better behaved. The problem disappears, so I think the issue was really the grid changes at 40N.

effective_kernel_scale_112km_fac_10_tropPac_log

Filter specs are as before: First column is filtered to 112km (1 degree latitude); Gaussian: n_steps=90, Taper: n_steps=319. Second column is as the first column, but filter scale in (grid-aligned) south direction is decreased by a factor of 10. nsteps are as in first column. Third column is filtered with fixed factor=10. Gaussian: n_steps=18, Taper: n_steps=64

iangrooms commented 3 years ago

OK, glad to be corrected. Maybe we should just use this figure instead then?