|
3 | 3 | https://github.com/stac-extensions/eo
|
4 | 4 | """
|
5 | 5 |
|
6 |
| -import re |
7 | 6 | from typing import (
|
8 | 7 | Any,
|
9 | 8 | Dict,
|
@@ -498,36 +497,6 @@ class EOExtensionHooks(ExtensionHooks):
|
498 | 497 | def migrate(
|
499 | 498 | self, obj: Dict[str, Any], version: STACVersionID, info: STACJSONDescription
|
500 | 499 | ) -> 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 |
| - |
531 | 500 | if version < "0.9":
|
532 | 501 | # Some eo fields became common_metadata
|
533 | 502 | if (
|
|
0 commit comments