diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2c70e07..5dbaf02 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -35,7 +35,3 @@ jobs: - name: Full Tests run: | python -m pytest -rxs tests/ - - - name: run notebook - run: | - jupyter nbconvert --to notebook --execute notebooks/demo.ipynb --output=demo-output.ipynb diff --git a/README.md b/README.md index 9b66c07..134968a 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,7 @@ This is a repo to diagnose issues in glider data such as CTD thermal lag. This is a work in progress, all contributions welcome! - -### Usage +### Instal Install from PyPI with @@ -21,6 +20,10 @@ pip install -e . ``` This installs glidertest locally. -e ensures that any edits you make in the files will be picked up by scripts that import functions from glidertest. +### Documentation + +Documentation website at [https://callumrollo.github.io/glidertest/](https://callumrollo.github.io/glidertest/) + Check out the example notebook `notebooks/demo.ipynb` for example functionality As input, glidertest takes [OceanGliders format files](https://github.com/OceanGlidersCommunity/OG-format-user-manual) diff --git a/docs/source/_static/glider.jpg b/docs/source/_static/glider.jpg deleted file mode 100644 index a69e0e4..0000000 Binary files a/docs/source/_static/glider.jpg and /dev/null differ diff --git a/docs/source/_static/glider.png b/docs/source/_static/glider.png new file mode 100644 index 0000000..537498e Binary files /dev/null and b/docs/source/_static/glider.png differ diff --git a/docs/source/conf.py b/docs/source/conf.py index f771370..4107c15 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -11,7 +11,7 @@ # General information about the project. project = 'glidertest' -author = 'Callum Rollo' +author = 'Eleanor Frajka-Williams, Chiara Monforte, Callum Rollo' copyright = f"{year}, {author}" release = 'v0.0.1' @@ -39,3 +39,5 @@ html_static_path = ['_static'] source_suffix = [".rst", ".md"] + +html_logo = "_static/glider.png" diff --git a/docs/source/glidertest.rst b/docs/source/glidertest.rst index 2504071..e2742c8 100644 --- a/docs/source/glidertest.rst +++ b/docs/source/glidertest.rst @@ -4,4 +4,7 @@ .. automodule:: glidertest.tools :members: :undoc-members: - :show-inheritance: + +.. automodule:: glidertest.fetchers + :members: + :undoc-members: diff --git a/glidertest/fetchers.py b/glidertest/fetchers.py index a7c0ce7..f338e92 100644 --- a/glidertest/fetchers.py +++ b/glidertest/fetchers.py @@ -10,14 +10,26 @@ "sea076_20230906T0852_delayed.nc": "sha256:bd50b2c1019b49f8c14381de8f78aa67d66e9d9e89607bbcedff246be60e6c92", "sea055_20220104T1536_R.nc": "sha256:5687c9d7b383713ff730ad4a570689622fe6eb9807e340919d59a83a437773b9", "sea055_20220104T1536_delayed.nc": "sha256:7f72f8a0398c3d339687d7b7dcf0311036997f6855ed80cae5bbf877e09975a6", + "sea045_20230530T0832_delayed.nc": "sha256:9a97b5b212e9ad751909e175bc01fdc75fd7b7fd784cc59d8e9f29e8bdfb829f", }, ) -def load_sample_dataset(dataset_name="sea076_20230906T0852_delayed.nc"): +def load_sample_dataset(dataset_name="sea045_20230530T0832_delayed.nc"): + """Download sample datasets for use with glidertest + + Args: + dataset_name (str, optional): _description_. Defaults to "sea076_20230906T0852_delayed.nc". + + Raises: + ValueError: If the requests dataset is not known, raises a value error + + Returns: + xarray.Dataset: Requested sample dataset + """ if dataset_name in data_source_og.registry.keys(): file_path = data_source_og.fetch(dataset_name) return xr.open_dataset(file_path) else: - msg = f"Requested sample dataset {dataset_name} not known" + msg = f"Requested sample dataset {dataset_name} not known. Specify one of the following available datasets: {list(data_source_og.registry.keys())}" raise ValueError(msg) diff --git a/notebooks/demo.ipynb b/notebooks/demo.ipynb index a0cc3a1..427032a 100644 --- a/notebooks/demo.ipynb +++ b/notebooks/demo.ipynb @@ -60,7 +60,7 @@ "metadata": {}, "outputs": [], "source": [ - "ds\n" + "ds" ] }, { @@ -101,7 +101,7 @@ "outputs": [], "source": [ "# Basic diagnostics of the watermass properties\n", - "tools.plot_ts_histograms(ds)\n" + "tools.plot_ts_histograms(ds)" ] }, { @@ -228,7 +228,7 @@ "# Let's visually check a section of chlorphyll and see if we observe any NPQ\n", "fig, ax = plt.subplots(1, 1, figsize=(15, 5))\n", "\n", - "tools.plot_section_with_srss(ds, 'CHLA', ax, start_time = '2023-09-06', end_time = '2023-09-10', ylim=35)" + "tools.plot_section_with_srss(ds, 'CHLA', ax, start_time = '2023-06-04', end_time = '2023-06-06', ylim=35)" ] }, { @@ -239,9 +239,9 @@ "outputs": [], "source": [ "# Compute day and night average for chlorophylla and temeparture\n", - "dayT, nightT = tools.day_night_avg(ds, sel_var='TEMP',start_time = '2023-09-06', end_time = '2023-09-10')\n", - "dayS, nightS = tools.day_night_avg(ds, sel_var='PSAL',start_time = '2023-09-06', end_time = '2023-09-10')\n", - "dayC, nightC = tools.day_night_avg(ds, sel_var='CHLA',start_time = '2023-09-06', end_time = '2023-09-10')" + "dayT, nightT = tools.day_night_avg(ds, sel_var='TEMP',start_time = '2023-06-03', end_time = '2023-06-07')\n", + "dayS, nightS = tools.day_night_avg(ds, sel_var='PSAL',start_time = '2023-06-03', end_time = '2023-06-07')\n", + "dayC, nightC = tools.day_night_avg(ds, sel_var='CHLA',start_time = '2023-06-03', end_time = '2023-06-07')" ] }, { @@ -253,9 +253,9 @@ "source": [ "fig, ax = plt.subplots(1, 3, figsize=(15, 5))\n", "\n", - "tools.plot_daynight_avg( dayT, nightT, ax[0],sel_day='2023-09-08', xlabel='Temperature [C]')\n", - "tools.plot_daynight_avg( dayS, nightS, ax[1],sel_day='2023-09-08', xlabel='Salinity [PSU]')\n", - "tools.plot_daynight_avg( dayC, nightC, ax[2],sel_day='2023-09-08', xlabel='Chlorophyll [mg m-3]')" + "tools.plot_daynight_avg( dayT, nightT, ax[0],sel_day='2023-06-04', xlabel='Temperature [C]')\n", + "tools.plot_daynight_avg( dayS, nightS, ax[1],sel_day='2023-06-04', xlabel='Salinity [PSU]')\n", + "tools.plot_daynight_avg( dayC, nightC, ax[2],sel_day='2023-06-04', xlabel='Chlorophyll [mg m-3]')" ] }, { @@ -372,7 +372,7 @@ "\n", "* Check for any possible drift in the data that might look suspicious. The great temporal and spatial variability may not allow for such check to be succesful. Evaluation using reference CTD cast data or any other data available in the stufy area is recommended.\n", "\n", - "Oxygen SOP provides a great summary of the needed processing of salinity data and the vaious difference based on sensor modela nd platform type https://oceangliderscommunity.github.io/Salinity_SOP/sections/salinity_dmqc.html" + "Oxygen SOP provides a great summary of the needed processing of salinity data and the vaious difference based on sensor model and platform type https://oceangliderscommunity.github.io/Salinity_SOP/sections/salinity_dmqc.html" ] }, { diff --git a/tests/test_tools.py b/tests/test_tools.py index ea7c584..c3e463d 100644 --- a/tests/test_tools.py +++ b/tests/test_tools.py @@ -26,10 +26,10 @@ def test_quench_sequence(): if not "TIME" in ds.indexes.keys(): ds = ds.set_xindex('TIME') fig, ax = plt.subplots() - tools.plot_section_with_srss(ds, 'CHLA', ax,start_time = '2023-09-06', end_time = '2023-09-10', ylim=35) - dayT, nightT = tools.day_night_avg(ds, sel_var='TEMP',start_time = '2023-09-06', end_time = '2023-09-10') + tools.plot_section_with_srss(ds, 'CHLA', ax,start_time = '2023-06-04', end_time = '2023-06-06', ylim=35) + dayT, nightT = tools.day_night_avg(ds, sel_var='TEMP',start_time = '2023-06-04', end_time = '2023-06-06') fig, ax = plt.subplots() - tools.plot_daynight_avg( dayT, nightT,ax,sel_day='2023-09-08', xlabel='Temperature [C]') + tools.plot_daynight_avg( dayT, nightT,ax,sel_day='2023-06-04', xlabel='Temperature [C]') def test_temporal_drift(): ds = fetchers.load_sample_dataset() @@ -42,4 +42,4 @@ def test_temporal_drift(): def test_profile_check(): ds = fetchers.load_sample_dataset() tools.check_monotony(ds.PROFILE_NUMBER) - tools.plot_profIncrease(ds) \ No newline at end of file + tools.plot_profIncrease(ds)