Skip to content

Commit

Permalink
Refactor file_key generation
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Jan 24, 2022
1 parent 1eea1b6 commit b3db3d4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions satpy/readers/nwcsaf_nc.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,7 @@ def get_dataset(self, dsid, info):
dsid_name = dsid_name + '_reduced'

logger.debug('Reading %s.', dsid_name)
try:
file_key = self.file_key_prefix + info["file_key"]
except KeyError:
file_key = dsid_name
file_key = self._get_filekey(dsid_name, info)
variable = self.nc[file_key]
variable = self.remove_timedim(variable)
variable = self.scale_dataset(dsid, variable, info)
Expand All @@ -150,6 +147,13 @@ def get_dataset(self, dsid, info):

return variable

def _get_filekey(self, dsid_name, info):
try:
file_key = self.file_key_prefix + info["file_key"]
except KeyError:
file_key = dsid_name
return file_key

def scale_dataset(self, dsid, variable, info):
"""Scale the data set, applying the attributes from the netCDF file.
Expand Down

0 comments on commit b3db3d4

Please sign in to comment.