Skip to content

Commit

Permalink
Merge branch 'main' into python-3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski authored Nov 27, 2023
2 parents 3641047 + c2c1d3c commit 822a266
Show file tree
Hide file tree
Showing 326 changed files with 8,941 additions and 9,668 deletions.
5 changes: 4 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ exclude_lines =
[run]
branch = true
source =
pystac
pystac
omit =
pystac/extensions/label.py

15 changes: 15 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,18 @@ jobs:
run: asv machine --yes
- name: Check benchmarks
run: asv run -a repeat=1 -a rounds=1 HEAD

docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
- name: Install pandoc
run: sudo apt-get install pandoc
- name: Install pystac
run: pip install .[docs]
- name: Check docs
run: make -C docs html SPHINXOPTS="-W --keep-going"
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

## [Unreleased]

## [v1.9.0] - 2023-10-23

### Added

- Simpler extension interface ([#1243](https://github.com/stac-utils/pystac/pull/1243)])
- More permissive schema_uri matching to allow future versions of extension schemas ([#1231](https://github.com/stac-utils/pystac/pull/1231))
- Better error messages from jsonschema validation ([#1233](https://github.com/stac-utils/pystac/pull/1233))
- `validate_all_dict` replaces the previous implementation of `validate_all` (i.e., `validate_all` was renamed to `validate_all_dict`, and `validate_all` was changed as described below) ([#1246](https://github.com/stac-utils/pystac/pull/1246))
Expand All @@ -14,6 +17,7 @@
- `validate_all` now accepts a `STACObject` (in addition to accepting a dict, which is now deprecated), but prohibits supplying a value for `href`, which must be supplied _only_ when supplying an object as a dict. Once `validate_all` removes support for an object as a dict, the `href` parameter will also be removed. ([#1246](https://github.com/stac-utils/pystac/pull/1246))
- Report `href` when schema url resolution fails ([#1263](https://github.com/stac-utils/pystac/pull/1263))
- Version extension updated to v1.2.0 ([#1262](https://github.com/stac-utils/pystac/pull/1262))
- Datacube extension updated to v2.2.0 ([#1269](https://github.com/stac-utils/pystac/pull/1269))

### Fixed

Expand All @@ -31,6 +35,7 @@

- `ExtensionManagementMixin.validate_has_extension` is replaced with `ExtensionManagementMixin.ensure_has_extension`. Calling `ExtensionManagementMixin.validate_has_extension` will raise a `DeprecationWarning` and call `ExtensionManagementMixin.ensure_has_extension` ([#1248](https://github.com/stac-utils/pystac/pull/1248))
- `validate_all` for dicts; use `validate_all_dict` instead ([#1246](https://github.com/stac-utils/pystac/pull/1246))
- `Label` extension ([#1270](https://github.com/stac-utils/pystac/pull/1270))

## [v1.8.4] - 2023-09-22

Expand Down Expand Up @@ -808,7 +813,8 @@ use `Band.create`

Initial release.

[Unreleased]: <https://github.com/stac-utils/pystac/compare/v1.8.4..main>
[Unreleased]: <https://github.com/stac-utils/pystac/compare/v1.9.0..main>
[v1.9.0]: <https://github.com/stac-utils/pystac/compare/v1.8.4..v1.9.0>
[v1.8.4]: <https://github.com/stac-utils/pystac/compare/v1.8.3..v1.8.4>
[v1.8.3]: <https://github.com/stac-utils/pystac/compare/v1.8.2..v1.8.3>
[v1.8.2]: <https://github.com/stac-utils/pystac/compare/v1.8.1..v1.8.2>
Expand Down
8 changes: 4 additions & 4 deletions benchmarks/_util.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from __future__ import annotations

import os
from typing import TYPE_CHECKING, Union
from typing import TYPE_CHECKING

if TYPE_CHECKING:
PathLike = os.PathLike[str]
else:
PathLike = os.PathLike


def get_data_path(rel_path: Union[str, PathLike]) -> str:
def get_data_path(rel_path: str | PathLike) -> str:
"""Gets the absolute path to a file based on a path relative to the
tests/data-files directory in this repo."""
rel_path = os.fspath(rel_path)
Expand Down
1 change: 0 additions & 1 deletion docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ PySTAC provides support for the following STAC Extensions:
* :mod:`Electro-Optical <pystac.extensions.eo>`
* :mod:`File Info <pystac.extensions.file>`
* :mod:`Item Assets <pystac.extensions.item_assets>`
* :mod:`Label <pystac.extensions.label>`
* :mod:`MGRS <pystac.extensions.mgrs>`
* :mod:`Point Cloud <pystac.extensions.pointcloud>`
* :mod:`Projection <pystac.extensions.projection>`
Expand Down
1 change: 0 additions & 1 deletion docs/api/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pystac.extensions
file.FileExtension
grid.GridExtension
item_assets.ItemAssetsExtension
label.LabelExtension
mgrs.MgrsExtension
pointcloud.PointcloudExtension
projection.ProjectionExtension
Expand Down
3 changes: 0 additions & 3 deletions docs/api/extensions/datacube.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,3 @@ pystac.extensions.datacube
.. automodule:: pystac.extensions.datacube
:members:
:undoc-members:

.. autoautosummary::
:methods:
6 changes: 0 additions & 6 deletions docs/api/extensions/label.rst

This file was deleted.

1 change: 0 additions & 1 deletion docs/api/serialization/identify.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ pystac.serialization.identify
.. automodule:: pystac.serialization.identify
:members:
:undoc-members:

:noindex:
39 changes: 8 additions & 31 deletions docs/concepts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -681,44 +681,25 @@ Mapping over Items
------------------
The :func:`Catalog.map_items <pystac.Catalog.map_items>` method is useful for
into smaller chunks (e.g. tiling out large image items).
item, you can return multiple items, in case you are generating new objects, or splitting items
manipulating items in a STAC. This will create a full copy of the STAC, so will leave
the original catalog unmodified. In the method that manipulates and returns the modified
item, you can return multiple items, in case you are generating new objects (e.g.
creating a :class:`~pystac.LabelItem` for image items in a stac), or splitting items
into smaller chunks (e.g. tiling out large image items).
.. code-block:: python
def modify_item_title(item):
item.title = 'Some new title'
return item
def create_label_item(item):
# Assumes the GeoJSON labels are in the
# same location as the image
img_href = item.assets['ortho'].href
label_href = '{}.geojson'.format(os.path.splitext(img_href)[0])
label_item = LabelItem(id='Labels',
geometry=item.geometry,
bbox=item.bbox,
datetime=datetime.utcnow(),
properties={},
label_description='labels',
label_type='vector',
label_properties='label',
label_classes=[
LabelClasses(classes=['one', 'two'],
name='label')
],
label_tasks=['classification'])
label_item.add_source(item, assets=['ortho'])
label_item.add_geojson_labels(label_href)
return [item, label_item]
def duplicate_item(item):
duplicated_item = item.clone()
duplicated_item.id += "-duplicated"
return [item, duplicated_item]
c = catalog.map_items(modify_item_title)
c = c.map_items(create_label_item)
c = c.map_items(duplicate_item)
new_catalog = c
.. _copy stacs:
Expand All @@ -731,11 +712,7 @@ and mutations of STAC data. The :func:`STACObject.full_copy
<pystac.STACObject.full_copy>` mechanism handles this in a way that ties the elements of
the copies STAC together correctly. This includes situations where there might be cycles
in the graph of connected objects of the STAC (which otherwise would be `a tree
<https://en.wikipedia.org/wiki/Tree_(graph_theory)>`_). For example, if a
:class:`~pystac.LabelItem` lists a :attr:`~pystac.LabelItem.source` that is an item also
contained in the root catalog; the full copy of the STAC will ensure that the
:class:`~pystac.Item` instance representing the source imagery item is the same instance
that is linked to by the :class:`~pystac.LabelItem`.
<https://en.wikipedia.org/wiki/Tree_(graph_theory)>`_).
Resolving STAC objects
======================
Expand Down
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
{"name": "STAC Spec", "url": "https://github.com/radiantearth/stac-spec"}
],
"header_links_before_dropdown": 7,
"navigation_with_keys": False,
# "navbar_end": ["navbar-icon-links.html", "search-field.html"]
}

Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ How to create STAC Catalogs with PySTAC
This was a tutorial that was part of a 30 minute presentation at the `community STAC
sprint
<https://github.com/radiantearth/community-sprints/tree/master/11052019-arlignton-va>`_
in Arlington, VA in November 2019. It runs through creating a STAC of image or label
items from the `SpaceNet 5 <https://www.topcoder.com/challenges/30099956>`_ dataset.
in Arlington, VA in November 2019. It runs through creating a STAC of images
from the `SpaceNet 5 <https://www.topcoder.com/challenges/30099956>`_ dataset.

Creating a Landsat 8 STAC
-------------------------
Expand Down
10 changes: 4 additions & 6 deletions docs/tutorials/creating-a-landsat-stac.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1770,9 +1770,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Add additional attributes\n",
"\n",
"#### Add projection information\n",
"### Add projection information\n",
"\n",
"We can specify the EPSG code for the scene as part of the [projection extension](https://github.com/stac-extensions/projection). The below method, adapted from [stactools](https://github.com/stactools-packages/landsat/blob/9f595a9d5ed6b62a2e96338e79f5bb502a7d90d0/src/stactools/landsat/mtl_metadata.py#L86-L109), figures out the correct UTM Zone EPSG:"
]
Expand Down Expand Up @@ -1828,7 +1826,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Add view geometry information\n",
"### Add view geometry information\n",
"\n",
"The [View Geometry](https://github.com/stac-extensions/view) extension specifies information related to angles of sensors and other radiance angles that affect the view of resulting data. The Landsat metadata specifies two of these parameters, so we add them to our Item:"
]
Expand Down Expand Up @@ -2245,7 +2243,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"#### Reset collection extent based on items\n",
"### Reset collection extent based on items\n",
"\n",
"Now that we've added all the item we can use the `update_extent_from_items` method on the Collection to set the extent based on the contained items:"
]
Expand Down Expand Up @@ -2528,7 +2526,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.1"
"version": "3.11.3"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit 822a266

Please sign in to comment.