Skip to content

Commit

Permalink
decouple mooring_array from cutout + bug + refactor + ... (hainegroup…
Browse files Browse the repository at this point in the history
…#399)

* format

* format

* format

* fix bug

* do not remove X Y from grid coords

* remove complex topology from grid

* set coords

* format

* format

* format

* format

* fix bugs in test

* fix bug in test

* fix bug

* format

* format

* unpin scipy

* format

* format

* fix test to pass serial

* format

* rename fn

* fix name

* format

* fix dim_name ref

* squeeze vals

* sort by dimension

* dataset is return here

* format

* format

* do not make automatic when `face` is dimension

* format

* format

* comment import of dask - not used

* remove time-chunking

* format

* fix typo

* re-chunk, size of entire mooring array

* test with this

* correct import

* format

* format

* fix test

* fix

* re format

* format

* change var names

* format

* format

* improve test with option

* complete test

* fix typo

* format

* remove repeated

* format

* format

* format

* format

* format

* format

* fix bug

* format

* refactor - allow NoneType

* format

* format

* remove - not needed anymore

* format

* format

* typo

* format

* typo

* rename

* complete assertion

* increase testing

* fix other typo

* format

* format

* inclde test for single point

* rename var

* format

* create `yb, xb`

* format

* format

* fix import

* remove spacing

* remove unused

* remove double redim

* fotmat

* format

* format

* isort

* format

* fix var name

* format

* format

* format

* format

* format

* fix arg so that both fns have same name args

* isort

* fix var names

* improve description of fn

* remove undef vars

* fix imports/vars

* format

* remove unused vars

* format

* format

* fix bug

* revert errs

* allow extra args

* format

* re chunk along new dimension

* fix typos

* format

* fix args

* format

* correct conditional

* format

* remove unused var

* fix typo

* add underscore

* format

* format

* no longer drop vars

* make `None` as default unit

* make array type as default

* use correct import

* improve coverage

* fix type for testing

* format

* fix typo

* format

* format

* format

* fix typos

* fix argument

* format

* format

* format

* format

* remove print statements

* format

* fix typo

* fix testing typo

* format

* format

* format

* more testing ds_edge

* fix import name

* remove print statements

* remove extra testing

* get `pair` from kwargs

* format

* format

* format

* format

* return`axis` for testing

* add `axis` as returned variables

* fix return

* format

* remove assertion with axis

* format

* format

* format

* format

* add testing

* format

* fix args

* format

* remove unused var

* fix Nx

* format

* format

* format

* when adjacent, eval only with two face list

* format

* format

* remove unused var

* remove unused var

* return more vars for testing

* format

* format

* format

* format

* format

* typos

* format

* improve testing

* format

* format

* fix typo

* fix ordering

* format

* format

* improve description of fn

* no cover this conditional

* change conditional

* allow for consistent computation of `diffX` and `diffY` with `len(mooring)`

* fix return when Niter==1

* correct arg

* format

* Pre commit (hainegroup#385)

* new updated pre-commit

* re-format

* re format

* format

* [pre-commit.ci] pre-commit autoupdate (hainegroup#381)

updates:
- [github.com/macisamuele/language-formatters-pre-commit-hooks: v2.9.0 → v2.10.0](macisamuele/language-formatters-pre-commit-hooks@v2.9.0...v2.10.0)
- [github.com/psf/black: 23.3.0 → 23.7.0](psf/black@23.3.0...23.7.0)
- [github.com/PyCQA/flake8: 6.0.0 → 6.1.0](PyCQA/flake8@6.0.0...6.1.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Iss386 (hainegroup#387)

* format

* format

* format

* Iss389 (hainegroup#391)

* pin python to `3.10`

* test with python version 3.11

* repo2docker does not support python v3.11 yet

* pin to 3.11 last test

* build failed with 3.11

* Bump actions/checkout from 3 to 4 (hainegroup#390)

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* [pre-commit.ci] pre-commit autoupdate (hainegroup#392)

updates:
- [github.com/psf/black: 23.7.0 → 23.9.1](psf/black@23.7.0...23.9.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* [pre-commit.ci] pre-commit autoupdate (hainegroup#393)

updates:
- [github.com/pre-commit/pre-commit-hooks: v4.4.0 → v4.5.0](pre-commit/pre-commit-hooks@v4.4.0...v4.5.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* [pre-commit.ci] pre-commit autoupdate (hainegroup#394)

updates:
- [github.com/macisamuele/language-formatters-pre-commit-hooks: v2.10.0 → v2.11.0](macisamuele/language-formatters-pre-commit-hooks@v2.10.0...v2.11.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* [pre-commit.ci] pre-commit autoupdate (hainegroup#395)

updates:
- [github.com/psf/black: 23.9.1 → 23.10.0](psf/black@23.9.1...23.10.0)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Fix arctic_control not opening (hainegroup#396)

* first time the charm

* cleaned up redundant part

* [pre-commit.ci] pre-commit autoupdate (hainegroup#397)

updates:
- [github.com/psf/black: 23.10.0 → 23.10.1](psf/black@23.10.0...23.10.1)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* adjust to pre-commit

* refactor

* remove unused and untested function

* fix test

* fix failing test

* format

* fix testing

* omit testing when persist

* formnat

* allow some additional fn to not be covered / unuused

* remove import

* format

* improve test

* formata

* improve coverage

* format

* raise coverage

* improve coverage

* format

* rename instead of compute grid vars

* compute uv grid points when `serial=True` (faced data)

* format

* re set coords after manupilate=true

* fix typo

* format

* format

* fix typo

* typoe

* no longer needed to compute these coords

* fix bug

* fix typo

* should not include arctic

* include shapely for ci

* format

* format

* format

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: MaceKuailv <[email protected]>
  • Loading branch information
4 people authored Nov 7, 2023
1 parent 15bbb74 commit df6c6ac
Show file tree
Hide file tree
Showing 11 changed files with 3,986 additions and 619 deletions.
3 changes: 2 additions & 1 deletion ci/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dependencies:
- xarray
- xoak
- cartopy
- scipy < 1.11
- scipy
- intake-xarray
- geopy
- xesmf > 0.6.3
Expand All @@ -29,3 +29,4 @@ dependencies:
- pooch
- pip
- xmitgcm
- shapely
12 changes: 8 additions & 4 deletions oceanspy/compute.py
Original file line number Diff line number Diff line change
Expand Up @@ -2066,8 +2066,6 @@ def mooring_volume_transport(od):
mooring = od._ds["mooring"]
XC = od._ds["XC"].squeeze(("Y", "X"))
YC = od._ds["YC"].squeeze(("Y", "X"))
Xind = od._ds["Xind"].squeeze(("Y", "X"))
Yind = od._ds["Yind"].squeeze(("Y", "X"))
XU = od._ds["XU"].squeeze(("Y"))
YU = od._ds["YU"].squeeze(("Y"))
XV = od._ds["XV"].squeeze(("X"))
Expand All @@ -2094,8 +2092,14 @@ def mooring_volume_transport(od):
V1_dir = _np.zeros((len(YC), 2))

# Steps
diffX = _np.diff(Xind)
diffY = _np.diff(Yind)
if set(["diffX", "diffY"]).issubset(od._ds.data_vars):
diffX = od._ds["diffX"]
diffY = od._ds["diffY"]
else:
Xind = od._ds["Xind"].squeeze(("Y", "X"))
Yind = od._ds["Yind"].squeeze(("Y", "X"))
diffX = _np.diff(Xind)
diffY = _np.diff(Yind)

# Closed array?
if XC[0] == XC[-1] and YC[0] == YC[-1]:
Expand Down
Loading

0 comments on commit df6c6ac

Please sign in to comment.