-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #349 from xylar/further_updates_to_docs
A lot of new additions to the documentation This merge adds documentation for all of the remaining functionality in the mpas_tools conda package with the exception of the scripts copied from the landice directory. This merge also fixes some very minor bugs related to a deprecated xarray method (drop --> drop_vars) and some warnings about unneeded parentheses that were discovered in the process of improving docstrings.
- Loading branch information
Showing
27 changed files
with
2,478 additions
and
255 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. _cime_mod: | ||
|
||
CIME Constants | ||
============== | ||
|
||
The module :py:mod:`mpas_tools.cime.constants` contains constants that are in | ||
sync with `CIME <https://github.com/ESMCI/cime>`_, which provides infrastructure | ||
and utilities for Earth System Models such at E3SM. Currently, the only | ||
constant being synched with CIME is the radius of the Earth. Constants are | ||
checked against their values on CIME's master branch during tests of the | ||
conda build. See | ||
:py:func:`mpas_tools.tests.test_cime_constants.test_cime_constants`. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.. _mesh_interpolation: | ||
|
||
.. |---| unicode:: U+2014 .. em dash, trimming surrounding whitespace | ||
:trim: | ||
|
||
************* | ||
Interpolation | ||
************* | ||
|
||
Previously, various tools in this package used ``scipy`` for interpolation. | ||
However, the interpolation routines in ``scipy`` are not well suited to | ||
interpolation from regular grids to MPAS meshes---they are slow and very memory | ||
intensive, particularly for large meshes. | ||
|
||
For bilinear interpolation from a tensor lon/lat grid to an MPAS mesh, it will | ||
be faster to use the function | ||
:py:func:`mpas_tools.mesh.interpolation.interp_bilin()` | ||
Here is an example where we define cell width for an EC mesh (see | ||
:ref:`ec_mesh`), read in longitude and latitude from an MPAS mesh, and | ||
interpolate the cell widths to cell centers on the MPAS mesh. | ||
|
||
.. code-block:: python | ||
import numpy as np | ||
import netCDF4 as nc4 | ||
from mpas_tools.mesh.interpolation import interp_bilin | ||
dlon = 1. | ||
dlat = dlon | ||
earth_radius = constants['SHR_CONST_REARTH'] | ||
nlon = int(360./dlon) + 1 | ||
nlat = int(180./dlat) + 1 | ||
lon = np.linspace(-180., 180., nlon) | ||
lat = np.linspace(-90., 90., nlat) | ||
cellWidth = mdt.EC_CellWidthVsLat(lat) | ||
# broadcast cellWidth to 2D | ||
_, cellWidth = np.meshgrid(lon, cellWidthVsLat) | ||
ds = nc4.Dataset('base_mesh.nc', 'r+') | ||
lonCell = ds.variables['lonCell'][:] | ||
latCell = ds.variables['latCell'][:] | ||
lonCell = np.mod(np.rad2deg(lonCell) + 180., 360.) - 180. | ||
latCell = np.rad2deg(latCell) | ||
cellWidthOnMpas = interp_bilin(lon, lat, cellWidth, lonCell, latCell) |
Oops, something went wrong.