Skip to content

Commit a2dd607

Browse files
author
gula
committed
Merge branch 'dev_2022' of https://github.com/Mesharou/py-eddy-tracker into dev_2022
2 parents c690c55 + c455bc6 commit a2dd607

File tree

128 files changed

+3985
-1137
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+3985
-1137
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
schedule:
21+
- cron: '41 16 * * 4'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'python' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37+
# Learn more about CodeQL language support at https://git.io/codeql-language-support
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
43+
# Initializes the CodeQL tools for scanning.
44+
- name: Initialize CodeQL
45+
uses: github/codeql-action/init@v1
46+
with:
47+
languages: ${{ matrix.language }}
48+
# If you wish to specify custom queries, you can do so here or in a config file.
49+
# By default, queries listed here will override any specified in a config file.
50+
# Prefix the list here with "+" to use these queries and those in the config file.
51+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v1
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 https://git.io/JvXDl
60+
61+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62+
# and modify them (or add more) to build your code if your project
63+
# uses a compiled language
64+
65+
#- run: |
66+
# make bootstrap
67+
# make release
68+
69+
- name: Perform CodeQL Analysis
70+
uses: github/codeql-action/analyze@v1

.github/workflows/python-app.yml

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,31 @@
33

44
name: Pytest & Flake8
55

6-
on:
7-
push:
8-
branches: [ master ]
9-
pull_request:
10-
branches: [ master ]
6+
on: [push, pull_request]
117

128
jobs:
139
build:
14-
15-
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
# os: [ubuntu-latest, macos-latest, windows-latest]
13+
os: [ubuntu-latest, windows-latest]
14+
python_version: [3.7, 3.8, 3.9, '3.10']
15+
name: Run py eddy tracker build tests
16+
runs-on: ${{ matrix.os }}
17+
defaults:
18+
run:
19+
shell: bash -l {0}
1620

1721
steps:
1822
- uses: actions/checkout@v2
19-
- name: Set up Python 3.7
23+
- name: Set up Python ${{ matrix.python_version }}
2024
uses: actions/setup-python@v2
2125
with:
22-
python-version: 3.7
26+
python-version: ${{ matrix.python_version }}
2327
- name: Install dependencies
2428
run: |
2529
python -m pip install --upgrade pip
26-
pip install flake8 pytest
30+
pip install flake8 pytest pytest-cov
2731
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2832
- name: Install package
2933
run: |
@@ -34,6 +38,3 @@ jobs:
3438
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
3539
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
3640
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37-
- name: Test with pytest
38-
run: |
39-
pytest

CHANGELOG.rst

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,78 @@ The format is based on `Keep a Changelog <https://keepachangelog.com/en>`_
77
and this project adheres to `Semantic Versioning <https://semver.org/spec/v2.0.0.html>`_.
88

99
[Unreleased]
10-
------------
10+
-------------
1111
Changed
1212
^^^^^^^
13+
14+
- Remove dead end method for network will move dead end to the trash and not remove observations
15+
1316
Fixed
1417
^^^^^
18+
1519
Added
1620
^^^^^
1721

22+
23+
[3.6.1] - 2022-10-14
24+
--------------------
25+
Changed
26+
^^^^^^^
27+
28+
- Rewrite particle candidate to be easily parallelize
29+
30+
Fixed
31+
^^^^^
32+
33+
- Check strictly increasing coordinates for RegularGridDataset.
34+
- Grid mask is check to replace mask monovalue by 2D mask with fixed value
35+
36+
Added
37+
^^^^^
38+
39+
- Add method to colorize contour with a field
40+
- Add option to force align on to return all step for reference dataset
41+
- Add method and property to network to easily select segment and network
42+
- Add method to found same track/segment/network in dataset
43+
44+
[3.6.0] - 2022-01-12
45+
--------------------
46+
Changed
47+
^^^^^^^
48+
49+
- Now time allows second precision (instead of daily precision) in storage on uint32 from 01/01/1950 to 01/01/2086
50+
New identifications are produced with this type, old files could still be loaded.
51+
If you use old identifications for tracking use the `--unraw` option to unpack old times and store data with the new format.
52+
- Now amplitude is stored with .1 mm of precision (instead of 1 mm), same advice as for time.
53+
- Expose more parameters to users for bash tools build_network & divide_network
54+
- Add warning when loading a file created from a previous version of py-eddy-tracker.
55+
56+
57+
58+
Fixed
59+
^^^^^
60+
61+
- Fix bug in convolution(filter), lowest rows was replace by zeros in convolution computation.
62+
Important impact for tiny kernel
63+
- Fix method of sampling before contour fitting
64+
- Fix bug when loading dataset in zarr format, not all variables were correctly loaded
65+
- Fix bug when zarr dataset has same size for number of observations and contour size
66+
- Fix bug when tracking, previous_virtual_obs was not always loaded
67+
68+
Added
69+
^^^^^
70+
71+
- Allow to replace mask by isnan method to manage nan data instead of masked data
72+
- Add drifter colocation example
73+
74+
[3.5.0] - 2021-06-22
75+
--------------------
76+
77+
Fixed
78+
^^^^^
79+
- GridCollection get_next_time_step & get_previous_time_step needed more files to work in the dataset list.
80+
The loop needed explicitly self.dataset[i+-1] even when i==0, therefore indice went out of range
81+
1882
[3.4.0] - 2021-03-29
1983
--------------------
2084
Changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,24 @@
1010

1111
Method was described in :
1212

13+
[Pegliasco, C., Delepoulle, A., Morrow, R., Faugère, Y., and Dibarboure, G.: META3.1exp : A new Global Mesoscale Eddy Trajectories Atlas derived from altimetry, Earth Syst. Sci. Data Discuss.](https://doi.org/10.5194/essd-14-1087-2022)
14+
1315
[Mason, E., A. Pascual, and J. C. McWilliams, 2014: A new sea surface height–based code for oceanic mesoscale eddy tracking.](https://doi.org/10.1175/JTECH-D-14-00019.1)
1416

1517
### Use case ###
1618

1719
Method is used in :
18-
20+
1921
[Mason, E., A. Pascual, P. Gaube, S.Ruiz, J. Pelegrí, A. Delepoulle, 2017: Subregional characterization of mesoscale eddies across the Brazil-Malvinas Confluence](https://doi.org/10.1002/2016JC012611)
2022

2123
### How do I get set up? ###
2224

2325
#### Short story ####
26+
2427
```bash
2528
pip install pyeddytracker
2629
```
30+
2731
#### Long story ####
2832

2933
To avoid problems with installation, use of the virtualenv Python virtual environment is recommended.
@@ -34,12 +38,20 @@ Then use pip to install all dependencies (numpy, scipy, matplotlib, netCDF4, ...
3438
pip install numpy scipy netCDF4 matplotlib opencv-python pyyaml pint polygon3
3539
```
3640

37-
Then run the following to install the eddy tracker:
41+
Clone :
42+
43+
```bash
44+
git clone https://github.com/AntSimi/py-eddy-tracker
45+
```
46+
47+
Then run the following to install the eddy tracker :
3848

3949
```bash
4050
python setup.py install
4151
```
52+
4253
### Tools gallery ###
54+
4355
Several examples based on py eddy tracker module are [here](https://py-eddy-tracker.readthedocs.io/en/latest/python_module/index.html).
4456

4557
[![](https://py-eddy-tracker.readthedocs.io/en/latest/_static/logo.png)](https://py-eddy-tracker.readthedocs.io/en/latest/python_module/index.html)

check.sh

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
isort src tests examples
2-
black src tests examples
3-
blackdoc src tests examples
4-
flake8 tests examples src --count --select=E9,F63,F7,F82 --show-source --statistics
5-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
6-
flake8 tests examples src --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
7-
pytest -vv --cov py_eddy_tracker --cov-report html
1+
isort .
2+
black .
3+
blackdoc .
4+
flake8 .
5+
python -m pytest -vv --cov py_eddy_tracker --cov-report html

doc/conf.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@
9696
master_doc = "index"
9797

9898
# General information about the project.
99-
project = u"py-eddy-tracker"
100-
copyright = u"2019, A. Delepoulle & E. Mason"
101-
author = u"A. Delepoulle & E. Mason"
99+
project = "py-eddy-tracker"
100+
copyright = "2019, A. Delepoulle & E. Mason"
101+
author = "A. Delepoulle & E. Mason"
102102

103103
# The version info for the project you're documenting, acts as replacement for
104104
# |version| and |release|, also used in various other places throughout the
@@ -272,8 +272,8 @@
272272
(
273273
master_doc,
274274
"py-eddy-tracker.tex",
275-
u"py-eddy-tracker Documentation",
276-
u"A. Delepoulle \\& E. Mason",
275+
"py-eddy-tracker Documentation",
276+
"A. Delepoulle \\& E. Mason",
277277
"manual",
278278
),
279279
]
@@ -304,7 +304,7 @@
304304
# One entry per manual page. List of tuples
305305
# (source start file, name, description, authors, manual section).
306306
man_pages = [
307-
(master_doc, "py-eddy-tracker", u"py-eddy-tracker Documentation", [author], 1)
307+
(master_doc, "py-eddy-tracker", "py-eddy-tracker Documentation", [author], 1)
308308
]
309309

310310
# If true, show URL addresses after external links.
@@ -320,7 +320,7 @@
320320
(
321321
master_doc,
322322
"py-eddy-tracker",
323-
u"py-eddy-tracker Documentation",
323+
"py-eddy-tracker Documentation",
324324
author,
325325
"py-eddy-tracker",
326326
"One line description of project.",

doc/environment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ channels:
22
- conda-forge
33
- defaults
44
dependencies:
5-
- python=3.7
5+
- python=3.10
66
- ffmpeg
77
- pip:
88
- sphinx-gallery

doc/grid_identification.rst

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,38 +47,42 @@ Activate verbose
4747
.. code-block:: python
4848
4949
from py_eddy_tracker import start_logger
50-
start_logger().setLevel('DEBUG') # Available options: ERROR, WARNING, INFO, DEBUG
50+
51+
start_logger().setLevel("DEBUG") # Available options: ERROR, WARNING, INFO, DEBUG
5152
5253
Run identification
5354

5455
.. code-block:: python
5556
5657
from datetime import datetime
58+
5759
h = RegularGridDataset(grid_name, lon_name, lat_name)
58-
h.bessel_high_filter('adt', 500, order=3)
60+
h.bessel_high_filter("adt", 500, order=3)
5961
date = datetime(2019, 2, 23)
6062
a, c = h.eddy_identification(
61-
'adt', 'ugos', 'vgos', # Variables used for identification
62-
date, # Date of identification
63-
0.002, # step between two isolines of detection (m)
64-
pixel_limit=(5, 2000), # Min and max pixel count for valid contour
65-
shape_error=55, # Error max (%) between ratio of circle fit and contour
66-
)
63+
"adt",
64+
"ugos",
65+
"vgos", # Variables used for identification
66+
date, # Date of identification
67+
0.002, # step between two isolines of detection (m)
68+
pixel_limit=(5, 2000), # Min and max pixel count for valid contour
69+
shape_error=55, # Error max (%) between ratio of circle fit and contour
70+
)
6771
6872
Plot the resulting identification
6973

7074
.. code-block:: python
7175
72-
fig = plt.figure(figsize=(15,7))
73-
ax = fig.add_axes([.03,.03,.94,.94])
74-
ax.set_title('Eddies detected -- Cyclonic(red) and Anticyclonic(blue)')
75-
ax.set_ylim(-75,75)
76-
ax.set_xlim(0,360)
77-
ax.set_aspect('equal')
78-
a.display(ax, color='b', linewidth=.5)
79-
c.display(ax, color='r', linewidth=.5)
76+
fig = plt.figure(figsize=(15, 7))
77+
ax = fig.add_axes([0.03, 0.03, 0.94, 0.94])
78+
ax.set_title("Eddies detected -- Cyclonic(red) and Anticyclonic(blue)")
79+
ax.set_ylim(-75, 75)
80+
ax.set_xlim(0, 360)
81+
ax.set_aspect("equal")
82+
a.display(ax, color="b", linewidth=0.5)
83+
c.display(ax, color="r", linewidth=0.5)
8084
ax.grid()
81-
fig.savefig('share/png/eddies.png')
85+
fig.savefig("share/png/eddies.png")
8286
8387
.. image:: ../share/png/eddies.png
8488

@@ -87,7 +91,8 @@ Save identification data
8791
.. code-block:: python
8892
8993
from netCDF import Dataset
90-
with Dataset(date.strftime('share/Anticyclonic_%Y%m%d.nc'), 'w') as h:
94+
95+
with Dataset(date.strftime("share/Anticyclonic_%Y%m%d.nc"), "w") as h:
9196
a.to_netcdf(h)
92-
with Dataset(date.strftime('share/Cyclonic_%Y%m%d.nc'), 'w') as h:
97+
with Dataset(date.strftime("share/Cyclonic_%Y%m%d.nc"), "w") as h:
9398
c.to_netcdf(h)

0 commit comments

Comments
 (0)