Skip to content

Commit 62f80cd

Browse files
author
adelepoulle
committed
merge
2 parents 29c6c06 + bb24805 commit 62f80cd

14 files changed

+161
-55
lines changed

README.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,24 @@
22

33
### How do I get set up? ###
44

5-
To avoid problem with installation, maybe prefer virtual environnement.
5+
To avoid problems with installation, use of the virtualenv Python virtual environment is recommended.
6+
7+
Then use pip to install all dependencies (numpy, scipy, matplotlib, netCDF4, cython, pyproj, Shapely, ...), e.g.:
68

79
* ** pip install cython numpy matplotlib scipy netCDF4 shapely pyproj**
8-
* ** python setup.py install**
10+
11+
Then run the following to install the eddy tracker:
12+
13+
* ** python setup.py install**
14+
15+
Two executables are now available in your PATH: EddyIdentification and EddyTracking
16+
17+
Edit the corresponding yaml files and then run the code, e.g.:
18+
19+
* ** EddyIdentification eddy_identification.yaml**
20+
21+
for identification, followed by:
22+
23+
* ** EddyTracking tracking.yaml**
24+
25+
for tracking.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="pyEddyTracker",
8-
version='2.0.3',
8+
version='3.0.0',
99
description="Py-Eddy-Tracker libraries",
1010
classifiers=['Development Status :: Alpha',
1111
'Topic :: Eddy',

share/eddy_identification.yaml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,41 @@
1+
12
# Two diagnostics, based on SLA (e.g., Chelton et al, 2011)
23
DIAGNOSTIC_TYPE: 'SLA'
34

45
# Specify domain
56
DOMAIN:
6-
#~ THE_DOMAIN: 'Global'
77
THE_DOMAIN: 'Regional'
8-
LONMIN: -100
9-
LONMAX: -5
10-
LATMIN: 10
11-
LATMAX: 45
12-
DATE_STR: 2014-12-27
13-
DATE_END: 2014-12-31
8+
LONMIN: -40
9+
LONMAX: -10
10+
LATMIN: 18
11+
LATMAX: 34
12+
DATE_STR: 2007-06-27
13+
DATE_END: 2009-12-31
1414

1515
DATASET:
1616
# Path to data
17-
#~ DATA_DIR: '/data/PVA/Externe/global/delayed-time/grids/msla/all-sat-merged/h/2014/'
18-
DATA_DIR: '/home/adelepoulle/2014/'
17+
DATA_DIR: '/marula/emason/data/altimetry/global/delayed-time/grids/msla/all-sat-merged/h/'
1918
# Model to select file
2019
FILES_MODEL: dt_global_allsat_msla_h_????????_????????.nc
2120
# Model to extract date (regular expression)
2221
DATE_REGEXP: dt_global_allsat_msla_h_([0-9]*)_[0-9]*.nc
2322
# Model to transfer date to python datetime
2423
DATE_MODEL: '%Y%m%d'
2524
# Grid Name to compute analysis
26-
VAR_NAME: Grid_0001
25+
VAR_NAME: sla
2726
# Longitude variable
28-
LON_NAME: NbLongitudes
27+
LON_NAME: lon
2928
# Latitude variable
30-
LAT_NAME: NbLatitudes
29+
LAT_NAME: lat
3130
# Step to do SUBSAMPLING (1 no subsampling)
3231
SUBSAMPLING: 1
3332

3433
PATHS:
3534
# Obtain file from:
3635
# http://www-po.coas.oregonstate.edu/research/po/research/rossby_radius/
37-
RW_PATH: 'rossrad.dat'
36+
RW_PATH: '/home/emason/Dropbox/rossrad.dat'
3837
# Path for saving of outputs
39-
SAVE_DIR: 'test/'
38+
SAVE_DIR: '/home/emason/toto/'
4039

4140
# Reference Julian day (Julian date at Jan 1, 1992)
4241
JDAY_REFERENCE: 2448623.
@@ -46,10 +45,11 @@ CONTOUR_PARAMETER:
4645
# Set SLA contour spacing (cm)
4746
CONTOUR_PARAMETER_SLA:
4847
MAX_SLA: 100.
49-
INTERVAL: 0.5
48+
INTERVAL: 0.25
49+
#~ INTERVAL: 1
5050

5151
# Shape error (see Kurian et al 2011)
52-
SHAPE_ERROR: 55. # % (Mason et al 2014 use 55%)
52+
SHAPE_ERROR: 95. # % (Mason et al 2014 use 55%)
5353

5454
# Filtering
5555
SMOOTHING: Yes
@@ -60,9 +60,9 @@ SMOOTHING_SLA:
6060

6161
# Min and max permitted eddy radii [degrees] and amplitudes (cm)
6262
# 0.4 for DT10, 0.35 for DT14
63-
RADMIN: 0.35
63+
RADMIN: 0.15
6464
RADMAX: 4.461
65-
AMPMIN: 0.
65+
AMPMIN: 0.005
6666
AMPMAX: 150.
6767

6868
# MPM14 use 1; CSS11 have no limit
@@ -81,8 +81,9 @@ EVOLVE_AREA_MAX: 500 # max change in area
8181
# - speed-based contour points
8282
# - shape test values
8383
# - profiles of swirl velocity from effective contour inwards
84+
# Useful for working with ARGO data
8485
TRACK_EXTRA_VARIABLES:
85-
- shape_error
86+
- shape_error_e
8687
- shape_error_s
8788

8889
TRACK_ARRAY_VARIABLES:

share/tracking.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ DIAGNOSTIC_TYPE: 'SLA'
44

55
PATHS:
66
# Files produces with EddyIdentification
7-
FILES_PATTERN: id_track/acyc_eddy_stat_19930*.nc
7+
FILES_PATTERN: /home/emason/toto/Anticyclonic_*.nc
88
# Path and filename of Chelton et al (1998) Rossby radius data
99
# Obtain file from:
1010
# http://www-po.coas.oregonstate.edu/research/po/research/rossby_radius/
11-
RW_PATH: 'rossrad.dat'
11+
RW_PATH: '/home/emason/Dropbox/rossrad.dat'
1212
# Path for saving of outputs
13-
SAVE_DIR: 'tracks_acyc_test/'
13+
SAVE_DIR: '/home/emason/toto/'
1414

1515
# Minimum number of observations to store eddy
1616
TRACK_DURATION_MIN: 4
17-
VIRTUAL_LEGNTH_MAX: 0
17+
VIRTUAL_LENGTH_MAX: 0
1818

1919
CLASS:
2020
MODULE: py_eddy_tracker.featured_tracking.old_tracker_reference

src/py_eddy_tracker/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
# -*- coding: utf-8 -*-
2+
"""
3+
===========================================================================
4+
This file is part of py-eddy-tracker.
5+
6+
py-eddy-tracker is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
py-eddy-tracker is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.
18+
19+
Copyright (c) 2014-2017 by Antoine Delepoulle and Evan Mason
20+
21+
===========================================================================
22+
23+
__init__.py
24+
25+
Version 3.0.0
26+
27+
===========================================================================
28+
29+
"""
230
from argparse import ArgumentParser
331
import logging
432

src/py_eddy_tracker/grid/__init__.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,32 @@
11
# -*- coding: utf-8 -*-
2+
"""
3+
===========================================================================
4+
This file is part of py-eddy-tracker.
5+
6+
py-eddy-tracker is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
py-eddy-tracker is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.
18+
19+
Copyright (c) 2014-2017 by Antoine Delepoulle and Evan Mason
20+
21+
===========================================================================
22+
23+
__init__.py
24+
25+
Version 3.0.0
26+
27+
===========================================================================
28+
"""
29+
230
from netCDF4 import Dataset
331
from scipy import interpolate
432
from scipy import spatial

src/py_eddy_tracker/grid/aviso.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,31 @@
11
# -*- coding: utf-8 -*-
2+
"""
3+
===========================================================================
4+
This file is part of py-eddy-tracker.
5+
6+
py-eddy-tracker is free software: you can redistribute it and/or modify
7+
it under the terms of the GNU General Public License as published by
8+
the Free Software Foundation, either version 3 of the License, or
9+
(at your option) any later version.
10+
11+
py-eddy-tracker is distributed in the hope that it will be useful,
12+
but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
GNU General Public License for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.
18+
19+
Copyright (c) 2014-2017 by Evan Mason and Antoine Delepoulle
20+
21+
===========================================================================
22+
23+
aviso.py
24+
25+
Version 3.0.0
26+
27+
===========================================================================
28+
"""
229
from matplotlib.dates import date2num
330
from scipy import ndimage
431
from scipy import spatial

src/py_eddy_tracker/observations.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
You should have received a copy of the GNU General Public License
1717
along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.
1818
19-
Copyright (c) 2014-2015 by Evan Mason
19+
Copyright (c) 2014-2017 by Evan Mason and Antoine Delepoulle
2020
2121
===========================================================================
2222
23+
observations.py
2324
24-
py_eddy_tracker_amplitude.py
25-
26-
Version 2.0.3
25+
Version 3.0.0
2726
2827
===========================================================================
2928
@@ -509,7 +508,7 @@ def solve_conflict(cost):
509508

510509
@staticmethod
511510
def solve_simultaneous(cost):
512-
mask = -cost.mask
511+
mask = ~cost.mask
513512
# Count number of link by self obs and other obs
514513
self_links = mask.sum(axis=1)
515514
other_links = mask.sum(axis=0)
@@ -533,7 +532,7 @@ def solve_simultaneous(cost):
533532
# Cost to resolve conflict
534533
cost_reduce = cost[i_self_keep][:, i_other_keep]
535534
shape = cost_reduce.shape
536-
nb_conflict = (-cost_reduce.mask).sum()
535+
nb_conflict = (~cost_reduce.mask).sum()
537536
logging.debug('Shape conflict matrix : %s, %d conflicts', shape, nb_conflict)
538537

539538
if nb_conflict >= (shape[0] + shape[1]):
@@ -637,7 +636,7 @@ def tracking(self, other):
637636
dist[mask_accept_dist])
638637

639638
cost_mat = ma.empty(mask_accept_dist.shape, dtype='f4')
640-
cost_mat.mask = -mask_accept_dist
639+
cost_mat.mask = ~mask_accept_dist
641640
cost_mat[mask_accept_dist] = cost_values
642641

643642
i_self, i_other = self.solve_function(cost_mat)
@@ -727,8 +726,8 @@ def filled_by_interpolation(self, mask):
727726
var = field[0]
728727
if var in ['n', 'virtual', 'track'] or var in self.array_variables:
729728
continue
730-
self.obs[var][mask] = interp(index[mask], index[-mask],
731-
self.obs[var][-mask])
729+
self.obs[var][mask] = interp(index[mask], index[~mask],
730+
self.obs[var][~mask])
732731

733732
def extract_longer_eddies(self, nb_min, nb_obs, compress_id=True):
734733
"""Select eddies which are longer than nb_min

src/py_eddy_tracker/property_functions.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
You should have received a copy of the GNU General Public License
1818
along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.
1919
20-
Copyright (c) 2014-2015 by Evan Mason
20+
Copyright (c) 2014-2017 by Evan Mason and Antoine Delepoulle
2121
2222
===========================================================================
2323
24-
py_eddy_tracker_classes.py
24+
property_functions.py
2525
26-
Version 2.0.3
26+
Version 3.0.0
2727
===========================================================================
2828
2929
@@ -203,7 +203,7 @@ def get_uavg(eddy, contours, centlon_e, centlat_e, poly_eff, grd,
203203
continue
204204
any_inner_contours = True
205205

206-
seglon, seglat = (poly_i.vertices[:, 0], poly_i.vertices[:, 1])
206+
seglon, seglat = (poly_i.vertices[:, 0].copy(), poly_i.vertices[:, 1].copy())
207207
seglon, seglat = uniform_resample(seglon, seglat, method='interp1d')
208208

209209
# Interpolate uspd to seglon, seglat, then get mean

src/py_eddy_tracker/property_objects.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,13 @@
1616
You should have received a copy of the GNU General Public License
1717
along with py-eddy-tracker. If not, see <http://www.gnu.org/licenses/>.
1818
19-
Copyright (c) 2014-2015 by Evan Mason
19+
Copyright (c) 2014-2017 by Evan Mason and Antoine Delepoulle
2020
2121
===========================================================================
2222
23+
property_objects.py
2324
24-
py_eddy_tracker_amplitude.py
25-
26-
Version 2.0.3
25+
Version 3.0.0
2726
2827
===========================================================================
2928
@@ -88,7 +87,7 @@ def __init__(self, contlon, contlat, eddy, grd):
8887
self.amplitude = 0 # atleast_1d(0.)
8988
self.local_extrema = None # int(0)
9089
self.local_extrema_inds = None
91-
self.sla = ma.array(self.sla, mask=-self.mask)
90+
self.sla = ma.array(self.sla, mask=~self.mask)
9291

9392
@property
9493
def islice(self):

0 commit comments

Comments
 (0)