Skip to content

Commit

Permalink
add fields to properties instead of extra_fields
Browse files Browse the repository at this point in the history
  • Loading branch information
baloola committed Aug 3, 2023
1 parent 5be830c commit 216106c
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions stac/stac-generator/collection_convertor.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ def cleanup_datetime(path):
else:
end_date = datetime.strptime('2999-01-01T00:00:00Z', "%Y-%m-%dT%H:%M:%SZ")

extra_fields = dict()
properties = dict()
for field in collection.extra_fields:
if field not in ["type", "cube:dimensions"]:
extra_fields[field] = collection.extra_fields[field]
properties[field] = collection.extra_fields[field]

extra_fields.update(collection.summaries.to_dict())
properties.update(collection.summaries.to_dict())
providers_list = []
providers = collection.providers
for provider in providers:
providers_list.append(provider.to_dict())

extra_fields["providers"] = providers_list
extra_fields["description"] = collection.description
extra_fields["keywords"] = collection.keywords
extra_fields["title"] = collection.title
extra_fields["license"] = collection.license
properties["providers"] = providers_list
properties["description"] = collection.description
properties["keywords"] = collection.keywords
properties["title"] = collection.title
properties["license"] = collection.license

versioned_ext = collection.stac_extensions
v1_schema = 'https://stac-extensions.github.io/datacube/v1.0.0/schema.json'
Expand All @@ -104,7 +104,7 @@ def cleanup_datetime(path):
datetime=date,
bbox=bbox,
geometry=mapping(footprint),
properties=dict(),
properties=properties,
assets=collection.assets
)
dimension_object = collection.extra_fields["cube:dimensions"]
Expand All @@ -118,7 +118,6 @@ def cleanup_datetime(path):
item_datacube = datacube.DatacubeExtension.ext(feature)

item_datacube.dimensions = dims
feature.extra_fields = extra_fields
collection_links = collection.links
for link in collection_links:
if link.rel == "self" or (link.rel == "license" and link.href == ''):
Expand Down

0 comments on commit 216106c

Please sign in to comment.