Skip to content

Commit

Permalink
fix: precommit checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabe-Levin committed Nov 14, 2024
1 parent 90ecaaf commit 00a07dd
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions space2stats_api/src/space2stats_ingest/METADATA/link_new_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ def load_existing_collection(collection_path: str) -> Collection:

# Function to create a new STAC item
def create_new_item(
sources: pd.DataFrame, column_types: dict, item_id: str, feature_catalog: pd.DataFrame
sources: pd.DataFrame,
column_types: dict,
item_id: str,
feature_catalog: pd.DataFrame,
) -> tuple[Item, str]:
# Define geometry and bounding box (you may want to customize these)
geom = {
Expand Down Expand Up @@ -132,7 +135,12 @@ def create_new_item(
TableExtension.add_to(item)
table_extension = TableExtension.ext(item, add_if_missing=True)
table_extension.columns = [
{"name": col, "description": feature_catalog.loc[col, "description"],"type": dtype} for col, dtype in column_types.items()
{
"name": col,
"description": feature_catalog.loc[col, "description"],
"type": dtype,
}
for col, dtype in column_types.items()
]

# Add asset
Expand Down Expand Up @@ -194,7 +202,9 @@ def main():
collection = load_existing_collection(collection_path)

# Create a new item
new_item, item_title = create_new_item(metadata["sources"], column_types, item_id, feature_catalog)
new_item, item_title = create_new_item(
metadata["sources"], column_types, item_id, feature_catalog
)

# Add the new item to the collection
collection.add_item(new_item, title=item_title)
Expand Down

0 comments on commit 00a07dd

Please sign in to comment.