Skip to content

Commit a3e7c1c

Browse files
add option to view notebooks in the browser
provide option to view example notebooks in browser
1 parent 75fd6bd commit a3e7c1c

7 files changed

Lines changed: 32 additions & 24 deletions

File tree

cdippy/nchashes.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@
33

44

55
class NcHashes:
6-
"""Methods for working with the online list of historic nc file hashes."""
6+
"""
7+
A class that checks for changes to datasets since by reading the online list of historic netCDF file hashes.
8+
"""
79

810
hashes_url = "http://cdip.ucsd.edu/data_access/metadata/wavecdf_by_datemod.txt"
911
new_hashes = {}
1012

11-
def __init__(self, hash_file_location=""):
12-
self.hash_pkl = hash_file_location + "/HASH.pkl"
13+
def __init__(self):
14+
"""
15+
Args:
16+
hash_file_location (str, optional): A path to the location to store the local copy of HASH.pkl. Defaults to the current directory.
17+
"""
18+
self.load_hash_table()
1319

1420
def load_hash_table(self):
1521
lines = url_utils.read_url(self.hashes_url).strip().split("\n")
@@ -21,17 +27,14 @@ def load_hash_table(self):
2127
continue
2228
self.new_hashes[fields[0]] = fields[6]
2329

24-
def get_last_deployment(self, stn: str) -> str:
25-
"""Returns the last deployment string, e.g. 'd03'."""
26-
last_deployment = "d00"
27-
for name in self.new_hashes:
28-
if name[0:5] == stn and name[5:7] == "_d" and last_deployment < name[6:9]:
29-
last_deployment = name[6:9]
30-
return last_deployment
31-
3230
def compare_hash_tables(self) -> list:
33-
"""Return a list of nc files that have changed or are new."""
34-
old_hashes = self.get_old_hashes()
31+
"""
32+
Compare the current in-memory list of files, loaded by `load_hash_table` to the list saved in HASH.pkl and return a list of stations that are new or have changed.
33+
34+
Returns:
35+
changed ([str]): A list of nc files that have changed or are since HASH.pkl was last saved.
36+
"""
37+
old_hashes = self._get_old_hashes()
3538
changed = []
3639
if old_hashes:
3740
if len(self.new_hashes) == 0:

cdippy/ndbc.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,4 @@ def get_wmo_id(
4545
ids = cdip_utils.pkl_load(pkl_fl)
4646
if stn in ids:
4747
return ids[stn]
48-
else:
49-
return None
48+
return None

cdippy/plots/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
from . import annual_hs_boxplot, compendium, sst_climatology
2-
3-
__all__ = ["annual_hs_boxplot", "compendium", "sst_climatology"]

docs/examples/index.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ Table below describes what can be found within each interactive notebook
1111

1212
| Thumbnail | Title | Description | Notebook |
1313
|-----------|-------|-------------|----------|
14-
| ![compendium_thumb](thumbnails/cdippy-compendium.png) | **Compendium Plot** | Visualize common CDIP parameters over time | [`cdippy-compendium.ipynb`](cdippy-compendium.ipynb) |
15-
| ![sst_thumb](thumbnails/cdippy-sst.png) | **Sea Surface Temperature Plot** | Visualize CDIP SST over time | [`cdippy-sst.ipynb`](cdippy-sst.ipynb) |
16-
| ![boxplot_thumb](thumbnails/cdippy-boxplot.png) | **Wave Height Seasonal Boxplot** | Compute statistics and visualize CDIP wave heights | [`cdippy-boxplot.ipynb`](cdippy-boxplot.ipynb) |
17-
| ![xyz_thumb](thumbnails/cdippy-xyz.png) | **XYZ Displacements Plot** | Access and visualize CDIP xyz displacement data | [`cdippy-xyz.ipynb`](cdippy-xyz.ipynb) |
18-
| ![spectrum1d_thumb](thumbnails/cdippy-spectrum1d.png) | **Wave Spectrum 1D Plot** | Access and visualize CDIP 1-D wave spectra data | [`cdippy-spectrum1d.ipynb`](cdippy-spectrum1d.ipynb) |
19-
| ![spectrum2d_thumb](thumbnails/cdippy-spectrum2d.png) | **Wave Spectrum 2D Plot** | Access and visualize CDIP 2-D wave spectra data | [`cdippy-spectrum2d.ipynb`](cdippy-spectrum2d.ipynb) |
14+
| ![compendium_thumb](thumbnails/cdippy-compendium.png) | **Compendium Plot** | Visualize common CDIP parameters over time | [📖 View](cdippy-compendium.ipynb) <br> [⬇️ Download](cdippy-compendium.ipynb){:download} |
15+
| ![sst_thumb](thumbnails/cdippy-sst.png) | **Sea Surface Temperature Plot** | Visualize CDIP SST over time | [📖 View](cdippy-sst.ipynb) <br> [⬇️ Download](cdippy-sst.ipynb){:download} |
16+
| ![boxplot_thumb](thumbnails/cdippy-boxplot.png) | **Wave Height Seasonal Boxplot** | Compute statistics and visualize CDIP wave heights | [📖 View](cdippy-boxplot.ipynb) <br> [⬇️ Download](cdippy-boxplot.ipynb){:download} |
17+
| ![xyz_thumb](thumbnails/cdippy-xyz.png) | **XYZ Displacements Plot** | Access and visualize CDIP xyz displacement data | [📖 View](cdippy-xyz.ipynb) <br> [⬇️ Download](cdippy-xyz.ipynb){:download} |
18+
| ![spectrum1d_thumb](thumbnails/cdippy-spectrum1d.png) | **Wave Spectrum 1D Plot** | Access and visualize CDIP 1-D wave spectra data | [📖 View](cdippy-spectrum1d.ipynb) <br> [⬇️ Download](cdippy-spectrum1d.ipynb){:download} |
19+
| ![spectrum2d_thumb](thumbnails/cdippy-spectrum2d.png) | **Wave Spectrum 2D Plot** | Access and visualize CDIP 2-D wave spectra data | [📖 View](cdippy-spectrum2d.ipynb) <br> [⬇️ Download](cdippy-spectrum2d.ipynb){:download} |
2020

mkdocs.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
site_name: CDIPpy Docs
22

3+
# theme:
4+
# name: material
5+
6+
markdown_extensions:
7+
- attr_list
8+
39
plugins:
410
- macros
511
- search
12+
- mkdocs-jupyter
613
- mkdocstrings:
714
handlers:
815
python:

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ dev = [
3434
"coverage",
3535
"flake8",
3636
"mkdocs",
37+
"mkdocs-jupyter",
3738
"mkdocs-macros-plugin",
39+
"mkdocs-material",
3840
"mkdocstrings[python]",
3941
"mkdocs-material",
4042
"mkdocstrings[python]",

0 commit comments

Comments
 (0)