Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle simple fixed factor filtering internally #75

Merged
merged 37 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
e1d5a25
Add area as grid variable to REGULAR
NoraLoose Jun 8, 2021
17189fc
Introduce new base class for simple fixed filter Laplacians
NoraLoose Jun 11, 2021
c3a9291
Add area to fixture parameterizations for filter specs
NoraLoose Jun 11, 2021
3860607
Adapt filter error message to new base class
NoraLoose Jun 11, 2021
a1bf0f8
Implement simple fixed factor filtering in filter class
NoraLoose Jun 11, 2021
4e54e44
Change conservation tests to area-weighted integral
NoraLoose Jun 11, 2021
bf9cd3c
Group all simple fixed factor Laplacians under appropriate base class
NoraLoose Jun 11, 2021
0ee4277
Change all test data from uniform cell areas to random cell areas
NoraLoose Jun 11, 2021
0cf7dc8
Introduce separate pytest fixture for tripolar grids
NoraLoose Jun 11, 2021
6c79f21
Update tutorial.ipynb
NoraLoose Jun 11, 2021
112342a
Merge branch 'master' of https://github.com/ocean-eddy-cpt/gcm-filter…
NoraLoose Jun 11, 2021
9a9fed7
Update user warning in filter class
NoraLoose Jun 11, 2021
8d70243
Add test that checks that dx_min warning is raised
NoraLoose Jun 11, 2021
f6bcec7
Merge branch 'fixed-factor-filtering' of github.com:NoraLoose/gcm-fil…
NoraLoose Jun 11, 2021
5cb08da
Merge branch 'fixed-factor-filtering' of github.com:NoraLoose/gcm-fil…
NoraLoose Jun 11, 2021
1c93f46
Modify filter warn message
NoraLoose Jun 11, 2021
9039404
Merge branch 'fixed-factor-filtering' of github.com:NoraLoose/gcm-fil…
NoraLoose Jun 11, 2021
26c7800
Format warnings properly
NoraLoose Jun 11, 2021
a675207
Rerun tutorial.ipynb to get updated warnings
NoraLoose Jun 11, 2021
3afd84c
Update GPU tutorial with internal fixed factor filtering
NoraLoose Jun 11, 2021
72bffc8
Update tutorial_filter_types.ipynb: simple fixed factor
NoraLoose Jun 11, 2021
4b99312
Update simple fixed factor filtering in tripole tutorial
NoraLoose Jun 11, 2021
ece6a31
Make pre-commit happy
NoraLoose Jun 11, 2021
5e5004a
Fix more typos in tutorials
NoraLoose Jun 12, 2021
6ad40ab
Update simple fixed factor in numerical instab. tutorial
NoraLoose Jun 12, 2021
726e264
laplacian --> Laplacian
NoraLoose Jun 12, 2021
315fd50
Implement Scott's comments into Filter Theory
NoraLoose Jun 12, 2021
82023b1
Merge branch 'fixed-factor-filtering' of github.com:NoraLoose/gcm-fil…
NoraLoose Jun 12, 2021
a9a9905
Reintroduce REGULAR and REGULAR_WITH_LAND without fixed factor filtering
NoraLoose Jul 8, 2021
deb4d85
Update all tutorials according to new Laplacian naming conventions
NoraLoose Jul 8, 2021
edadbd9
Make kernel module do the area-weighting / deweighting
NoraLoose Jul 27, 2021
8b5c461
Raise ValueError rather than warning ...
NoraLoose Jul 27, 2021
842bfe2
Link to documentation page for numerical instability warning
NoraLoose Jul 27, 2021
4dbdda0
Fix small typo in docstring
NoraLoose Jul 27, 2021
06fb99a
Remove print statements that I used for debugging
NoraLoose Jul 27, 2021
9072e76
Remove line that will never run
NoraLoose Jul 28, 2021
e2ab6c9
Rename kernels and improve docstrings
NoraLoose Jul 28, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/theory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ For a more detailed treatment, see `Grooms et al. (2021) <https://doi.org/10.100
Filter Scale and Shape
----------------------

Any low-pass spatial filter should have a target length scale such that the filtered field keeps length scales larger than the target length scale, and smoothes out smaller scales. In the context of this package the target length scale is called ``filter_scale``.
Any low-pass spatial filter should have a target length scale such that the filtered field keeps the part of the signal with length scales larger than the target length scale, and smoothes out smaller scales. In the context of this package the target length scale is called ``filter_scale``.

A spatial filter can also have a *shape* that determines how sharply it separates scales above and below the target length scale.
The filter shape can be thought of in terms of the kernel of a convolution filter
Expand Down Expand Up @@ -62,7 +62,7 @@ So with ``n_steps`` = 3 you might get one Laplacian plus one biharmonic step, or
Once a filter object has been constructed, the method ``plot_shape`` can be used to plot the shape of the target filter and the approximate filter.
This can be particularly useful if the user is trying to reduce ``n_steps`` from its default value without introducing sigificant errors.
``plot_shape`` does not plot the shape of the filter *kernel*.
Instead, it plots the shape in "Fourier" space.
Instead, it plots the frequency response of the filter for each wavenumber :math:`k`.
Length scales are related to wavelengths by :math:`\ell = 2\pi/k`.
The filter leaves large scales unchanged, so ``plot_shape`` shows values close to 1 for small :math:`k`.
The filter damps out small scales, so ``plot_shape`` shows values close to 0 for large :math:`k`.
Expand Down Expand Up @@ -111,7 +111,7 @@ Anisotropic Filtering

It is possible to have different filter scales in different directions, and to have both the scales and directions vary over the domain.
This is achieved by replacing :math:`\kappa` in the previous section with a :math:`2\times2` symmetric and positive definite matrix (for a 2D domain), i.e. replacing :math:`\Delta` with :math:`\nabla\cdot(\mathbf{K}\nabla)`.
``gcm-filters`` currently only supports having the directions of anisotropy be aligned with the grid, so that the user only inputs one :math:`\kappa` for each grid direction, rather than a full :math:`2\times2` matrix.
``gcm-filters`` currently only supports diagonal :math:`\mathbf{K}`, i.e. the principal axes of the anisotropic filter are aligned with the grid, so that the user only inputs one :math:`\kappa` for each grid direction, rather than a full :math:`2\times2` matrix.
Just like in the previous section, we require that each of these two :math:`\kappa` be less than or equal to 1, and the interpretation is also the same: the local filter scale in a particular direction is :math:`\sqrt{\kappa}\times` ``filter_scale``.

Suppose, for example, that you want to filter with a scale of 60 in the grid-x direction and a scale of 30 in the grid-y direction.
Expand Down
595 changes: 297 additions & 298 deletions docs/tutorial.ipynb

Large diffs are not rendered by default.

310 changes: 154 additions & 156 deletions docs/tutorial_GPU.ipynb

Large diffs are not rendered by default.

240 changes: 122 additions & 118 deletions docs/tutorial_filter_types.ipynb

Large diffs are not rendered by default.

Loading