Info
\n", - " This is an info box. Info boxes contain additional information about tutorial concepts.\n", - "Success
\n", - " This is a success box. Success boxes are usually placed at the end of a set of examples, and usually show a message relating to the final state of the examples.\n", - "Warning
\n", - " This is a warning box. Warning boxes are usually used to indicate a situation where making a mistake, such as a typo, can cause issues with the tutorial content.\n", - "Danger
\n", - " This is a danger box. Danger boxes are usually used to indicate a situation where making a mistake, such as a typo, can cause more serious issues such as loss of data.\n", - "Info
\n", - " To get the figure to display again with the features that we've added since the original display, just type the name of the Figure object in its own cell.\n", - "Info
\n", - " You can find a list of supported projections in Cartopy, with examples, at https://scitools.org.uk/cartopy/docs/latest/reference/crs.html\n", - "Info
\n", - " Please note, even though the calls to the `subplot` method use different projections, the calls to `set_extent` use PlateCarree. This ensures that the values we passed into `set_extent` will be transformed from degrees into the values appropriate for the projection we use for the map.\n", - "Info
\n", - " Lat/lon labeling for projections other than Mercator and PlateCarree is a recent addition to Cartopy. As you can see, work still needs to be done to improve the placement of labels.\n", - "Warning
\n", - " Be patient; when plotting a small geographical area, the high-resolution \"10m\" shapefiles are used by default. As a result, these plots take longer to create, especially if the shapefiles are not yet downloaded from Natural Earth. Similar issues can occur whenever a `GeoAxes` object is transformed from one coordinate system to another. (This will be covered in more detail in a subsequent page.)\n", - "Note:
\n", - " For high-resolution Natural Earth shapefiles such as this, while we could add Cartopy'sOCEAN
feature, it currently takes much longer to render on the plot. You can create your own version of this example, with the OCEAN
feature added, to see for yourself how much more rendering time is added. Instead, we take the strategy of first setting the facecolor of the entire subplot to match that of water bodies in Cartopy. When we then layer on the LAND
feature, pixels that are not part of the LAND
shapefile remain in the water
facecolor, which is the same color as the OCEAN
.\n",
- "Info
\n", - "The netCDF file created in the above example resides in memory, not disk, due to the diskless=True
argument. In order to create this file on disk, you must either remove this argument, or add the persist=True
argument.
Danger
\n", - "If you open an existing file with 'w'
as the second argument, any data already in the file will be overwritten. If you would like to edit the file, or add to it, open it using 'a'
as the second argument.
Info
\n", - " This plain-text representation is known as netCDF Common Data Format Language, or CDL.\n", - "Info
\n", - " You can use the `timeit` module and the `timeit` Jupyter magic for more accurate benchmarking. Documentation on these can be found here.\n", - "Info
\n", - " Matplotlib is a Python 2-D plotting library. It is used to produce publication quality figures in a variety of hard-copy formats and interactive environments across platforms.\n", - "Info
\n", - " By default,ax.plot
will create a line plot, as seen in the following example: \n",
- "Info
\n", - " If desired, you can move the location of your legend; to do this, specify theloc
keyword argument when calling ax.legend()
.\n",
- "Info
\n", - " You can also use thescatter
method, which is slower, but will give you more control, such as being able to color the points individually based upon a third variable.\n",
- "Info
\n", - " Some of NumPy's functions can be accessed as `ndarray` methods!\n", - "Info
\n", - " This only returns the values from our original array meeting the indexing conditions, nothing more! Note the size,\n", - "Warning
\n", - " Indexing arrays with arrays requires them to be the same size!\n", - "Warning
\n", - " These arrays must be the same shape!\n", - "Info
\n", - " Check out NumPy's list of mathematical functions here!\n", - "Warning
\n", - " Slice notation is exclusive of the final index.\n", - "Info
\n", - " As described above, we are retrieving the datasets for these examples from Project Pythia's custom library of example data. In order to retrieve datasets from this library, you must use the statementfrom pythia_datasets import DATASETS
. This is shown and described in the Imports section at the top of this page. The fetch()
method of the DATASETS
class will automatically download the data file specified as a string argument, in this case enso_data.csv
, and cache the file locally, assuming the argument corresponds to a valid Pythia example dataset. This is illustrated in the following example.\n",
- "Info
\n", - " Index-based slices are exclusive of the final value, similar to Python's usual indexing rules.\n", - "Info
\n", - " As opposed to index-based slices, label-based slices are inclusive of the final value.\n", - "Danger
\n", - " Attempting to useSeries
subsetting with a DataFrame
can crash your program. A proper way to subset a DataFrame
is shown below.\n",
- "Info
\n", - " When using this syntax to pull individual data values from a DataFrame, make sure to list the row first, and then the column.\n", - "Info
\n", - " There are certain limitations to these subsetting techniques. For more information on these limitations, as well as a comparison ofDataFrame
and Series
indexing methods, see the Pandas indexing documentation.\n",
- "Warning
\n", - " It is recommended to only convertSeries
to NumPy arrays when necessary; doing so removes the label information that enables much of the Pandas core functionality.\n",
- "Info
\n", - " In order to interpolate data using Xarray, the SciPy package must be imported. You can learn more about SciPy from the official documentation.\n", - "Info
\n", - " As detailed in the documentation page linked above, theslice
function uses the argument order (start, stop[, step])
, where step
is optional.\n",
- "Info
\n", - " The data file for this example,NARR_19930313_0000.nc
, is retrieved from Project Pythia's custom example data library. The DATASETS
class imported at the top of this page contains a .fetch()
method, which retrieves, downloads, and caches a Pythia example data file.\n",
- "Info
\n", - " Recall from previous tutorials that aggregations in NumPy operate over axes specified by numeric values. However, with Xarray objects, aggregation dimensions are instead specified through a list passed to thedim
keyword argument.\n",
- "Info
\n", - " The terminal is running on the local host when JupyterLab is launched locally, and remote host when invoked through Jupyter Hub.\n", - "Warning
\n", - " It is generally considered bad practice to include any output in a “.py” file meant to be imported and used within different Python scripts. Such a file should contain only function and class definitions.\n", - "Warning
\n", - " Cells can be executed in any order you want. You just have to select the cell and Shift+Enter, and select the cells in any order you want. However, if you share your notebook, there is an implicit expectation to execute the cells in the order in which they are presented in the notebook. Be careful with this! If variables are reused or redefined between cells, reordering them could have unintended consequences!\n", - "Danger
\n", - " If the cell you to refer to does not have a return value, this will raise an error.\n", - "Short
- */ - .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; - } -} diff --git a/_preview/481/_static/copybutton.js b/_preview/481/_static/copybutton.js deleted file mode 100644 index 2ea7ff3e2..000000000 --- a/_preview/481/_static/copybutton.js +++ /dev/null @@ -1,248 +0,0 @@ -// Localization support -const messages = { - 'en': { - 'copy': 'Copy', - 'copy_to_clipboard': 'Copy to clipboard', - 'copy_success': 'Copied!', - 'copy_failure': 'Failed to copy', - }, - 'es' : { - 'copy': 'Copiar', - 'copy_to_clipboard': 'Copiar al portapapeles', - 'copy_success': '¡Copiado!', - 'copy_failure': 'Error al copiar', - }, - 'de' : { - 'copy': 'Kopieren', - 'copy_to_clipboard': 'In die Zwischenablage kopieren', - 'copy_success': 'Kopiert!', - 'copy_failure': 'Fehler beim Kopieren', - }, - 'fr' : { - 'copy': 'Copier', - 'copy_to_clipboard': 'Copier dans le presse-papier', - 'copy_success': 'Copié !', - 'copy_failure': 'Échec de la copie', - }, - 'ru': { - 'copy': 'Скопировать', - 'copy_to_clipboard': 'Скопировать в буфер', - 'copy_success': 'Скопировано!', - 'copy_failure': 'Не удалось скопировать', - }, - 'zh-CN': { - 'copy': '复制', - 'copy_to_clipboard': '复制到剪贴板', - 'copy_success': '复制成功!', - 'copy_failure': '复制失败', - }, - 'it' : { - 'copy': 'Copiare', - 'copy_to_clipboard': 'Copiato negli appunti', - 'copy_success': 'Copiato!', - 'copy_failure': 'Errore durante la copia', - } -} - -let locale = 'en' -if( document.documentElement.lang !== undefined - && messages[document.documentElement.lang] !== undefined ) { - locale = document.documentElement.lang -} - -let doc_url_root = DOCUMENTATION_OPTIONS.URL_ROOT; -if (doc_url_root == '#') { - doc_url_root = ''; -} - -/** - * SVG files for our copy buttons - */ -let iconCheck = `` - -// If the user specified their own SVG use that, otherwise use the default -let iconCopy = ``; -if (!iconCopy) { - iconCopy = `` -} - -/** - * Set up copy/paste for code blocks - */ - -const runWhenDOMLoaded = cb => { - if (document.readyState != 'loading') { - cb() - } else if (document.addEventListener) { - document.addEventListener('DOMContentLoaded', cb) - } else { - document.attachEvent('onreadystatechange', function() { - if (document.readyState == 'complete') cb() - }) - } -} - -const codeCellId = index => `codecell${index}` - -// Clears selected text since ClipboardJS will select the text when copying -const clearSelection = () => { - if (window.getSelection) { - window.getSelection().removeAllRanges() - } else if (document.selection) { - document.selection.empty() - } -} - -// Changes tooltip text for a moment, then changes it back -// We want the timeout of our `success` class to be a bit shorter than the -// tooltip and icon change, so that we can hide the icon before changing back. -var timeoutIcon = 2000; -var timeoutSuccessClass = 1500; - -const temporarilyChangeTooltip = (el, oldText, newText) => { - el.setAttribute('data-tooltip', newText) - el.classList.add('success') - // Remove success a little bit sooner than we change the tooltip - // So that we can use CSS to hide the copybutton first - setTimeout(() => el.classList.remove('success'), timeoutSuccessClass) - setTimeout(() => el.setAttribute('data-tooltip', oldText), timeoutIcon) -} - -// Changes the copy button icon for two seconds, then changes it back -const temporarilyChangeIcon = (el) => { - el.innerHTML = iconCheck; - setTimeout(() => {el.innerHTML = iconCopy}, timeoutIcon) -} - -const addCopyButtonToCodeCells = () => { - // If ClipboardJS hasn't loaded, wait a bit and try again. This - // happens because we load ClipboardJS asynchronously. - if (window.ClipboardJS === undefined) { - setTimeout(addCopyButtonToCodeCells, 250) - return - } - - // Add copybuttons to all of our code cells - const COPYBUTTON_SELECTOR = 'div.highlight pre'; - const codeCells = document.querySelectorAll(COPYBUTTON_SELECTOR) - codeCells.forEach((codeCell, index) => { - const id = codeCellId(index) - codeCell.setAttribute('id', id) - - const clipboardButton = id => - `` - codeCell.insertAdjacentHTML('afterend', clipboardButton(id)) - }) - -function escapeRegExp(string) { - return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string -} - -/** - * Removes excluded text from a Node. - * - * @param {Node} target Node to filter. - * @param {string} exclude CSS selector of nodes to exclude. - * @returns {DOMString} Text from `target` with text removed. - */ -function filterText(target, exclude) { - const clone = target.cloneNode(true); // clone as to not modify the live DOM - if (exclude) { - // remove excluded nodes - clone.querySelectorAll(exclude).forEach(node => node.remove()); - } - return clone.innerText; -} - -// Callback when a copy button is clicked. Will be passed the node that was clicked -// should then grab the text and replace pieces of text that shouldn't be used in output -function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") { - var regexp; - var match; - - // Do we check for line continuation characters and "HERE-documents"? - var useLineCont = !!lineContinuationChar - var useHereDoc = !!hereDocDelim - - // create regexp to capture prompt and remaining line - if (isRegexp) { - regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)') - } else { - regexp = new RegExp('^(' + escapeRegExp(copybuttonPromptText) + ')(.*)') - } - - const outputLines = []; - var promptFound = false; - var gotLineCont = false; - var gotHereDoc = false; - const lineGotPrompt = []; - for (const line of textContent.split('\n')) { - match = line.match(regexp) - if (match || gotLineCont || gotHereDoc) { - promptFound = regexp.test(line) - lineGotPrompt.push(promptFound) - if (removePrompts && promptFound) { - outputLines.push(match[2]) - } else { - outputLines.push(line) - } - gotLineCont = line.endsWith(lineContinuationChar) & useLineCont - if (line.includes(hereDocDelim) & useHereDoc) - gotHereDoc = !gotHereDoc - } else if (!onlyCopyPromptLines) { - outputLines.push(line) - } else if (copyEmptyLines && line.trim() === '') { - outputLines.push(line) - } - } - - // If no lines with the prompt were found then just use original lines - if (lineGotPrompt.some(v => v === true)) { - textContent = outputLines.join('\n'); - } - - // Remove a trailing newline to avoid auto-running when pasting - if (textContent.endsWith("\n")) { - textContent = textContent.slice(0, -1) - } - return textContent -} - - -var copyTargetText = (trigger) => { - var target = document.querySelector(trigger.attributes['data-clipboard-target'].value); - - // get filtered text - let exclude = '.linenos'; - - let text = filterText(target, exclude); - return formatCopyText(text, '', false, true, true, true, '', '') -} - - // Initialize with a callback so we can modify the text before copy - const clipboard = new ClipboardJS('.copybtn', {text: copyTargetText}) - - // Update UI with error/success messages - clipboard.on('success', event => { - clearSelection() - temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_success']) - temporarilyChangeIcon(event.trigger) - }) - - clipboard.on('error', event => { - temporarilyChangeTooltip(event.trigger, messages[locale]['copy'], messages[locale]['copy_failure']) - }) -} - -runWhenDOMLoaded(addCopyButtonToCodeCells) \ No newline at end of file diff --git a/_preview/481/_static/copybutton_funcs.js b/_preview/481/_static/copybutton_funcs.js deleted file mode 100644 index dbe1aaad7..000000000 --- a/_preview/481/_static/copybutton_funcs.js +++ /dev/null @@ -1,73 +0,0 @@ -function escapeRegExp(string) { - return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // $& means the whole matched string -} - -/** - * Removes excluded text from a Node. - * - * @param {Node} target Node to filter. - * @param {string} exclude CSS selector of nodes to exclude. - * @returns {DOMString} Text from `target` with text removed. - */ -export function filterText(target, exclude) { - const clone = target.cloneNode(true); // clone as to not modify the live DOM - if (exclude) { - // remove excluded nodes - clone.querySelectorAll(exclude).forEach(node => node.remove()); - } - return clone.innerText; -} - -// Callback when a copy button is clicked. Will be passed the node that was clicked -// should then grab the text and replace pieces of text that shouldn't be used in output -export function formatCopyText(textContent, copybuttonPromptText, isRegexp = false, onlyCopyPromptLines = true, removePrompts = true, copyEmptyLines = true, lineContinuationChar = "", hereDocDelim = "") { - var regexp; - var match; - - // Do we check for line continuation characters and "HERE-documents"? - var useLineCont = !!lineContinuationChar - var useHereDoc = !!hereDocDelim - - // create regexp to capture prompt and remaining line - if (isRegexp) { - regexp = new RegExp('^(' + copybuttonPromptText + ')(.*)') - } else { - regexp = new RegExp('^(' + escapeRegExp(copybuttonPromptText) + ')(.*)') - } - - const outputLines = []; - var promptFound = false; - var gotLineCont = false; - var gotHereDoc = false; - const lineGotPrompt = []; - for (const line of textContent.split('\n')) { - match = line.match(regexp) - if (match || gotLineCont || gotHereDoc) { - promptFound = regexp.test(line) - lineGotPrompt.push(promptFound) - if (removePrompts && promptFound) { - outputLines.push(match[2]) - } else { - outputLines.push(line) - } - gotLineCont = line.endsWith(lineContinuationChar) & useLineCont - if (line.includes(hereDocDelim) & useHereDoc) - gotHereDoc = !gotHereDoc - } else if (!onlyCopyPromptLines) { - outputLines.push(line) - } else if (copyEmptyLines && line.trim() === '') { - outputLines.push(line) - } - } - - // If no lines with the prompt were found then just use original lines - if (lineGotPrompt.some(v => v === true)) { - textContent = outputLines.join('\n'); - } - - // Remove a trailing newline to avoid auto-running when pasting - if (textContent.endsWith("\n")) { - textContent = textContent.slice(0, -1) - } - return textContent -} diff --git a/_preview/481/_static/custom.css b/_preview/481/_static/custom.css deleted file mode 100644 index 098336238..000000000 --- a/_preview/481/_static/custom.css +++ /dev/null @@ -1,37 +0,0 @@ -.bd-main .bd-content .bd-article-container { - max-width: 100%; /* default is 60em */ -} -.bd-page-width { - max-width: 100%; /* default is 88rem */ -} - -kbd { - /* Based on: https://dylanatsmith.com/wrote/styling-the-kbd-element */ - - /* Key top color */ - background-color: rgb(238, 237, 237); - - /* Key legend */ - color: rgba(var(--pst-color-paragraph), 1); - font-size: 0.75em; - font-family: monospace; - font-weight: bold; - - /* Fancy border and shadow, to make it look like a key */ - border-radius: 0.3em; - border: 1px solid grey; - box-shadow: 0 2px 0 1px grey; - padding: 2px 5px; - margin-left: 1px; - margin-right: 1px; - line-height: 1; - position: relative; - top: -2px; - - cursor: default; /* instead of text selection cursor */ -} -kbd:hover { - /* Press-down on hover */ - box-shadow: 0 1px 0 0.5px grey; - top: 0px; -} diff --git a/_preview/481/_static/design-tabs.js b/_preview/481/_static/design-tabs.js deleted file mode 100644 index b25bd6a4f..000000000 --- a/_preview/481/_static/design-tabs.js +++ /dev/null @@ -1,101 +0,0 @@ -// @ts-check - -// Extra JS capability for selected tabs to be synced -// The selection is stored in local storage so that it persists across page loads. - -/** - * @type {Record