Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dataset maturity #67

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
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
9 changes: 8 additions & 1 deletion odc/stats/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,12 +410,15 @@ def render_assembler_metadata(
warnings.simplefilter(action="ignore", category=UserWarning)

platforms, instruments = ([], [])
maturity = []

for dataset in self.datasets:
if "fused" in dataset.type.name:
sources = [e["id"] for e in dataset.metadata.sources.values()]
platforms.append(dataset.metadata_doc["properties"]["eo:platform"])
instruments.append(dataset.metadata_doc["properties"]["eo:instrument"])
maturity.append(
dataset.metadata_doc["properties"]["dea:dataset_maturity"])
dataset_assembler.note_source_datasets(
self.product.classifier, *sources
)
Expand All @@ -435,6 +438,9 @@ def render_assembler_metadata(
platforms.append(source_datasetdoc.properties["eo:platform"])
if "eo:instrument" in source_datasetdoc.properties:
instruments.append(source_datasetdoc.properties["eo:instrument"])
if "dea:dataset_maturity" in source_datasetdoc.properties:
maturity.append(
source_datasetdoc.properties["dea:dataset_maturity"])

dataset_assembler.platform = ",".join(sorted(set(platforms)))
dataset_assembler.instrument = "_".join(sorted(set(instruments)))
Expand All @@ -459,6 +465,8 @@ def render_assembler_metadata(
dataset_assembler.product_name = self.product.name
dataset_assembler.dataset_version = self.product.version
dataset_assembler.region_code = self.product.region_code(self.tile_index)
dataset_assembler.maturity = self.product.maturity if self.product.maturity else ",".join(
sorted(set(maturity)))

# set the warning message back
warnings.filterwarnings("default")
Expand All @@ -467,7 +475,6 @@ def render_assembler_metadata(
processing_dt = datetime.utcnow()
dataset_assembler.processed = processing_dt

dataset_assembler.maturity = self.product.maturity
dataset_assembler.collection_number = self.product.collection_number

if output_dataset is not None:
Expand Down