Skip to content

Commit 424fbfb

Browse files
committed
Use of more recent version of numpy 1.14 or >
1 parent e7fee17 commit 424fbfb

File tree

2 files changed

+5
-59
lines changed

2 files changed

+5
-59
lines changed

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@
3434
include_dirs=[numpy.get_include()])],
3535
package_data={'py_eddy_tracker.featured_tracking': ['*.nc', ]},
3636
setup_requires=[
37-
'numpy>=1.8'],
37+
'numpy>=1.14'],
3838
install_requires=[
39-
'numpy>=1.9',
39+
'numpy>=1.14',
4040
# Bug with 1.5.1 (slow memory leak)
4141
'matplotlib>=2.0.0',
4242
'scipy>=0.15.1',

src/py_eddy_tracker/observations.py

Lines changed: 3 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ def basic_formula_ellips_major_axis(lats, cmin=1.5, cmax=10., c0=1.5, lat1=13.5,
516516
m = abs_lats > lat1
517517
m += abs_lats < lat2
518518

519-
major_axis[-m] = a * abs_lats[-m] + b
519+
major_axis[~m] = a * abs_lats[~m] + b
520520
if not degrees:
521521
major_axis *= 111.2
522522
return major_axis
@@ -583,7 +583,7 @@ def solve_simultaneous(cost):
583583

584584
@staticmethod
585585
def solve_first(cost, multiple_link=False):
586-
mask = -cost.mask
586+
mask = ~cost.mask
587587
# Count number of link by self obs and other obs
588588
self_links = mask.sum(axis=1)
589589
other_links = mask.sum(axis=0)
@@ -607,7 +607,7 @@ def solve_first(cost, multiple_link=False):
607607
# Cost to resolve conflict
608608
cost_reduce = cost[i_self_keep][:, i_other_keep]
609609
shape = cost_reduce.shape
610-
nb_conflict = (-cost_reduce.mask).sum()
610+
nb_conflict = (~cost_reduce.mask).sum()
611611
logging.debug('Shape conflict matrix : %s, %d conflicts', shape, nb_conflict)
612612

613613
if nb_conflict >= (shape[0] + shape[1]):
@@ -647,8 +647,6 @@ def tracking(self, other):
647647
mask_accept_dist = self.mask_function(other)
648648
indexs_closest = where(mask_accept_dist)
649649

650-
# self.across_ground(self.obs[indexs_closest[0]], other.obs[indexs_closest[1]])
651-
652650
cost_values = self.cost_function(
653651
self.obs[indexs_closest[0]],
654652
other.obs[indexs_closest[1]],
@@ -726,58 +724,6 @@ def elements(self):
726724
elements.extend(['track', 'segment_size', 'dlon', 'dlat'])
727725
return elements
728726

729-
@classmethod
730-
def init_move_function(cls, obs_a, obs_b, out):
731-
"""Store information to init move function
732-
"""
733-
out['dlon'] = obs_b['lon'] - obs_a['lon']
734-
out['dlat'] = obs_b['lat'] - obs_a['lat']
735-
736-
@classmethod
737-
def move_function(cls, obs_a, obs_b, out):
738-
"""Basic move on the previous one
739-
Position N-2 : A
740-
Position N-1 : B
741-
Forecast Position : C
742-
743-
New position C = B + AB
744-
"""
745-
out['lon'] = obs_b['lon'] + out['dlon']
746-
out['lat'] = obs_b['lat'] + out['dlat']
747-
748-
@classmethod
749-
def forecast_move(cls, obs_a, obs_b, out):
750-
"""Forecast move of an eddy
751-
work to do
752-
"""
753-
# New dead
754-
for key in obs_b.dtype.fields.keys():
755-
# Copy all parameters (which are not listed below)
756-
# from the previous observations
757-
if key in ['lon', 'lat', 'time', 'segment_size',
758-
'dlon', 'dlat'] or 'contour_' in key:
759-
continue
760-
out[key] = obs_b[key]
761-
cls.init_move_function(obs_a, obs_b, out)
762-
cls.move_function(obs_a, obs_b, out)
763-
764-
# Previous dead eddies
765-
# Add previous virtual
766-
if nb_virtual_extend > 0:
767-
obs_to_extend = self.previous_virtual_obs.obs[i_virtual_dead_id
768-
][alive_virtual_obs]
769-
for key in obs_b.dtype.fields.keys():
770-
if key in ['lon', 'lat', 'time', 'track', 'segment_size',
771-
'dlon', 'dlat'] or 'contour_' in key:
772-
continue
773-
out[key][nb_dead:] = obs_to_extend[key]
774-
out['lon'][nb_dead:] = obs_to_extend['lon'] + obs_to_extend['dlon']
775-
out['lat'][nb_dead:] = obs_to_extend['lat'] + obs_to_extend['dlat']
776-
out['track'][nb_dead:] = obs_to_extend['track']
777-
out['segment_size'][nb_dead:] = obs_to_extend['segment_size']
778-
# Count
779-
out['segment_size'][:] += 1
780-
781727

782728
class TrackEddiesObservations(EddiesObservations):
783729
"""Class to practice Tracking on observations

0 commit comments

Comments
 (0)