Skip to content

Commit

Permalink
Removed the dead code, simplied the _dataset_label
Browse files Browse the repository at this point in the history
  • Loading branch information
n3h3m committed Oct 6, 2020
1 parent 3e30fe1 commit baf8505
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions eodatasets3/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,6 @@ def producer_abbreviated(self) -> Optional[str]:


class ComplicatedNamingConventionsDerivatives(ComplicatedNamingConventions):

"""
This class is inherited from ComplicatedNamingConventions
and overrides few attributes specific to C3 data processing for data other than ARD.
Expand Down Expand Up @@ -401,7 +400,6 @@ def for_c3_derivatives(cls, dataset: EoFields, uri=DEA_URI_PREFIX):

@property
def _org_collection_number(self) -> Optional[int]:

# Deliberately fail if collection_number is not defined in the config yaml
return int(self.dataset.collection_number)

Expand All @@ -423,23 +421,19 @@ def destination_folder(self, base: Path):
return base.joinpath(*parts)

def _dataset_label(self, sub_name: str = None):
# Copycat of the parent method except version is simply collection number
p = self.dataset
version = p.collection_number
maturity: str = p.properties.get("dea:dataset_maturity")
return "_".join(
[
p
for p in (
self._product_group(sub_name),
version,
self._displayable_region_code,
f"{p.datetime:%Y-%m-%d}",
maturity,
)
if p
]
)
"""
Responsible for producing the string of product name, regioncode, datetime and maturity
ex: 'ga_ls_wo_3_090081_1998-07-30_interim'
Redundant parameter sub_name is required, since the parent class and other invocations wants it so.
"""
parts = [
self.product_name,
self._displayable_region_code,
f"{self.dataset.datetime:%Y-%m-%d}",
self.dataset.maturity,
]
return "_".join(parts)

@property
def platform_abbreviated(self) -> Optional[str]:
Expand Down

0 comments on commit baf8505

Please sign in to comment.