Skip to content

Commit 7ab32b2

Browse files
ivorbosloperm-mohr
authored andcommitted
Change default temporal property to datetime
improve command typing columns.value should allow list and tuple
1 parent c1bb82d commit 7ab32b2

File tree

5 files changed

+12
-10
lines changed

5 files changed

+12
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
- Change default temporal property to datetime
11+
- Enable Converter.columns list and tuple types
12+
1013
## [v0.2.11] - 2025-10-09
1114

1215
- XML/HTML-like tags (with < and > characters) in logs are properly escaped for loguru

vecorel_cli/conversion/base.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from glob import glob
1212
from io import StringIO
1313
from tempfile import TemporaryDirectory
14-
from typing import Any, Callable, Generator, Optional
14+
from typing import Any, Callable, Generator, Optional, Sequence
1515

1616
import flatdict
1717
import geopandas as gpd
@@ -51,7 +51,7 @@ class BaseConverter(LoggerMixin):
5151
variants: dict[str, Sources] = {}
5252
variant: Optional[str] = None
5353

54-
columns: dict[str, str] = {}
54+
columns: dict[str, str|Sequence[str]] = {}
5555
column_additions: dict[str, str] = {}
5656
column_filters: dict[str, Callable] = {}
5757
column_migrations: dict[str, Callable] = {}
@@ -325,7 +325,6 @@ def convert(
325325
paths = self.download_files(urls, cache, **request_args)
326326

327327
gdf = self.read_data(paths, **self.open_options)
328-
329328
self.info("GeoDataFrame created from source(s):")
330329
# Make it so that everything is shown, don't output ... if there are too many columns or rows
331330
display_pandas_unrestricted()
@@ -375,7 +374,7 @@ def convert(
375374
for old_key, new_key in columns.items():
376375
if old_key in gdf.columns:
377376
# If the new keys are a list, duplicate the column
378-
if isinstance(new_key, list):
377+
if isinstance(new_key, (list, tuple)):
379378
for key in new_key:
380379
gdf[key] = gdf.loc[:, old_key]
381380
actual_columns[key] = key
@@ -417,6 +416,7 @@ def convert(
417416
columns = list(actual_columns.values())
418417
pq = GeoParquet(output_file)
419418
pq.set_collection(self.create_collection(cid))
419+
420420
pq.write(
421421
gdf,
422422
properties=columns,

vecorel_cli/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def get_cli_args():
7474
"-og",
7575
is_flag=True,
7676
type=click.BOOL,
77-
help="Keep the source geometries as provided, i.e. this option disables that geomtries are made valid and converted to Polygons.",
77+
help="Keep the source geometries as provided, i.e. this option disables that geometries are made valid and converted to Polygons.",
7878
default=False,
7979
),
8080
"py-package": PY_PACKAGE,

vecorel_cli/create_stac.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class CreateStacCollection(BaseCommand):
2525
processing_extension = "https://stac-extensions.github.io/processing/v1.1.0/schema.json"
2626
table_extension = "https://stac-extensions.github.io/table/v1.2.0/schema.json"
2727

28-
temporal_property = "determination_datetime"
28+
temporal_property = "datetime"
2929

3030
@staticmethod
3131
def get_cli_args():

vecorel_cli/improve.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ def improve_file(
7878
input_encoding = create_encoding(source)
7979
geodata = input_encoding.read()
8080
collection = input_encoding.get_collection()
81-
8281
geodata, collection = self.improve(geodata, collection=collection, **kwargs)
8382

8483
output_encoding = create_encoding(target)
@@ -94,8 +93,8 @@ def improve_file(
9493
def improve(
9594
self,
9695
gdf: GeoDataFrame,
97-
collection: dict = {},
98-
rename: dict[str, str] = {},
96+
collection: Collection,
97+
rename: Optional[dict[str, str]] = None,
9998
add_sizes: bool = False,
10099
fix_geometries: bool = False,
101100
explode_geometries: bool = False,
@@ -117,7 +116,7 @@ def improve(
117116
self.info("Exploded geometries")
118117

119118
# Rename columns
120-
if len(rename) > 0:
119+
if rename:
121120
self.rename_warnings(gdf, rename)
122121
gdf, collection = self.rename_properties(gdf, rename, collection)
123122
self.info("Renamed columns")

0 commit comments

Comments
 (0)