Skip to content

Commit

Permalink
fix times attribute
Browse files Browse the repository at this point in the history
it was always available in fuv.ds.times
but this is maybe still helpful to work
  • Loading branch information
michaelaye committed Feb 8, 2019
1 parent 8c6e73c commit 770e3f9
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions pyuvis/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,18 @@ def __init__(self, fname, freq):
self.fname = str(self.path)
self.ds = xr.open_dataset(self.fname)
self.freq = freq
self.timestr = self.ds.start_time_str[:21] + "000"
self.timestr = self.ds.start_time_str[:20] + "000"
self.n_integrations = self.ds["integrations"].size

@property
def start_time(self):
timestr = self.timestr
fmt = "%Y-%j %H:%M:%S.%f"
return dt.datetime.strptime(timestr, fmt)
try:
fmt = "%Y-%j %H:%M:%S.%f"
return dt.datetime.strptime(timestr, fmt)
except ValueError:
fmt = "%Y-%jT%H:%M:%S.%f"
return dt.datetime.strptime(timestr, fmt)

@property
def times(self):
Expand All @@ -91,10 +96,6 @@ def times(self):
)
return times

@property
def n_integrations(self):
return self.ds["integrations"].size


class HSP(UVIS_NetCDF):

Expand Down

0 comments on commit 770e3f9

Please sign in to comment.