Skip to content

Commit 8af2190

Browse files
committed
Add lifetime and age property for tracked observations
1 parent 663d583 commit 8af2190

File tree

3 files changed

+51
-1
lines changed

3 files changed

+51
-1
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
### Added
11+
- Acces at dataset variable like attribute, and lifetime/age are available for all observations
12+
- Add **EddyInfos** application to get general information about eddies dataset
13+
- Add method to inspect contour rejection (which are not in eddies)
14+
### Changed
15+
16+
### Removed
17+
18+
19+
## [3.2.0] - 2020-09-16
20+
21+
### Added
22+
23+
### Changed
24+
25+
### Removed
26+
27+
## [3.1.0] - 2020-06-25
28+
29+
### Added
30+
31+
### Changed
32+
33+
### Removed

src/py_eddy_tracker/observations/tracking.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,16 @@ def nb_obs_by_track(self):
306306
self.compute_index()
307307
return self.__obs_by_track
308308

309+
@property
310+
def lifetime(self):
311+
"""Return for each observation lifetime"""
312+
return self.nb_obs_by_track.repeat(self.nb_obs_by_track)
313+
314+
@property
315+
def age(self):
316+
"""Return for each observation age in %, will be [0:100]"""
317+
return self.n.astype("f4") / (self.lifetime - 1) * 100.0
318+
309319
def extract_ids(self, tracks):
310320
mask = self.get_mask_from_id(array(tracks))
311321
return self.extract_with_mask(mask)

src/py_eddy_tracker/poly.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,14 @@
1111

1212

1313
@njit(cache=True)
14-
def is_left(x_line_0, y_line_0, x_line_1, y_line_1, x_test, y_test):
14+
def is_left(
15+
x_line_0: float,
16+
y_line_0: float,
17+
x_line_1: float,
18+
y_line_1: float,
19+
x_test: float,
20+
y_test: float,
21+
) -> bool:
1522
"""
1623
Test if point is left of an infinit line.
1724

0 commit comments

Comments
 (0)