Skip to content

Commit

Permalink
Revert "ViewExtension handles NaN values for viewing_angles correctly…
Browse files Browse the repository at this point in the history
…, release prep for 0.6.2"

This reverts commit 6160790.
  • Loading branch information
Phil Varner committed Jan 8, 2024
1 parent 6160790 commit 8d347a2
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 2,133 deletions.
7 changes: 0 additions & 7 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). This project attempts to match the major and minor versions of [stactools](https://github.com/stac-utils/stactools) and increments the patch number as needed.

## [0.6.2] - 2024-01-08

### Fixed

- ViewExtension handles NaN values for viewing_angles correctly.

## [0.6.1] - 2024-01-04

### Fixed
Expand Down Expand Up @@ -125,7 +119,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Upgrade to stactools 0.2.1.a2 (supporting PySTAC 1.0.0)

<!-- [Unreleased]: <https://github.com/stactools-packages/sentinel2/compare/v0.4.2..main> -->
[0.6.2]: <https://github.com/stactools-packages/sentinel2/compare/v0.6.1..v0.6.2>
[0.6.1]: <https://github.com/stactools-packages/sentinel2/compare/v0.6.0..v0.6.1>
[0.6.0]: <https://github.com/stactools-packages/sentinel2/compare/v0.5.0..v0.6.0>
[0.5.0]: <https://github.com/stactools-packages/sentinel2/compare/v0.4.2..v0.5.0>
Expand Down
7 changes: 0 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,3 @@ build-backend = "setuptools.build_meta"
[tool.ruff]
line-length = 88
select = ["E", "F", "I"]

# pyproject.toml
[tool.pytest.ini_options]
filterwarnings = [
"error",
"ignore::antimeridian.FixWindingWarning",
]
1 change: 0 additions & 1 deletion scripts/create_expected.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"S2A_MSIL2A_20190212T192651_N0212_R013_T07HFE_20201007T160857",
"S2A_MSIL1C_20210908T042701_N0301_R133_T46RER_20210908T070248",
"S2B_MSIL2A_20191228T210519_N0212_R071_T01CCV_20201003T104658",
"S2A_OPER_MSI_L2A_TL_VGS1_20220401T110010_A035382_T34LBQ-no-tileDataGeometry",
]

root = Path(__file__).parents[1]
Expand Down
2 changes: 1 addition & 1 deletion src/stactools/sentinel2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ def register_plugin(registry):
registry.register_subcommand(commands.create_sentinel2_command)


__version__ = "0.6.2"
__version__ = "0.6.1"
22 changes: 2 additions & 20 deletions src/stactools/sentinel2/stac.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from pystac.extensions.projection import ProjectionExtension
from pystac.extensions.raster import DataType, RasterBand, RasterExtension
from pystac.extensions.sat import OrbitState, SatExtension
from pystac.extensions.view import SCHEMA_URI as VIEW_EXT_URI
from pystac.extensions.view import ViewExtension
from pystac.utils import now_to_rfc3339_str
from shapely.geometry import mapping as shapely_mapping
Expand Down Expand Up @@ -197,14 +196,8 @@ def create_item(

# View Extension
view = ViewExtension.ext(item, add_if_missing=True)

if all(not math.isnan(v.azimuth) for v in metadata.viewing_angles.values()):
view.azimuth = mean([v.azimuth for v in metadata.viewing_angles.values()])

if all(not math.isnan(v.zenith) for v in metadata.viewing_angles.values()):
view.incidence_angle = mean(
[v.zenith for v in metadata.viewing_angles.values()]
)
view.azimuth = mean([v.azimuth for v in metadata.viewing_angles.values()])
view.incidence_angle = mean([v.zenith for v in metadata.viewing_angles.values()])

# both sun_azimuth and sun_zenith can be NaN, so don't set
# when that is the case
Expand All @@ -214,17 +207,6 @@ def create_item(
if (msz := metadata.sun_zenith) and not math.isnan(msz):
view.sun_elevation = 90 - msz

if all(
x is None
for x in [
view.azimuth,
view.incidence_angle,
view.sun_azimuth,
view.sun_elevation,
]
):
item.stac_extensions.remove(VIEW_EXT_URI)

# Sentinel-2 Extension
item.stac_extensions.append(SENTINEL2_EXTENSION_SCHEMA)
item.properties.update(metadata.metadata_dict)
Expand Down
Loading

0 comments on commit 8d347a2

Please sign in to comment.