Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
correction of repr when EddiesObservation is empty
  • Loading branch information
ludwigVonKoopa committed Mar 2, 2021
commit 2d7517e5fe442c4c1a927ed9a2b1b68d150f1058
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Changed
Fixed
^^^^^
- Use `safe_load` for yaml load
- repr of EddiesObservation when the collection is empty (time attribute empty array)

Added
^^^^^
Expand Down
7 changes: 5 additions & 2 deletions src/py_eddy_tracker/observations/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2117,13 +2117,16 @@ def interp_grid(
@property
def period(self):
"""
Give the time coverage
Give the time coverage. If collection is empty, return nan,nan

:return: first and last date
:rtype: (int,int)
"""
if self.period_ is None:
self.period_ = self.time.min(), self.time.max()
if self.time.size < 1:
self.period_ = nan, nan
else:
self.period_ = self.time.min(), self.time.max()
return self.period_

@property
Expand Down