diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0179eeb..a113612 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -18,28 +18,33 @@ jobs: exclude: - python-version: "3.10" numpy-version: "1.19" + fail-fast: false steps: - uses: actions/checkout@v2 - - name: Setup Conda - uses: s-weigand/setup-conda@v1 + - name: Setup + uses: mamba-org/provision-with-micromamba@main with: - activate-conda: false - conda-channels: conda-forge + environment-file: false - name: Python ${{ matrix.python-version }} numpy ${{ matrix.numpy-version }} shell: bash -l {0} run: | - conda create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt - source activate TEST - conda install numpy=${{ matrix.numpy-version }} + micromamba create --name TEST python=${{ matrix.python-version }} --file requirements.txt --file requirements-dev.txt --channel conda-forge + micromamba activate TEST + micromamba install numpy=${{ matrix.numpy-version }} pip install -e . --no-deps --force-reinstall - conda info --all - conda list + + - name: Debug Info + shell: bash -l {0} + run: | + micromamba activate TEST + micromamba info --all + micromamba list - name: Tests shell: bash -l {0} run: | - source activate TEST + micromamba activate TEST pytest -n 2 -rxs --cov=utide tests diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8723965..d775052 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -42,6 +42,6 @@ repos: - --py36-plus - repo: https://github.com/asottile/add-trailing-comma - rev: v2.2.2 + rev: v2.2.3 hooks: - id: add-trailing-comma diff --git a/utide/constituent_selection.py b/utide/constituent_selection.py index ff02e0a..603b479 100644 --- a/utide/constituent_selection.py +++ b/utide/constituent_selection.py @@ -3,7 +3,7 @@ import numpy as np from ._ut_constants import constit_index_dict, ut_constants -from .astronomy import ut_astron +from .harmonics import linearized_freqs from .utilities import Bunch @@ -31,21 +31,12 @@ def ut_cnstitsel(tref, minres, incnstit, infer): coef.aux.reftime = tref """ - shallow = ut_constants.shallow const = ut_constants.const cnstit = Bunch() coef = Bunch() - astro, ader = ut_astron(tref) - - ii = np.isfinite(const.ishallow) - const.freq[~ii] = np.dot(const.doodson[~ii, :], ader[:, 0]) / 24 - - for k in ii.nonzero()[0]: - ik = const.ishallow[k] + np.arange(const.nshallow[k]) - ik = ik.astype(int) - 1 - const.freq[k] = np.sum(const.freq[shallow.iname[ik] - 1] * shallow.coef[ik]) + freqs = linearized_freqs(tref) # cnstit.NR cnstit["NR"] = Bunch() @@ -62,7 +53,7 @@ def ut_cnstitsel(tref, minres, incnstit, infer): RI_index_set = {constit_index_dict[n] for n in RIset} cnstit.NR.lind = [ind for ind in cnstit.NR.lind if ind not in RI_index_set] - cnstit.NR.frq = const.freq[cnstit.NR.lind] + cnstit.NR.frq = freqs[cnstit.NR.lind] cnstit.NR.name = const.name[cnstit.NR.lind] nNR = len(cnstit.NR.frq) @@ -80,7 +71,7 @@ def ut_cnstitsel(tref, minres, incnstit, infer): for k, name in enumerate(allrefs): refstruct = Bunch(name=name) refstruct.lind = constit_index_dict[name] - refstruct.frq = const.freq[refstruct.lind] + refstruct.frq = freqs[refstruct.lind] ind = [i for i, rname in enumerate(infer.reference_names) if name == rname] refstruct.nI = len(ind) refstruct.I = Bunch(Rp=[], Rm=[], name=[], lind=[], frq=[]) # noqa @@ -101,7 +92,7 @@ def ut_cnstitsel(tref, minres, incnstit, infer): refstruct.I.name.append(iname) lind = constit_index_dict[iname] refstruct.I.lind.append(lind) - refstruct.I.frq.append(const.freq[lind]) + refstruct.I.frq.append(freqs[lind]) refstruct.I.Rp = np.array(refstruct.I.Rp) refstruct.I.Rm = np.array(refstruct.I.Rm)