-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix-lazy-indexing
- Loading branch information
Showing
39 changed files
with
333 additions
and
272 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,9 +11,10 @@ jobs: | |
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
with: | ||
token: ${{ secrets.WORKFLOW_TOKEN }} | ||
persist-credentials: false | ||
- name: Run GitHub Actions Version Updater | ||
uses: saadmk11/[email protected] | ||
with: | ||
|
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 |
---|---|---|
|
@@ -29,7 +29,7 @@ jobs: | |
name: Bumpversion Patch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
with: | ||
persist-credentials: false | ||
- uses: actions/[email protected] | ||
|
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
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 |
---|---|---|
|
@@ -37,22 +37,23 @@ jobs: | |
comment_approved: | ||
name: Comment Concerning Approved Tag | ||
if: | | ||
(github.event_name == 'pull_request_target') || | ||
(github.event_name == 'pull_request_target') && | ||
(github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Find comment | ||
uses: peter-evans/find-comment@v2 | ||
uses: peter-evans/find-comment@v2.4.0 | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.pull_request.number }} | ||
comment-author: 'github-actions[bot]' | ||
body-includes: This Pull Request is coming from a fork and must be manually tagged `approved` in order to perform additional testing | ||
- name: Create comment | ||
if: | | ||
(steps.fc.outputs.comment-id == '') || | ||
(!contains(github.event.pull_request.labels.*.name, 'approved')) | ||
uses: peter-evans/create-or-update-comment@v3 | ||
(steps.fc.outputs.comment-id == '') && | ||
(!contains(github.event.pull_request.labels.*.name, 'approved')) && | ||
(github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name) | ||
uses: peter-evans/[email protected] | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
|
@@ -63,12 +64,13 @@ jobs: | |
- name: Update comment | ||
if: | | ||
contains(github.event.pull_request.labels.*.name, 'approved') | ||
uses: peter-evans/create-or-update-comment@v3 | ||
uses: peter-evans/create-or-update-comment@v3.0.2 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
issue-number: ${{ github.event.pull_request.number }} | ||
body: | | ||
Pull Request is approved! | ||
> **Note** | ||
> This Pull Request is approved! | ||
reactions: | | ||
hooray | ||
edit-mode: append |
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 |
---|---|---|
|
@@ -22,6 +22,11 @@ on: | |
env: | ||
XCLIM_TESTDATA_BRANCH: v2023.9.12 | ||
|
||
concurrency: | ||
# For a given workflow, if we push to the same branch, cancel all previous builds on that branch except on master. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | ||
|
||
jobs: | ||
lint: | ||
name: Black (Python${{ matrix.python-version }}) | ||
|
@@ -35,11 +40,7 @@ jobs: | |
python-version: | ||
- "3.8" | ||
steps: | ||
- name: Cancel previous runs | ||
uses: styfle/[email protected] | ||
with: | ||
access_token: ${{ github.token }} | ||
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
- name: Set up Python${{ matrix.python-version }} | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -63,7 +64,7 @@ jobs: | |
- tox-env: "py39" | ||
python-version: "3.9" | ||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Set up Python${{ matrix.python-version }} | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -103,7 +104,7 @@ jobs: | |
python-version: "3.11" | ||
markers: -m 'not slow and not requires_internet' | ||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Install Eigen3 | ||
if: contains(matrix.tox-env, 'sbck') | ||
run: | | ||
|
@@ -140,9 +141,9 @@ jobs: | |
run: | ||
shell: bash -l {0} | ||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} | ||
uses: mamba-org/[email protected].3 | ||
uses: mamba-org/[email protected].4 | ||
with: | ||
cache-downloads: true | ||
cache-environment: true | ||
|
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
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Set up Python3 | ||
uses: actions/[email protected] | ||
with: | ||
|
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 |
---|---|---|
|
@@ -14,7 +14,7 @@ jobs: | |
id-token: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
- name: Set up Python3 | ||
uses: actions/[email protected] | ||
with: | ||
|
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 |
---|---|---|
|
@@ -34,11 +34,11 @@ jobs: | |
run: | ||
shell: bash -l {0} | ||
steps: | ||
- uses: actions/checkout@v3.6.0 | ||
- uses: actions/checkout@v4.1.0 | ||
with: | ||
fetch-depth: 0 # Fetch all history for all branches and tags. | ||
- name: Setup Conda (Micromamba) with Python${{ matrix.python-version }} | ||
uses: mamba-org/[email protected].3 | ||
uses: mamba-org/[email protected].4 | ||
with: | ||
cache-downloads: true | ||
cache-environment: true | ||
|
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
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,95 @@ | ||
/* Array of indicator objects */ | ||
let indicators = []; | ||
|
||
/* MiniSearch object defining search mechanism */ | ||
let miniSearch = new MiniSearch({ | ||
fields: ['title', 'abstract', 'variables', 'keywords'], // fields to index for full-text search | ||
storeFields: ['title', 'abstract', 'vars', 'realm', 'module', 'name', 'keywords'], // fields to return with search results | ||
searchOptions: { | ||
boost: {'title': 3, 'variables': 2}, | ||
fuzzy: 0.1, | ||
prefix: true, | ||
}, | ||
extractField: (doc, field) => { | ||
if (field === 'variables') { | ||
return Object.keys(doc['vars']).join(' '); | ||
} | ||
return MiniSearch.getDefault('extractField')(doc, field); | ||
} | ||
}); | ||
|
||
// Populate search object with complete list of indicators | ||
fetch('indicators.json') | ||
.then(data => data.json()) | ||
.then(data => { | ||
indicators = Object.entries(data).map(([k, v]) => { | ||
return {id: k.toLowerCase(), ...v} | ||
}); | ||
miniSearch.addAll(indicators); | ||
indFilter(); | ||
}); | ||
|
||
|
||
// Populate list of variables | ||
//function getVariables() { | ||
// fetch('variables.json') | ||
// .then((res) => { | ||
// return res.json(); | ||
// }) | ||
//} | ||
//const variables = getVariables(); | ||
|
||
|
||
function makeKeywordLabel(ind) { | ||
/* Print list of keywords only if there is at least one. */ | ||
if (ind.keywords[0].length > 0) { | ||
const keywords = ind.keywords.map(v => `<code class="keywordlabel">${v.trim()}</code>`).join(''); | ||
return `<div class="keywords">Keywords: ${keywords}</div>`; | ||
} | ||
else { | ||
return ""; | ||
} | ||
} | ||
|
||
|
||
function makeVariableList(ind) { | ||
/* Print list of variables and include mouse-hover tooltip with variable description. */ | ||
return Object.entries(ind.vars).map((kv) => { | ||
const tooltip = `<button class="indVarname" title="${kv[1]}" alt="${kv[1]}">${kv[0]}</button>`; | ||
return tooltip | ||
}).join(''); | ||
} | ||
|
||
function indTemplate(ind) { | ||
// const varlist = Object.entries(ind.vars).map((kv) => `<code class="indVarname">${kv[0]}</code>`).join(''); | ||
const varlist = makeVariableList(ind); | ||
return ` | ||
<div class="indElem" id="${ind.id}"> | ||
<div class="indHeader"> | ||
<b class="indTitle">${ind.title}</b> | ||
<a class="reference_internal indName" href="api.html#xclim.indicators.${ind.module}.${ind.name}" title="${ind.name}"> | ||
<code>${ind.module}.${ind.name}</code> | ||
</a> | ||
</div> | ||
<div class="indVars">Uses: ${varlist}</div> | ||
<div class="indDesc"><p>${ind.abstract}</p></div> | ||
${makeKeywordLabel(ind)} | ||
<div class="indID">Yaml ID: <code>${ind.id}</code></div> | ||
</div> | ||
`; | ||
} | ||
|
||
function indFilter() { | ||
const input = document.getElementById("queryInput").value; | ||
let inds = []; | ||
if (input === "") { | ||
inds = indicators; | ||
} else { | ||
inds = miniSearch.search(input); | ||
} | ||
|
||
const newTable = inds.map(indTemplate).join(''); | ||
const tableElem = document.getElementById("indTable"); | ||
tableElem.innerHTML = newTable; | ||
return newTable; | ||
} |
Oops, something went wrong.