From ff3f6e02a77007793a161bd1e7ff1e863e6e6e51 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 10 Oct 2022 20:37:58 +0000 Subject: [PATCH 1/7] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/psf/black: 22.8.0 → 22.10.0](https://github.com/psf/black/compare/22.8.0...22.10.0) - [github.com/asottile/pyupgrade: v2.38.0 → v3.0.0](https://github.com/asottile/pyupgrade/compare/v2.38.0...v3.0.0) - [github.com/asottile/add-trailing-comma: v2.2.3 → v2.3.0](https://github.com/asottile/add-trailing-comma/compare/v2.2.3...v2.3.0) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7c5afb6..5710153 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -35,7 +35,7 @@ repos: args: ["--profile", "black", "--filter-files"] - repo: https://github.com/psf/black - rev: 22.8.0 + rev: 22.10.0 hooks: - id: black language_version: python3 @@ -49,13 +49,13 @@ repos: - --ignore-words-list=pres,nd,te,afe,ue,wil,tey,te,ot,fo - repo: https://github.com/asottile/pyupgrade - rev: v2.38.0 + rev: v3.0.0 hooks: - id: pyupgrade args: - --py36-plus - repo: https://github.com/asottile/add-trailing-comma - rev: v2.2.3 + rev: v2.3.0 hooks: - id: add-trailing-comma From 1deb7b055a3514cc4e266218dab307b0578200d4 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 17 Oct 2022 20:12:55 +0000 Subject: [PATCH 2/7] [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/codespell-project/codespell: v2.2.1 → v2.2.2](https://github.com/codespell-project/codespell/compare/v2.2.1...v2.2.2) - [github.com/asottile/pyupgrade: v3.0.0 → v3.1.0](https://github.com/asottile/pyupgrade/compare/v3.0.0...v3.1.0) --- .pre-commit-config.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5710153..2275d10 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,14 +42,14 @@ repos: - repo: https://github.com/codespell-project/codespell - rev: v2.2.1 + rev: v2.2.2 hooks: - id: codespell args: - --ignore-words-list=pres,nd,te,afe,ue,wil,tey,te,ot,fo - repo: https://github.com/asottile/pyupgrade - rev: v3.0.0 + rev: v3.1.0 hooks: - id: pyupgrade args: From e7abfe77cd72828aa10d7851bb4a583a36ab8b9a Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 24 Oct 2022 15:38:12 -0300 Subject: [PATCH 3/7] run doctests --- .github/workflows/tests.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index bd5b0c5..9912662 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -34,3 +34,9 @@ jobs: run: | micromamba activate TEST python -m pytest -rxs tests + + - name: Doctests + shell: bash -l {0} + run: | + micromamba activate TEST + python -m pytest -s -rxs --doctest-modules -vv ctd From bdd641cb8be7a3395a850a6113d915b251cb35b2 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 24 Oct 2022 15:38:22 -0300 Subject: [PATCH 4/7] remove executable bits --- tests/data/castaway_data.csv | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tests/data/castaway_data.csv diff --git a/tests/data/castaway_data.csv b/tests/data/castaway_data.csv old mode 100755 new mode 100644 From ad1cce7178e5195798ed3adc345752655e0a31c9 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 24 Oct 2022 15:39:39 -0300 Subject: [PATCH 5/7] fix castaway import --- ctd/__init__.py | 11 ++++++++++- ctd/read.py | 8 ++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ctd/__init__.py b/ctd/__init__.py index 489b9df..88076fc 100644 --- a/ctd/__init__.py +++ b/ctd/__init__.py @@ -15,7 +15,15 @@ smooth, split, ) -from .read import from_bl, from_btl, from_cnv, from_edf, from_fsi, rosette_summary +from .read import ( + from_bl, + from_btl, + from_castaway_csv, + from_cnv, + from_edf, + from_fsi, + rosette_summary, +) try: from ._version import __version__ @@ -28,6 +36,7 @@ "despike", "from_bl", "from_btl", + "from_castaway_csv", "from_cnv", "from_edf", "from_fsi", diff --git a/ctd/read.py b/ctd/read.py index 773cebb..c0544f5 100644 --- a/ctd/read.py +++ b/ctd/read.py @@ -522,10 +522,10 @@ def from_castaway_csv(fname): -------- >>> import ctd >>> cast = ctd.from_castaway_csv('tests/data/castaway_data.csv') - >>> downcast, upcast = cast.split() # Upcast often prefiltered - >>> fig, ax = plt.subplots() - >>> ax = downcast['temperature'].plot_cast() - >>> fig.show() + >>> cast.columns + Index(['depth', 'temperature', 'conductivity', 'specific_conductance', + 'salinity', 'sound_velocity', 'density'], + dtype='object') """ with open(fname) as file: From 6c0b896e8a8a4983cb8cb1efc6bbd010c1d151c8 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 24 Oct 2022 16:05:30 -0300 Subject: [PATCH 6/7] fix deprecations --- ctd/plotting.py | 2 +- ctd/read.py | 2 +- notebooks/quick_intro.ipynb | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ctd/plotting.py b/ctd/plotting.py index 0aada6c..a8ec726 100644 --- a/ctd/plotting.py +++ b/ctd/plotting.py @@ -40,7 +40,7 @@ def plot_cast(df, secondary_y=False, label=None, ax=None, *args, **kwargs): if isinstance(df, pd.DataFrame): labels = label if label else df.columns - for k, (col, series) in enumerate(df.iteritems()): + for k, (col, series) in enumerate(df.items()): ax.plot(series, series.index, label=labels[k]) elif isinstance(df, pd.Series): label = label if label else str(df.name) diff --git a/ctd/read.py b/ctd/read.py index c0544f5..9135cff 100644 --- a/ctd/read.py +++ b/ctd/read.py @@ -269,7 +269,7 @@ def from_btl(fname): df["Bottle"] = df["Bottle"].fillna(method="ffill") df["Date"] = df["Date"].fillna(method="ffill") - df["Statistic"] = df["Statistic"].str.replace(r"\(|\)", "") # (avg) to avg + df["Statistic"] = df["Statistic"].str.lstrip("(").str.rstrip(")") # (avg) to avg if "name" not in metadata: name = _basename(fname)[1] diff --git a/notebooks/quick_intro.ipynb b/notebooks/quick_intro.ipynb index 6d060b3..d28ca57 100644 --- a/notebooks/quick_intro.ipynb +++ b/notebooks/quick_intro.ipynb @@ -82,15 +82,13 @@ "metadata": {}, "outputs": [], "source": [ - "%matplotlib inline\n", - "\n", "from matplotlib import style\n", "\n", - "style.use(\"seaborn-whitegrid\")\n", "\n", + "style.use(\"seaborn-v0_8-whitegrid\")\n", "\n", "down[\"t090C\"].plot_cast()\n", - "down[\"c0S/m\"].plot_cast()" + "down[\"c0S/m\"].plot_cast();" ] }, { @@ -171,6 +169,7 @@ "source": [ "import matplotlib.pyplot as plt\n", "\n", + "\n", "fig, ax = plt.subplots()\n", "ax.plot(down.index, label=\"unfiltered\")\n", "ax.plot(down.lp_filter().index, label=\"filtered\")\n", @@ -234,6 +233,7 @@ "source": [ "import gsw\n", "\n", + "\n", "p = proc.index\n", "\n", "SP = gsw.SP_from_C(proc[\"c0S/m\"].to_numpy() * 10.0, proc[\"t090C\"].to_numpy(), p)\n", @@ -360,7 +360,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.10.4" + "version": "3.10.6" } }, "nbformat": 4, From 755c30c3b2b80a1e6745208c360a43b1ebfa1409 Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Mon, 24 Oct 2022 16:05:40 -0300 Subject: [PATCH 7/7] fix URL --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d81283a..11794b3 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ Tools to load hydrographic data as pandas DataFrame with some handy methods for data pre-processing and analysis -This module can load [SeaBird CTD (CNV)](https://www.seabird.com/software/SBEDataProcforWindows.htm), +This module can load [SeaBird CTD (CNV)](https://www.seabird.com/), [Sippican XBT (EDF)](https://www.lockheedmartin.com/en-us/products/oceanographic-instrumentation.html), and [Falmouth CTD (ASCII)](https://www.falmouth.com/) formats.