Skip to content

Commit

Permalink
Clarify variable naming
Browse files Browse the repository at this point in the history
  • Loading branch information
pnuu committed Apr 24, 2024
1 parent aa18b7f commit 3730117
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions satpy/readers/ahi_hsd.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,8 +794,8 @@ def _modify_observation_time_for_nominal(self, observation_time):
)
return observation_time
timeline = self._get_closest_timeline(observation_time)
date = self._get_offset_relative_to_timeline()
return timeline + dt.timedelta(minutes=date//60, seconds=date % 60)
offset = self._get_offset_relative_to_timeline()
return timeline + dt.timedelta(minutes=offset//60, seconds=offset % 60)

def _get_closest_timeline(self, observation_time):
"""Find the closest timeline for the given observation time.
Expand Down
8 changes: 4 additions & 4 deletions satpy/readers/ahi_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ def __init__(self, filename, filename_info, filetype_info):
@property
def start_time(self):
"""Start timestamp of the dataset."""
date = self.nc.attrs["time_coverage_start"]
return dt.datetime.strptime(date, "%Y-%m-%dT%H:%M:%SZ")
date_str = self.nc.attrs["time_coverage_start"]
return dt.datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%SZ")

@property
def end_time(self):
"""End timestamp of the dataset."""
date = self.nc.attrs["time_coverage_end"]
return dt.datetime.strptime(date, "%Y-%m-%dT%H:%M:%SZ")
date_str = self.nc.attrs["time_coverage_end"]
return dt.datetime.strptime(date_str, "%Y-%m-%dT%H:%M:%SZ")

def get_dataset(self, key, info):
"""Load a dataset."""
Expand Down
8 changes: 4 additions & 4 deletions satpy/readers/goci2_l2_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,14 @@ def _merge_navigation_data(self, filetype):
@property
def start_time(self):
"""Start timestamp of the dataset."""
date = self.attrs["observation_start_time"]
return dt.datetime.strptime(date, "%Y%m%d_%H%M%S")
date_str = self.attrs["observation_start_time"]
return dt.datetime.strptime(date_str, "%Y%m%d_%H%M%S")

@property
def end_time(self):
"""End timestamp of the dataset."""
date = self.attrs["observation_end_time"]
return dt.datetime.strptime(date, "%Y%m%d_%H%M%S")
date_str = self.attrs["observation_end_time"]
return dt.datetime.strptime(date_str, "%Y%m%d_%H%M%S")

def get_dataset(self, key, info):
"""Load a dataset."""
Expand Down
18 changes: 9 additions & 9 deletions satpy/readers/goes_imager_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,15 +731,15 @@ def _get_area_def_uniform_sampling(self, lon0, channel):
@property
def start_time(self):
"""Start timestamp of the dataset."""
date = self.nc["time"].dt
return dt.datetime(
year=int(date.year.item()),
month=int(date.month.item()),
day=int(date.day.item()),
hour=int(date.hour.item()),
minute=int(date.minute.item()),
second=int(date.second.item()),
microsecond=int(date.microsecond.item()))
timestamp = self.nc["time"].dt
return dt.timestamptime(
year=int(timestamp.year.item()),
month=int(timestamp.month.item()),
day=int(timestamp.day.item()),
hour=int(timestamp.hour.item()),
minute=int(timestamp.minute.item()),
second=int(timestamp.second.item()),
microsecond=int(timestamp.microsecond.item()))

@property
def end_time(self):
Expand Down

0 comments on commit 3730117

Please sign in to comment.