Skip to content

Commit

Permalink
Update documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 7, 2024
1 parent ed614ba commit 5bbc649
Show file tree
Hide file tree
Showing 22 changed files with 2,848 additions and 44 deletions.
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.
Binary file removed _images/mpasli.ais8to30km.png
Binary file not shown.
Binary file removed _images/mpaso.EC30to60E2r3.png
Binary file not shown.
38 changes: 15 additions & 23 deletions _sources/user_guide/quick_start.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
---
file_format: mystnb
kernelspec:
name: python3
---

# Quick Start for Users

## Instaling `mosaic`
Expand All @@ -16,19 +22,15 @@ For a developers installation guide, see the [section](Dev_install_guide) in the

### Global Mesh

First we need to download a valid MPAS mesh. To do so run:
```
curl https://web.lcrc.anl.gov/public/e3sm/inputdata/ocn/mpas-o/EC30to60E2r3/mpaso.EC30to60E2r3.230313.nc -o mpaso.EC30to60E2r3.230313.nc
```

Then we can use `mosaic` to plot on the native mesh using `matplotlib`. For example:
```python
```{code-cell} ipython3
import cartopy.crs as ccrs
import mosaic
import matplotlib.pyplot as plt
import xarray as xr
ds = xr.open_dataset("mpaso.EC30to60E2r3.230313.nc")
# download and read the mesh from lcrc
ds = mosaic.datasets.open_dataset("QU.240km")
# define a map projection for our figure
projection = ccrs.InterruptedGoodeHomolosine()
Expand All @@ -46,38 +48,29 @@ descriptor = mosaic.Descriptor(ds, projection, transform)
# using the `Descriptor` object we just created, make a pseudocolor plot of
# the "indexToCellID" variable, which is defined at cell centers.
collection = mosaic.polypcolor(ax, descriptor, ds.indexToCellID, antialiaseds=False)
collection = mosaic.polypcolor(ax, descriptor, ds.indexToCellID, antialiaseds=True)
ax.gridlines()
ax.coastlines()
fig.colorbar(collection, fraction=0.1, shrink=0.5, label="Cell Index")

plt.show()
fig.colorbar(collection, fraction=0.1, shrink=0.5, label="Cell Index");
```

![mpaso.EC30to60E2r3](images/mpaso.EC30to60E2r3.png)

### Planar Non-Periodic

First we need to download a valid MPAS mesh. To do so run:
```
curl https://web.lcrc.anl.gov/public/e3sm/inputdata/glc/mpasli/mpas.ais8to30km/ais_8to30km.20231222.nc -o mpasli.ais8to30km.nc
```

In this case the underlying coordinate arrays (i.e. `xCell/yCell`)
correspond to a South Polar Stereographic projection, which is also the map projection we
want to us. Therefore, the `projection` and the `transform` will be equivalent
for this example. When instantiating the `mosaic.Descriptor` object we have to
careful to set `use_latlon=False` to ensure the `xCell`/`yCell` coordinate
arrays are parsed (c.f. `lonCell`/`latCell`).

```python
```{code-cell} ipython3
import cartopy.crs as ccrs
import mosaic
import matplotlib.pyplot as plt
import xarray as xr
ds = xr.open_dataset("mpasli.ais8to30km.nc").squeeze()
# download and read the mesh from lcrc
ds = mosaic.datasets.open_dataset("mpasli.AIS8to30")
# define a map projection for our figure
projection = ccrs.SouthPolarStereo()
Expand All @@ -102,9 +95,8 @@ ax.set_extent([-180, 180, -90, -60], ccrs.PlateCarree())
ax.gridlines()
ax.coastlines()
fig.colorbar(collection, fraction=0.1, label="Thickness [m]")
fig.colorbar(collection, fraction=0.1, label="Thickness [m]");
```
![mpasli.ais8to30km](images/mpasli.ais8to30km.png)

In the case where we do not know what projection the coordinate arrays of the
mesh correspond to we can use the `lonCell`/`latCell` coordinates and `mosaic`
Expand Down
4 changes: 4 additions & 0 deletions _static/check-solid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions _static/clipboard.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions _static/copy-button.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
94 changes: 94 additions & 0 deletions _static/copybutton.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* Copy buttons */
button.copybtn {
position: absolute;
display: flex;
top: .3em;
right: .3em;
width: 1.7em;
height: 1.7em;
opacity: 0;
transition: opacity 0.3s, border .3s, background-color .3s;
user-select: none;
padding: 0;
border: none;
outline: none;
border-radius: 0.4em;
/* The colors that GitHub uses */
border: #1b1f2426 1px solid;
background-color: #f6f8fa;
color: #57606a;
}

button.copybtn.success {
border-color: #22863a;
color: #22863a;
}

button.copybtn svg {
stroke: currentColor;
width: 1.5em;
height: 1.5em;
padding: 0.1em;
}

div.highlight {
position: relative;
}

/* Show the copybutton */
.highlight:hover button.copybtn, button.copybtn.success {
opacity: 1;
}

.highlight button.copybtn:hover {
background-color: rgb(235, 235, 235);
}

.highlight button.copybtn:active {
background-color: rgb(187, 187, 187);
}

/**
* A minimal CSS-only tooltip copied from:
* https://codepen.io/mildrenben/pen/rVBrpK
*
* To use, write HTML like the following:
*
* <p class="o-tooltip--left" data-tooltip="Hey">Short</p>
*/
.o-tooltip--left {
position: relative;
}

.o-tooltip--left:after {
opacity: 0;
visibility: hidden;
position: absolute;
content: attr(data-tooltip);
padding: .2em;
font-size: .8em;
left: -.2em;
background: grey;
color: white;
white-space: nowrap;
z-index: 2;
border-radius: 2px;
transform: translateX(-102%) translateY(0);
transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
}

.o-tooltip--left:hover:after {
display: block;
opacity: 1;
visibility: visible;
transform: translateX(-100%) translateY(0);
transition: opacity 0.2s cubic-bezier(0.64, 0.09, 0.08, 1), transform 0.2s cubic-bezier(0.64, 0.09, 0.08, 1);
transition-delay: .5s;
}

/* By default the copy button shouldn't show up when printing a page */
@media print {
button.copybtn {
display: none;
}
}
Loading

0 comments on commit 5bbc649

Please sign in to comment.