Skip to content

Commit

Permalink
Changes made to fSCA-SNOTEL
Browse files Browse the repository at this point in the history
  • Loading branch information
manasa123104 committed May 20, 2024
2 parents 255f9da + bb3679f commit 013fd3c
Show file tree
Hide file tree
Showing 248 changed files with 1,974,453 additions and 45 deletions.
4 changes: 4 additions & 0 deletions .github/actions/buildresources/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ runs:
- name: Build JupyterBook
shell: bash -l {0}
run: |
<<<<<<< HEAD
jupyter-book build book
=======
jupyter-book build book --builder html
>>>>>>> bb3679fabc9b231f0a51b8a982f59cb4d1adb432

- name: Dump Build Logs
if: always()
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ jobs:

- uses: ./.github/actions/buildresources
with:
<<<<<<< HEAD
jb-cache: false
=======
jb-cache: true
>>>>>>> bb3679fabc9b231f0a51b8a982f59cb4d1adb432
publish-to-gh: true
jb-save: true
token: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .github/workflows/qaqc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ jobs:
run: |
python .github/workflows/ensure_clean_notebooks.py
<<<<<<< HEAD
# NOTE: this isn't a comprehensive spellcheck, just common typos
- name: Spellcheck
if: always()
Expand All @@ -34,6 +35,14 @@ jobs:
check_hidden: true
skip: '.git,qaqc.yml'
ignore_words_list: slippy,hist
=======
- name: Install pyspellchecker
run: |
pip install pyspellchecker
- name: Custom Spellcheck with Ignore List
run: python .github/workflows/spellcheck.py
>>>>>>> bb3679fabc9b231f0a51b8a982f59cb4d1adb432

# borrowed from https://github.com/ProjectPythia/pythia-foundations/blob/main/.github/workflows/link-checker.yaml
- name: Disable Notebook Execution Before Linkcheck
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/spellcheck.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
from spellchecker import SpellChecker
import nbformat
import os
import sys
import string # Import the string module to get a list of punctuation characters

def remove_punctuation(text):
translator = str.maketrans('', '', string.punctuation)
return text.translate(translator)

def spell_check_notebook(filepath, ignore_words):
spell = SpellChecker()
spell.word_frequency.load_words(ignore_words)

misspelled_words = {}

with open(filepath, 'r', encoding='utf-8') as f:
nb = nbformat.read(f, as_version=4)

for cell in nb.cells:
if cell.cell_type == 'markdown':
# Preprocess the cell text to remove punctuation before splitting into words
text = remove_punctuation(cell.source)
misspelled = spell.unknown(text.split())
if misspelled:
if filepath not in misspelled_words:
misspelled_words[filepath] = set()
misspelled_words[filepath].update(misspelled)

return misspelled_words

def spell_check_directory(directory, ignore_words):
all_misspelled_words = {}
for subdir, dirs, files in os.walk(directory):
for file in files:
if file.endswith('.ipynb'):
filepath = os.path.join(subdir, file)
result = spell_check_notebook(filepath, ignore_words)
if result:
all_misspelled_words.update(result)

if all_misspelled_words:
for filepath, words in all_misspelled_words.items():
print(f"Misspelled words in {filepath}: {', '.join(words)}")
sys.exit(1) # Exit with a non-zero status code to indicate failure

if __name__ == "__main__":
ignore_list = [
"geoweaver", "workflow", "datasets", "snotel", "snowpack", "amsrderived", "highelevation",
"snowpacktelemetrynetwork", "snowcastwormhole", "500m", "amsr", "decisionmaking",
"qualitycontrolled", "pagehttpswwwearthdatanasagovsensorsamsre", "netcdf", "daac", "4km",
"satelliteii", "usthe", "strategizing", "xband", "modis", "pagehttpswwwearthdatanasagovsensorsmodis",
"nam", "amsrrelated", "adeosii", "mesoscale", "amsradeosii", "apis", "asos", "missionwater",
"metadata", "shortterm", "groundbased", "hdf", "british", "october", "level2a", "gcomw1", "csv",
"dataloggers", "columbia", "ascii", "tsv", "amsadeosii", "longterm", "onboard", "wrf", "km", "hdf5",
"nsidc", "realtime", "satellitebased", "amsre", "level1a", "websitehttpswwwclimatologylaborggridmethtml",
"124th", "cryospheric", "american", "timestamped", "geolocation", "nrcs", "satellitederived", "awdn",
"1000m", "snowmelt", "nasas", "amsr2", "dataset", "gridmet", "hightech", "youll", "cryosphere", "µm",
"250m", "highspatial", "hydroclimatic", "fsca", "workflow", "swe", "eg", "snowtel", "gportalhttpsgportaljaxajpgpr", 'scan', "gdp", "scansnowtel", "geo", "aoi", "climateengineorghttpclimateengineorg", "daily", "monitoring", "youre", "checkbox", "nasa", "toolhttpsclimatenorthwestknowledgenetmacagdpphp", "v6", "element", "thredds", "climate", "xy", "dropdown", "websitehttpwwwwccnrcsusdagovnwccinventory", "websitehttpsearthexplorerusgsgov", "havent", "wgethttpswwwclimatologylaborgwgetgridmethtml", "lpdaac", "mod09ga", "earthdata", "nasahttpsursearthdatanasagov", "shapefile", "statecounty", "gcomw", "dont", "snowtel", "opendap", "popup", "data", "wget", "categoryfuturewarning", "preprocess", "colormapped", "doesnt", "trainstartdate", "csvs", "png", "functionalities", "tuples", "warningsfilterwarningsignore", "urllib", "yearsit", "userdefined", "datetime", "dataframe", "preparecumulativehistorycsvs", "dataframes", "userspecified", "datan", "1st", "url", "netcdf4", "mai", "matplotlib", "dem", "futurewarnings", "nc", "forcetrue", "timesensitive", "trainenddate", "cumulative", "downloader",
"Daily", "scan", "climate repository", "https://www.northwestknowledgenet.metdata/data", "data", "Element", "SNOTELmonitoring", "cumulative", "Climate", "repository", "repositoryhttpswwwnorthwestknowledgenetmetdatadata", "servicehttpssuzakueorcjaxajpgcomwresearchresdisthtml", "snowtel, data", "Climate Monitoring",
"Adin"
]
14 changes: 13 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

# Jupyter Book things
.bash_history
<<<<<<< HEAD
*_build
=======
#*_build
>>>>>>> bb3679fabc9b231f0a51b8a982f59cb4d1adb432
.jupyter-server-log.txt
.config/
.jupyter/
Expand All @@ -11,7 +15,11 @@

# cookiecutter webpage things
cookiecutter.json
<<<<<<< HEAD
/book/_build/html/assets
=======
#/book/_build/html/assets
>>>>>>> bb3679fabc9b231f0a51b8a982f59cb4d1adb432

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -141,4 +149,8 @@ venv.bak/
dmypy.json

# Pyre type checker
.pyre/
<<<<<<< HEAD
.pyre/
=======
.pyre/
>>>>>>> bb3679fabc9b231f0a51b8a982f59cb4d1adb432
5 changes: 5 additions & 0 deletions .idea/.gitignore

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

1 change: 0 additions & 1 deletion binder/environment.yml

This file was deleted.

1 change: 1 addition & 0 deletions binder/environment.yml
1 change: 1 addition & 0 deletions binder/environment.yml~HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../conda/environment.yml
Binary file added book/_build/.doctrees/chapters/amsr.doctree
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/conclusion.doctree
Binary file not shown.
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/dem.doctree
Binary file not shown.
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/fsCA.doctree
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/gridmet.doctree
Binary file not shown.
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/motivation.doctree
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/overview.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/snotel.doctree
Binary file not shown.
Binary file not shown.
Binary file added book/_build/.doctrees/chapters/validation.doctree
Binary file not shown.
Binary file added book/_build/.doctrees/environment.pickle
Binary file not shown.
Binary file added book/_build/.doctrees/intro.doctree
Binary file not shown.
Binary file not shown.
Binary file added book/_build/.doctrees/reference/glossary.doctree
Binary file not shown.
1 change: 1 addition & 0 deletions book/_build/.jupyter_cache/__version__.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.0.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"cells": [],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Loading

0 comments on commit 013fd3c

Please sign in to comment.