hainegroup / oceanspy

A Python package to facilitate ocean model data analysis and visualization.
https://oceanspy.readthedocs.io
MIT License
101 stars 32 forks source link

update mooring array #354

Closed Mikejmnez closed 1 year ago

Mikejmnez commented 1 year ago

This PR:

  1. Solves and closes issue #346 .
  2. Refactors and updates subsample.mooring_array which now uses xoak (with help from @malmans2). Quick benchmark shows a speed up by x5. This is mostly because of removal of nested for loops that were no longer needed.
  3. Includes some testing with ECCO dataset, computing mooring arrays and volume transports.
  4. Checked Notebooks in documentation (e.g. Kogur) run successfully.
  5. Allows direct calculation of mooring_array with LLC data (with faces) without explicitly computing cutout (before, there was need to first compute cutout, then mooring. Now all this can happen inside subsample.mooring_array).
  6. Unpins netcdf4.
  7. pins matplotlib now at 3.6.0 (see #349)

With regard to 5, the following now works with either ECCO or LLC4320:

od = ospy.open_oceandataset.from_catalog('ECCO')

od_moor = od.subsample.mooring_array(
    Xmoor = [-80, 0],
    Ymoor= [35, 35],
    varList=["THETA", "UVELMASS", "VVELMASS", "dyG", "dxG", "drF", "HFacS", "HFacW"],
)

As before, mooring array follows great circle paths. Thus, in the case only the end points of a mooring array are given (like in the example above), the actual path will NOT be a straight line.

Mikejmnez commented 1 year ago

hmm I keep having some issues with importing xoak...

codecov[bot] commented 1 year ago

Codecov Report

Merging #354 (a5083ba) into main (20c1a5d) will decrease coverage by 0.04%. The diff coverage is 95.87%.

@@            Coverage Diff             @@
##             main     #354      +/-   ##
==========================================
- Coverage   94.74%   94.71%   -0.04%     
==========================================
  Files           9        9              
  Lines        3940     3932       -8     
  Branches      857      858       +1     
==========================================
- Hits         3733     3724       -9     
  Misses        131      131              
- Partials       76       77       +1     
Flag Coverage Δ
unittests 94.71% <95.87%> (-0.04%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
oceanspy/subsample.py 97.31% <93.44%> (-0.39%) :arrow_down:
oceanspy/utils.py 88.60% <100.00%> (+1.73%) :arrow_up:

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more

Mikejmnez commented 1 year ago

Added some testing. After tests pass again, I will merge this PR...