Skip to content

Commit f1f7062

Browse files
committed
deploy: 948593f
1 parent c76a233 commit f1f7062

File tree

68 files changed

+1252
-253
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1252
-253
lines changed

.buildinfo

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Sphinx build info version 1
22
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3-
config: 2a4aa727e71fed27696463f6b9f03a38
3+
config: b3f33e7784d937beaadef192e1500f06
44
tags: 645f666f9bcd5a90fca523b33c5a78b7

README.html

+34-4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
<script src="_static/vendor/fontawesome/6.5.1/js/all.min.js?digest=8d27b9dea8ad943066ae"></script>
4444

4545
<script src="_static/documentation_options.js?v=9eb32ce0"></script>
46-
<script src="_static/doctools.js?v=888ff710"></script>
46+
<script src="_static/doctools.js?v=9a2dae69"></script>
4747
<script src="_static/sphinx_highlight.js?v=dc90522c"></script>
4848
<script src="_static/clipboard.min.js?v=a7894cd8"></script>
4949
<script src="_static/copybutton.js?v=f281be69"></script>
@@ -71,14 +71,16 @@
7171
gtag('config', 'G-T52X8HNYE8');
7272
</script>
7373
<script>const THEBE_JS_URL = "https://unpkg.com/[email protected]/lib/index.js"; const thebe_selector = ".thebe,.cell"; const thebe_selector_input = "pre"; const thebe_selector_output = ".output, .cell_output"</script>
74+
<script>window.MathJax = {"options": {"processHtmlClass": "tex2jax_process|mathjax_process|math|output_area"}}</script>
75+
<script defer="defer" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
7476
<script>DOCUMENTATION_OPTIONS.pagename = 'README';</script>
7577
<link rel="icon" href="_static/favicon.ico"/>
7678
<link rel="index" title="Index" href="genindex.html" />
7779
<link rel="search" title="Search" href="search.html" />
7880
<link rel="next" title="Project Pythia Notebook Template" href="notebooks/notebook-template.html" />
7981
<meta name="viewport" content="width=device-width, initial-scale=1"/>
8082
<meta name="docsearch:language" content="en"/>
81-
<meta name="docbuild:last-update" content="2 April 2024"/>
83+
<meta name="docbuild:last-update" content="14 May 2024"/>
8284
</head>
8385

8486

@@ -798,7 +800,7 @@ <h3>Running on Your Own Machine<a class="headerlink" href="#running-on-your-own-
798800

799801
<div class="footer-item">
800802
<p class="last-updated">
801-
Last updated on 2 April 2024.
803+
Last updated on 14 May 2024.
802804
<br/>
803805
</p>
804806
</div>
@@ -852,7 +854,35 @@ <h3>Running on Your Own Machine<a class="headerlink" href="#running-on-your-own-
852854

853855
By MetPy Maintainers.
854856

855-
Last updated on 2 April 2024.
857+
Last updated on 14 May 2024.
858+
</p>
859+
</div>
860+
</div>
861+
</div></div>
862+
863+
<div class="footer-item"><div class="container-fluid footer-extra">
864+
<div class="container">
865+
<center>
866+
Theme by <a href="https://projectpythia.org">Project Pythia</a>. All code
867+
in Pythia Cookbooks is licensed under
868+
<a href="https://opensource.org/license/apache-2-0">Apache 2.0</a>. All
869+
other non-code content is licensed under
870+
<a href="https://creativecommons.org/licenses/by/4.0/">
871+
Creative Commons BY 4.0 (CC BY 4.0)</a
872+
>.
873+
</center>
874+
<br /><br />
875+
<div class="row">
876+
<p class="m-0">
877+
<img
878+
src="_static/footer-logo-nsf.png"
879+
style="float: left; width: 60px; height: 60px; margin-right: 1rem"
880+
/>
881+
This material is based upon work supported by the National Science
882+
Foundation under Grant Nos. 2026863 and 2026899. Any opinions, findings,
883+
and conclusions or recommendations expressed in this material are those
884+
of the author(s) and do not necessarily reflect the views of the
885+
National Science Foundation.
856886
</p>
857887
</div>
858888
</div>
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

_static/basic.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx stylesheet -- basic theme.
66
*
7-
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/

_static/doctools.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Base JavaScript utilities for all Sphinx HTML documentation.
66
*
7-
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/

_static/footer-logo-nsf.png

9.89 KB
Loading

_static/language_data.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
* This script contains the language-specific data used by searchtools.js,
66
* namely the list of stopwords, stemmer, scorer and splitter.
77
*
8-
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
8+
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
99
* :license: BSD, see LICENSE for details.
1010
*
1111
*/
1212

1313
var stopwords = ["a", "and", "are", "as", "at", "be", "but", "by", "for", "if", "in", "into", "is", "it", "near", "no", "not", "of", "on", "or", "such", "that", "the", "their", "then", "there", "these", "they", "this", "to", "was", "will", "with"];
1414

1515

16-
/* Non-minified version is copied as a separate JS file, is available */
16+
/* Non-minified version is copied as a separate JS file, if available */
1717

1818
/**
1919
* Porter Stemmer

_static/searchtools.js

+105-60
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Sphinx JavaScript utilities for the full-text search.
66
*
7-
* :copyright: Copyright 2007-2023 by the Sphinx team, see AUTHORS.
7+
* :copyright: Copyright 2007-2024 by the Sphinx team, see AUTHORS.
88
* :license: BSD, see LICENSE for details.
99
*
1010
*/
@@ -99,7 +99,7 @@ const _displayItem = (item, searchTerms, highlightTerms) => {
9999
.then((data) => {
100100
if (data)
101101
listItem.appendChild(
102-
Search.makeSearchSummary(data, searchTerms)
102+
Search.makeSearchSummary(data, searchTerms, anchor)
103103
);
104104
// highlight search terms in the summary
105105
if (SPHINX_HIGHLIGHT_ENABLED) // set in sphinx_highlight.js
@@ -116,8 +116,8 @@ const _finishSearch = (resultCount) => {
116116
);
117117
else
118118
Search.status.innerText = _(
119-
`Search finished, found ${resultCount} page(s) matching the search query.`
120-
);
119+
"Search finished, found ${resultCount} page(s) matching the search query."
120+
).replace('${resultCount}', resultCount);
121121
};
122122
const _displayNextItem = (
123123
results,
@@ -137,6 +137,22 @@ const _displayNextItem = (
137137
// search finished, update title and status message
138138
else _finishSearch(resultCount);
139139
};
140+
// Helper function used by query() to order search results.
141+
// Each input is an array of [docname, title, anchor, descr, score, filename].
142+
// Order the results by score (in opposite order of appearance, since the
143+
// `_displayNextItem` function uses pop() to retrieve items) and then alphabetically.
144+
const _orderResultsByScoreThenName = (a, b) => {
145+
const leftScore = a[4];
146+
const rightScore = b[4];
147+
if (leftScore === rightScore) {
148+
// same score: sort alphabetically
149+
const leftTitle = a[1].toLowerCase();
150+
const rightTitle = b[1].toLowerCase();
151+
if (leftTitle === rightTitle) return 0;
152+
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
153+
}
154+
return leftScore > rightScore ? 1 : -1;
155+
};
140156

141157
/**
142158
* Default splitQuery function. Can be overridden in ``sphinx.search`` with a
@@ -160,13 +176,26 @@ const Search = {
160176
_queued_query: null,
161177
_pulse_status: -1,
162178

163-
htmlToText: (htmlString) => {
179+
htmlToText: (htmlString, anchor) => {
164180
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
165-
htmlElement.querySelectorAll(".headerlink").forEach((el) => { el.remove() });
181+
for (const removalQuery of [".headerlinks", "script", "style"]) {
182+
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
183+
}
184+
if (anchor) {
185+
const anchorContent = htmlElement.querySelector(`[role="main"] ${anchor}`);
186+
if (anchorContent) return anchorContent.textContent;
187+
188+
console.warn(
189+
`Anchored content block not found. Sphinx search tries to obtain it via DOM query '[role=main] ${anchor}'. Check your theme or template.`
190+
);
191+
}
192+
193+
// if anchor not specified or not found, fall back to main content
166194
const docContent = htmlElement.querySelector('[role="main"]');
167-
if (docContent !== undefined) return docContent.textContent;
195+
if (docContent) return docContent.textContent;
196+
168197
console.warn(
169-
"Content block not found. Sphinx search tries to obtain it via '[role=main]'. Could you check your theme or template."
198+
"Content block not found. Sphinx search tries to obtain it via DOM query '[role=main]'. Check your theme or template."
170199
);
171200
return "";
172201
},
@@ -239,16 +268,7 @@ const Search = {
239268
else Search.deferQuery(query);
240269
},
241270

242-
/**
243-
* execute search (requires search index to be loaded)
244-
*/
245-
query: (query) => {
246-
const filenames = Search._index.filenames;
247-
const docNames = Search._index.docnames;
248-
const titles = Search._index.titles;
249-
const allTitles = Search._index.alltitles;
250-
const indexEntries = Search._index.indexentries;
251-
271+
_parseQuery: (query) => {
252272
// stem the search terms and add them to the correct list
253273
const stemmer = new Stemmer();
254274
const searchTerms = new Set();
@@ -284,16 +304,32 @@ const Search = {
284304
// console.info("required: ", [...searchTerms]);
285305
// console.info("excluded: ", [...excludedTerms]);
286306

287-
// array of [docname, title, anchor, descr, score, filename]
288-
let results = [];
307+
return [query, searchTerms, excludedTerms, highlightTerms, objectTerms];
308+
},
309+
310+
/**
311+
* execute search (requires search index to be loaded)
312+
*/
313+
_performSearch: (query, searchTerms, excludedTerms, highlightTerms, objectTerms) => {
314+
const filenames = Search._index.filenames;
315+
const docNames = Search._index.docnames;
316+
const titles = Search._index.titles;
317+
const allTitles = Search._index.alltitles;
318+
const indexEntries = Search._index.indexentries;
319+
320+
// Collect multiple result groups to be sorted separately and then ordered.
321+
// Each is an array of [docname, title, anchor, descr, score, filename].
322+
const normalResults = [];
323+
const nonMainIndexResults = [];
324+
289325
_removeChildren(document.getElementById("search-progress"));
290326

291-
const queryLower = query.toLowerCase();
327+
const queryLower = query.toLowerCase().trim();
292328
for (const [title, foundTitles] of Object.entries(allTitles)) {
293-
if (title.toLowerCase().includes(queryLower) && (queryLower.length >= title.length/2)) {
329+
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
294330
for (const [file, id] of foundTitles) {
295331
let score = Math.round(100 * queryLower.length / title.length)
296-
results.push([
332+
normalResults.push([
297333
docNames[file],
298334
titles[file] !== title ? `${titles[file]} > ${title}` : title,
299335
id !== null ? "#" + id : "",
@@ -308,46 +344,47 @@ const Search = {
308344
// search for explicit entries in index directives
309345
for (const [entry, foundEntries] of Object.entries(indexEntries)) {
310346
if (entry.includes(queryLower) && (queryLower.length >= entry.length/2)) {
311-
for (const [file, id] of foundEntries) {
312-
let score = Math.round(100 * queryLower.length / entry.length)
313-
results.push([
347+
for (const [file, id, isMain] of foundEntries) {
348+
const score = Math.round(100 * queryLower.length / entry.length);
349+
const result = [
314350
docNames[file],
315351
titles[file],
316352
id ? "#" + id : "",
317353
null,
318354
score,
319355
filenames[file],
320-
]);
356+
];
357+
if (isMain) {
358+
normalResults.push(result);
359+
} else {
360+
nonMainIndexResults.push(result);
361+
}
321362
}
322363
}
323364
}
324365

325366
// lookup as object
326367
objectTerms.forEach((term) =>
327-
results.push(...Search.performObjectSearch(term, objectTerms))
368+
normalResults.push(...Search.performObjectSearch(term, objectTerms))
328369
);
329370

330371
// lookup as search terms in fulltext
331-
results.push(...Search.performTermsSearch(searchTerms, excludedTerms));
372+
normalResults.push(...Search.performTermsSearch(searchTerms, excludedTerms));
332373

333374
// let the scorer override scores with a custom scoring function
334-
if (Scorer.score) results.forEach((item) => (item[4] = Scorer.score(item)));
335-
336-
// now sort the results by score (in opposite order of appearance, since the
337-
// display function below uses pop() to retrieve items) and then
338-
// alphabetically
339-
results.sort((a, b) => {
340-
const leftScore = a[4];
341-
const rightScore = b[4];
342-
if (leftScore === rightScore) {
343-
// same score: sort alphabetically
344-
const leftTitle = a[1].toLowerCase();
345-
const rightTitle = b[1].toLowerCase();
346-
if (leftTitle === rightTitle) return 0;
347-
return leftTitle > rightTitle ? -1 : 1; // inverted is intentional
348-
}
349-
return leftScore > rightScore ? 1 : -1;
350-
});
375+
if (Scorer.score) {
376+
normalResults.forEach((item) => (item[4] = Scorer.score(item)));
377+
nonMainIndexResults.forEach((item) => (item[4] = Scorer.score(item)));
378+
}
379+
380+
// Sort each group of results by score and then alphabetically by name.
381+
normalResults.sort(_orderResultsByScoreThenName);
382+
nonMainIndexResults.sort(_orderResultsByScoreThenName);
383+
384+
// Combine the result groups in (reverse) order.
385+
// Non-main index entries are typically arbitrary cross-references,
386+
// so display them after other results.
387+
let results = [...nonMainIndexResults, ...normalResults];
351388

352389
// remove duplicate search results
353390
// note the reversing of results, so that in the case of duplicates, the highest-scoring entry is kept
@@ -361,7 +398,12 @@ const Search = {
361398
return acc;
362399
}, []);
363400

364-
results = results.reverse();
401+
return results.reverse();
402+
},
403+
404+
query: (query) => {
405+
const [searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms] = Search._parseQuery(query);
406+
const results = Search._performSearch(searchQuery, searchTerms, excludedTerms, highlightTerms, objectTerms);
365407

366408
// for debugging
367409
//Search.lastresults = results.slice(); // a copy
@@ -466,14 +508,18 @@ const Search = {
466508
// add support for partial matches
467509
if (word.length > 2) {
468510
const escapedWord = _escapeRegExp(word);
469-
Object.keys(terms).forEach((term) => {
470-
if (term.match(escapedWord) && !terms[word])
471-
arr.push({ files: terms[term], score: Scorer.partialTerm });
472-
});
473-
Object.keys(titleTerms).forEach((term) => {
474-
if (term.match(escapedWord) && !titleTerms[word])
475-
arr.push({ files: titleTerms[word], score: Scorer.partialTitle });
476-
});
511+
if (!terms.hasOwnProperty(word)) {
512+
Object.keys(terms).forEach((term) => {
513+
if (term.match(escapedWord))
514+
arr.push({ files: terms[term], score: Scorer.partialTerm });
515+
});
516+
}
517+
if (!titleTerms.hasOwnProperty(word)) {
518+
Object.keys(titleTerms).forEach((term) => {
519+
if (term.match(escapedWord))
520+
arr.push({ files: titleTerms[term], score: Scorer.partialTitle });
521+
});
522+
}
477523
}
478524

479525
// no match but word was a required one
@@ -496,9 +542,8 @@ const Search = {
496542

497543
// create the mapping
498544
files.forEach((file) => {
499-
if (fileMap.has(file) && fileMap.get(file).indexOf(word) === -1)
500-
fileMap.get(file).push(word);
501-
else fileMap.set(file, [word]);
545+
if (!fileMap.has(file)) fileMap.set(file, [word]);
546+
else if (fileMap.get(file).indexOf(word) === -1) fileMap.get(file).push(word);
502547
});
503548
});
504549

@@ -549,8 +594,8 @@ const Search = {
549594
* search summary for a given text. keywords is a list
550595
* of stemmed words.
551596
*/
552-
makeSearchSummary: (htmlText, keywords) => {
553-
const text = Search.htmlToText(htmlText);
597+
makeSearchSummary: (htmlText, keywords, anchor) => {
598+
const text = Search.htmlToText(htmlText, anchor);
554599
if (text === "") return null;
555600

556601
const textLower = text.toLowerCase();

0 commit comments

Comments
 (0)