Skip to content

Commit 2d7517e

Browse files
correction of repr when EddiesObservation is empty
1 parent d59406c commit 2d7517e

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Changed
1717
Fixed
1818
^^^^^
1919
- Use `safe_load` for yaml load
20+
- repr of EddiesObservation when the collection is empty (time attribute empty array)
2021

2122
Added
2223
^^^^^

src/py_eddy_tracker/observations/observation.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2117,13 +2117,16 @@ def interp_grid(
21172117
@property
21182118
def period(self):
21192119
"""
2120-
Give the time coverage
2120+
Give the time coverage. If collection is empty, return nan,nan
21212121
21222122
:return: first and last date
21232123
:rtype: (int,int)
21242124
"""
21252125
if self.period_ is None:
2126-
self.period_ = self.time.min(), self.time.max()
2126+
if self.time.size < 1:
2127+
self.period_ = nan, nan
2128+
else:
2129+
self.period_ = self.time.min(), self.time.max()
21272130
return self.period_
21282131

21292132
@property

0 commit comments

Comments
 (0)