Skip to content

Commit fd7d1c8

Browse files
committed
Remove some additional pre-0.8 logic
1 parent 97cf54a commit fd7d1c8

File tree

2 files changed

+0
-42
lines changed

2 files changed

+0
-42
lines changed

pystac/extensions/eo.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
https://github.com/stac-extensions/eo
44
"""
55

6-
import re
76
from typing import (
87
Any,
98
Dict,
@@ -498,36 +497,6 @@ class EOExtensionHooks(ExtensionHooks):
498497
def migrate(
499498
self, obj: Dict[str, Any], version: STACVersionID, info: STACJSONDescription
500499
) -> None:
501-
if version < "0.5":
502-
if "eo:crs" in obj["properties"]:
503-
# Try to pull out the EPSG code.
504-
# Otherwise, just leave it alone.
505-
wkt = obj["properties"]["eo:crs"]
506-
matches = list(re.finditer(r'AUTHORITY\[[^\]]*\"(\d+)"\]', wkt))
507-
if len(matches) > 0:
508-
epsg_code = matches[-1].group(1)
509-
obj["properties"].pop("eo:crs")
510-
obj["properties"]["eo:epsg"] = int(epsg_code)
511-
512-
if version < "0.6":
513-
# Change eo:bands from a dict to a list. eo:bands on an asset
514-
# is an index instead of a dict key. eo:bands is in properties.
515-
bands_dict = obj["eo:bands"]
516-
keys_to_indices: Dict[str, int] = {}
517-
bands: List[Dict[str, Any]] = []
518-
for i, (k, band) in enumerate(bands_dict.items()):
519-
keys_to_indices[k] = i
520-
bands.append(band)
521-
522-
obj.pop("eo:bands")
523-
obj["properties"]["eo:bands"] = bands
524-
for k, asset in obj["assets"].items():
525-
if "eo:bands" in asset:
526-
asset_band_indices: List[int] = []
527-
for bk in asset["eo:bands"]:
528-
asset_band_indices.append(keys_to_indices[bk])
529-
asset["eo:bands"] = sorted(asset_band_indices)
530-
531500
if version < "0.9":
532501
# Some eo fields became common_metadata
533502
if (

pystac/serialization/migrate.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,9 @@
1313
from pystac import STACObjectType as STACObjectType_Type
1414

1515

16-
def _migrate_links(d: Dict[str, Any], version: STACVersionID) -> None:
17-
if version < "0.6":
18-
if "links" in d:
19-
if isinstance(d["links"], dict):
20-
d["links"] = list(d["links"].values())
21-
22-
2316
def _migrate_catalog(
2417
d: Dict[str, Any], version: STACVersionID, info: STACJSONDescription
2518
) -> None:
26-
_migrate_links(d, version)
27-
2819
if version < "0.8":
2920
d["stac_extensions"] = list(info.extensions)
3021

@@ -38,8 +29,6 @@ def _migrate_collection(
3829
def _migrate_item(
3930
d: Dict[str, Any], version: STACVersionID, info: STACJSONDescription
4031
) -> None:
41-
_migrate_links(d, version)
42-
4332
if version < "0.8":
4433
d["stac_extensions"] = list(info.extensions)
4534

0 commit comments

Comments
 (0)