Skip to content

Commit

Permalink
Merge pull request #2 from callumrollo/patch-1
Browse files Browse the repository at this point in the history
change limits in tests for new dataset
  • Loading branch information
MOchiara authored Oct 30, 2024
2 parents 6ae86d1 + 36cc6d8 commit 26a30c8
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Binary file removed docs/source/_static/glider.jpg
Binary file not shown.
Binary file added docs/source/_static/glider.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -39,3 +39,5 @@
html_static_path = ['_static']

source_suffix = [".rst", ".md"]

html_logo = "_static/glider.png"
5 changes: 4 additions & 1 deletion docs/source/glidertest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@
.. automodule:: glidertest.tools
:members:
:undoc-members:
:show-inheritance:

.. automodule:: glidertest.fetchers
:members:
:undoc-members:
16 changes: 14 additions & 2 deletions glidertest/fetchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
8 changes: 4 additions & 4 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)
tools.plot_profIncrease(ds)

0 comments on commit 26a30c8

Please sign in to comment.