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

First draft of JOSS Paper #76

Merged
merged 19 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Binary file added filtered_vorticity.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
130 changes: 130 additions & 0 deletions paper.bib
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
@article{grooms2021diffusion,
author = {Grooms, Ian and Loose, Nora and Abernathey, Ryan and Steinberg, Jacob and Bachman, Scott Daniel and Marques, Gustavo and Guillaumin, Arthur Paul and Yankovsky, Elizabeth},
title = {Diffusion-based smoothers for spatial filtering of gridded geophysical data},
journal = {Earth and Space Science Open Archive},
pages = {27},
year = {2021},
DOI = {10.1002/essoar.10506591.1},
url = {https://doi.org/10.1002/essoar.10506591.1},
abstract = {We describe a new way to apply a spatial filter to gridded data from models or observations, focusing on low-pass filters. The new method is analogous to smoothing via diffusion, and its implementation requires only a discrete Laplacian operator appropriate to the data. The new method can approximate arbitrary filter shapes, including Gaussian and boxcar filters, and can be extended to spatially-varying and anisotropic filters. The new diffusion-based smoother’s properties are illustrated with examples from ocean model data and ocean observational products. An open-source python package implementing this algorithm, called gcm-filters, is currently under development.}
}

@article{hoyer2017xarray,
title={xarray: ND labeled arrays and datasets in Python},
author={Hoyer, Stephan and Hamman, Joe},
journal={Journal of Open Research Software},
volume={5},
number={1},
year={2017},
publisher={Ubiquity Press},
doi={10.5334/jors.148}
}


@Manual{dask,
title = {Dask: Library for dynamic task scheduling},
author = {{Dask Development Team}},
year = {2016},
url = {https://dask.org},
}




@InProceedings{ matthew_rocklin-proc-scipy-2015,
author = { Matthew Rocklin },
title = { Dask: Parallel Computation with Blocked algorithms and Task Scheduling },
booktitle = { Proceedings of the 14th Python in Science Conference },
pages = { 130 - 136 },
year = { 2015 },
editor = { Kathryn Huff and James Bergstra }
}

@ARTICLE{2020SciPy-NMeth,
author = {Virtanen, Pauli and Gommers, Ralf and Oliphant, Travis E. and
Haberland, Matt and Reddy, Tyler and Cournapeau, David and
Burovski, Evgeni and Peterson, Pearu and Weckesser, Warren and
Bright, Jonathan and {van der Walt}, St{\'e}fan J. and
Brett, Matthew and Wilson, Joshua and Millman, K. Jarrod and
Mayorov, Nikolay and Nelson, Andrew R. J. and Jones, Eric and
Kern, Robert and Larson, Eric and Carey, C J and
Polat, {\.I}lhan and Feng, Yu and Moore, Eric W. and
{VanderPlas}, Jake and Laxalde, Denis and Perktold, Josef and
Cimrman, Robert and Henriksen, Ian and Quintero, E. A. and
Harris, Charles R. and Archibald, Anne M. and
Ribeiro, Ant{\^o}nio H. and Pedregosa, Fabian and
{van Mulbregt}, Paul and {SciPy 1.0 Contributors}},
title = {{{SciPy} 1.0: Fundamental Algorithms for Scientific
Computing in Python}},
journal = {Nature Methods},
year = {2020},
volume = {17},
pages = {261--272},
adsurl = {https://rdcu.be/b08Wh},
doi = {10.1038/s41592-019-0686-2},
}

@Article{ harris2020array,
title = {Array programming with {NumPy}},
author = {Charles R. Harris and K. Jarrod Millman and St{\'{e}}fan J.
van der Walt and Ralf Gommers and Pauli Virtanen and David
Cournapeau and Eric Wieser and Julian Taylor and Sebastian
Berg and Nathaniel J. Smith and Robert Kern and Matti Picus
and Stephan Hoyer and Marten H. van Kerkwijk and Matthew
Brett and Allan Haldane and Jaime Fern{\'{a}}ndez del
R{\'{i}}o and Mark Wiebe and Pearu Peterson and Pierre
G{\'{e}}rard-Marchant and Kevin Sheppard and Tyler Reddy and
Warren Weckesser and Hameer Abbasi and Christoph Gohlke and
Travis E. Oliphant},
year = {2020},
month = sep,
journal = {Nature},
volume = {585},
number = {7825},
pages = {357--362},
doi = {10.1038/s41586-020-2649-2},
publisher = {Springer Science and Business Media {LLC}},
url = {https://doi.org/10.1038/s41586-020-2649-2}
}

@inproceedings{cupy2017learningsys,
author = "Okuta, Ryosuke and Unno, Yuya and Nishino, Daisuke and Hido, Shohei and Loomis, Crissman",
title = "CuPy: A NumPy-Compatible Library for NVIDIA GPU Calculations",
booktitle = "Proceedings of Workshop on Machine Learning Systems (LearningSys) in The Thirty-first Annual Conference on Neural Information Processing Systems (NIPS)",
year = "2017",
url = "http://learningsys.org/nips17/assets/papers/paper_16.pdf"
}

@Article{Hunter2007,
title = {Matplotlib: A 2D graphics environment},
author = {Hunter, J. D.},
journal = {Computing in Science \& Engineering},
volume = {9},
number = {3},
pages = {90--95},
year = {2007},
doi = {10.1109/MCSE.2007.55}
}

@article{adcroft2019MOM6,
author = {Adcroft, Alistair and Anderson, Whit and Balaji, V. and Blanton, Chris and Bushuk, Mitchell and Dufour, Carolina O. and Dunne, John P. and Griffies, Stephen M. and Hallberg, Robert and Harrison, Matthew J. and Held, Isaac M. and Jansen, Malte F. and John, Jasmin G. and Krasting, John P. and Langenhorst, Amy R. and Legg, Sonya and Liang, Zhi and McHugh, Colleen and Radhakrishnan, Aparna and Reichl, Brandon G. and Rosati, Tony and Samuels, Bonita L. and Shao, Andrew and Stouffer, Ronald and Winton, Michael and Wittenberg, Andrew T. and Xiang, Baoqiang and Zadeh, Niki and Zhang, Rong},
title = {The GFDL Global Ocean and Sea Ice Model OM4.0: Model Description and Simulation Features},
journal = {Journal of Advances in Modeling Earth Systems},
volume = {11},
number = {10},
pages = {3167-3211},
keywords = {ocean circulation model, CORE, hybrid coordinates},
doi = {https://doi.org/10.1029/2019MS001726},
url = {https://agupubs.onlinelibrary.wiley.com/doi/abs/10.1029/2019MS001726},
eprint = {https://agupubs.onlinelibrary.wiley.com/doi/pdf/10.1029/2019MS001726},
abstract = {Abstract We document the configuration and emergent simulation features from the Geophysical Fluid Dynamics Laboratory (GFDL) OM4.0 ocean/sea ice model. OM4 serves as the ocean/sea ice component for the GFDL climate and Earth system models. It is also used for climate science research and is contributing to the Coupled Model Intercomparison Project version 6 Ocean Model Intercomparison Project. The ocean component of OM4 uses version 6 of the Modular Ocean Model and the sea ice component uses version 2 of the Sea Ice Simulator, which have identical horizontal grid layouts (Arakawa C-grid). We follow the Coordinated Ocean-sea ice Reference Experiments protocol to assess simulation quality across a broad suite of climate-relevant features. We present results from two versions differing by horizontal grid spacing and physical parameterizations: OM4p5 has nominal 0.5° spacing and includes mesoscale eddy parameterizations and OM4p25 has nominal 0.25° spacing with no mesoscale eddy parameterization. Modular Ocean Model version 6 makes use of a vertical Lagrangian-remap algorithm that enables general vertical coordinates. We show that use of a hybrid depth-isopycnal coordinate reduces the middepth ocean warming drift commonly found in pure z* vertical coordinate ocean models. To test the need for the mesoscale eddy parameterization used in OM4p5, we examine the results from a simulation that removes the eddy parameterization. The water mass structure and model drift are physically degraded relative to OM4p5, thus supporting the key role for a mesoscale closure at this resolution.},
year = {2019}
}

@manual{Cartopy,
author = {{Met Office}},
title = {Cartopy: a cartographic python library with a matplotlib interface},
year = {2010 - 2015},
address = {Exeter, Devon },
url = {http://scitools.org.uk/cartopy}
}
55 changes: 55 additions & 0 deletions paper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: 'GCM-Filters: A Python package for Diffusion-based Spatial Filtering of Gridded Data from General Circulation Models'
tags:
- Python
- ocean modeling
- climate modeling
- fluid dynamics
authors:
- name: TBD
affiliation: 1
affiliations:
- name: TBD
index: 1
date: 16 June 2021
bibliography: paper.bib

---

# Summary

`GCM-Filters` is a python package that allows scientists to perform spatial filtering analysis in an easy, flexible and efficient way. The package implements the filtering method that was introduced by @grooms2021diffusion. The filtering algorithm is analogous to smoothing via diffusion; hence the name *diffusion-based filters*. `GCM-Filters` is designed to work with gridded data that is produced by General Circulation Models (GCMs) of ocean, weather, and climate. Spatial filtering of GCM data is a common analysis method in the Earth Sciences, for example to study oceanic and atmospheric motions at different spatial scales or to develop subgrid-scale parameterizations for ocean models.

`GCM-Filters` provides filters that are highly configurable, with the goal to be useful for a wide range of scientific applications. The user has different options for selecting the filter scale and filter shape.
The filter scale can be defined in several ways: a fixed length scale (e.g., 100 km), a scale tied to a model grid scale (e.g., 1$^\circ$), or a scale tied to a varying dynamical scale (e.g., the Rossby radius of deformation). As an example, \autoref{fig1} shows unfiltered and filtered relative vorticity, where the filter scale is set to a model grid scale of 4$^\circ$. `GCM-Filters` also allows for anisotropic, i.e., direction-dependent, filtering.
Finally, the filter shape -- currently: either Gaussian or Taper -- determines how sharply the filter separates scales above and below the target filter scale.

![(Left) Snapshot of unfiltered surface relative vorticity $\zeta = \partial_x v - \partial_y u$ from a global 0.1$^\circ$ simulation with MOM6 [@adcroft2019MOM6]. (Right) Relative vorticity filtered to 4$^\circ$, obtained by applying `GCM-Filters` to the field $\zeta$ on the left. The plots are made with `matplotlib` [@Hunter2007] and `cartopy` [@Cartopy].\label{fig1}](filtered_vorticity.png){ width=100% }

# Statement of Need

Spatial filtering is commonly used as a scientific tool for analyzing gridded data. An example of an existing spatial filtering tool in python is `SciPy`'s [@2020SciPy-NMeth] `ndimage.gaussian_filter` function, implemented as a sequence of convolution filters. While being a valuable tool for image processing (or blurring), `SciPy`'s Gaussian filter is of limited use for GCM data; it assumes a regular and rectangular Cartesian grid, employs a simple boundary condition, and the definitions of filter scale and shape have little or no flexibility. The python package `GCM-Filters` is specificially designed to filter GCM data, and seeks to solve a number of challenges for the user:

1. GCM data comes on irregular curvilinear grids with spatially varying grid-cell geometry.
2. Continental boundaries require careful and special treatment when filtering ocean GCM output.
3. Earth Science applications benefit from configurable filters, where the definition of filter scale and shape is flexible.
4. GCM output often comes in very large out-of-memory datasets.

The `GCM-Filters` algorithm [@grooms2021diffusion] applies a discrete Laplacian to smooth a field through an iterative process that resembles diffusion. The discrete Laplacian takes into account the varying grid-cell geometry and uses a no-flux boundary condition, mimicking how diffusion is internally implemented in GCMs. The no-flux boundary conditions ensures that the filter preserves the integral: $\int_{\Omega} \bar{f}(x,y) \,dx dy = \int_{\Omega} f (x,y)\, dx dy$, where $f$ is the original field, $\bar{f}$ the filtered field, and $\Omega$ the ocean domain. Conservation of the integral is a desirable filter property for many physical quantities, for example energy or ocean salinity. More details on the filter properties can be found in @grooms2021diffusion.

The main `GCM-Filters` class that the user will interface with is the `gcm_filters.Filter` object. When creating a filter object, the user specifies how they want to smooth their data, including the desired filter shape and filter scale. At this stage, the user also picks the grid type that matches their GCM data, given a predefined list of grid types. Each grid type has an associated discrete Laplacian, and requires different *grid variables* that the user must provide (the latter are usually available to the user as part of the GCM output). Currently, `GCM-Filters` provides a number of different grid types and associated discrete Laplacians:

* Grid types with **scalar Laplacians** that can be used for filtering scalar fields, for example temperature or vorticity (see \autoref{fig1}). The currently implemented grid types are compatible with different ocean GCM grids including MOM5, MOM6 and the POP tripole grid.
* Grid types with **vector Laplacians** that can be used for filtering vector fields, for example horizontal velocity $(u,v)$. The currently implemented grid type is compatible with ocean GCM grids that use an Arakawa C-grid convention; examples include MOM6 and the MITgcm.

Users are encouraged to contribute more grid types and Laplacians via pull requests.

Another important goal of `GCM-Filters` is to enable computationally efficient filtering. The user can employ `GCM-Filters` on either CPUs or GPUs, with `NumPy` [@harris2020array] or `CuPy` [@cupy2017learningsys] input data. `GCM-Filters` leverages `Dask` [@dask] and `Xarray` [@hoyer2017xarray] to support filtering of larger-than-memory datasets and computational flexibility.

# Computational Efficiency


# Acknowledgements


# References
Binary file added paper.pdf
Binary file not shown.