Skip to content

Commit e666078

Browse files
authored
Release v0.8.4 (#742)
* release: v0.8.4 * fix: keep hvplot.pandas import * fix: another import
1 parent 60bf1fa commit e666078

8 files changed

+173
-205
lines changed

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33

44
repos:
55
- repo: https://github.com/charliermarsh/ruff-pre-commit
6-
rev: "v0.5.0"
6+
rev: "v0.6.9"
77
hooks:
88
- id: ruff
99
args: [--fix, --exit-non-zero-on-fix]
1010
- repo: https://github.com/psf/black
11-
rev: 24.4.2
11+
rev: 24.10.0
1212
hooks:
1313
- id: black
1414
- repo: https://github.com/codespell-project/codespell
@@ -18,14 +18,14 @@ repos:
1818
args: [--ignore-words=.codespellignore]
1919
types_or: [jupyter, markdown, python, shell]
2020
- repo: https://github.com/PyCQA/doc8
21-
rev: v1.1.1
21+
rev: v1.1.2
2222
hooks:
2323
- id: doc8
2424
args: [--ignore=D004]
2525
additional_dependencies:
2626
- importlib_metadata < 5; python_version == "3.7"
2727
- repo: https://github.com/pre-commit/mirrors-mypy
28-
rev: v1.10.1
28+
rev: v1.12.0
2929
hooks:
3030
- id: mypy
3131
files: ".*\\.py$"

CHANGELOG.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [v0.8.4] - 2024-10-16
11+
1012
### Added
1113

1214
- Support for collection search via `CollectionSearch` class and associated client methods [#735](https://github.com/stac-utils/pystac-client/pull/735)
@@ -393,7 +395,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
393395

394396
Initial release.
395397

396-
[Unreleased]: https://github.com/stac-utils/pystac-client/compare/v0.8.3...main
398+
[Unreleased]: https://github.com/stac-utils/pystac-client/compare/v0.8.4...main
399+
[v0.8.4]: https://github.com/stac-utils/pystac-client/compare/v0.8.3...v0.8.4
397400
[v0.8.3]: https://github.com/stac-utils/pystac-client/compare/v0.8.2...v0.8.3
398401
[v0.8.2]: https://github.com/stac-utils/pystac-client/compare/v0.8.1...v0.8.2
399402
[v0.8.1]: https://github.com/stac-utils/pystac-client/compare/v0.8.0...v0.8.1

docs/tutorials/aoi-coverage.ipynb

+20-14
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@
1717
"metadata": {},
1818
"outputs": [],
1919
"source": [
20-
"from pystac_client import Client\n",
20+
"from typing import Any, Dict\n",
2121
"\n",
2222
"import matplotlib.pyplot as plt\n",
23-
"from shapely.geometry import shape\n",
24-
"from pystac_client import Client\n",
2523
"from pystac.item import Item\n",
26-
"from typing import Dict, Any"
24+
"from shapely.geometry import shape\n",
25+
"\n",
26+
"from pystac_client import Client"
2727
]
2828
},
2929
{
@@ -34,9 +34,9 @@
3434
"outputs": [],
3535
"source": [
3636
"def intersection_percent(item: Item, aoi: Dict[str, Any]) -> float:\n",
37-
" '''The percentage that the Item's geometry intersects the AOI. An Item that\n",
37+
" \"\"\"The percentage that the Item's geometry intersects the AOI. An Item that\n",
3838
" completely covers the AOI has a value of 100.\n",
39-
" '''\n",
39+
" \"\"\"\n",
4040
" geom_item = shape(item.geometry)\n",
4141
" geom_aoi = shape(aoi)\n",
4242
"\n",
@@ -48,7 +48,7 @@
4848
"\n",
4949
"\n",
5050
"# STAC API root URL\n",
51-
"URL = 'https://planetarycomputer.microsoft.com/api/stac/v1'\n",
51+
"URL = \"https://planetarycomputer.microsoft.com/api/stac/v1\"\n",
5252
"\n",
5353
"# geometry of the AOI to search over\n",
5454
"intersects_geometry = {\n",
@@ -79,7 +79,12 @@
7979
"metadata": {},
8080
"outputs": [],
8181
"source": [
82-
"print([f\"{intersection_percent(item, intersects_geometry):.2f}\" for item in item_search.items()])"
82+
"print(\n",
83+
" [\n",
84+
" f\"{intersection_percent(item, intersects_geometry):.2f}\"\n",
85+
" for item in item_search.items()\n",
86+
" ]\n",
87+
")"
8388
]
8489
},
8590
{
@@ -105,19 +110,20 @@
105110
"# Render the AOI and Item results\n",
106111
"# The green shape is the AOI\n",
107112
"# The blue shapes are the Item geometries\n",
108-
"# If there are no blue shapes, adjust the intersection percent filter above until there are\n",
113+
"# If there are no blue shapes, adjust the intersection percent filter above\n",
114+
"# until there are\n",
109115
"\n",
110-
"cm = plt.get_cmap('RdBu')\n",
116+
"cm = plt.get_cmap(\"RdBu\")\n",
111117
"fig, axs = plt.subplots()\n",
112-
"axs.set_aspect('equal', 'datalim')\n",
118+
"axs.set_aspect(\"equal\", \"datalim\")\n",
113119
"\n",
114120
"for item in items_gt_5_percent:\n",
115-
" xs, ys = shape(item.geometry).exterior.xy\n",
116-
" axs.fill(xs, ys, alpha=0.5, fc='b', ec='none')\n",
121+
" xs, ys = shape(item.geometry).exterior.xy\n",
122+
" axs.fill(xs, ys, alpha=0.5, fc=\"b\", ec=\"none\")\n",
117123
"\n",
118124
"geom_intersects = shape(intersects_geometry)\n",
119125
"xs, ys = geom_intersects.exterior.xy\n",
120-
"axs.fill(xs, ys, alpha=0.5, fc='g', ec='none')\n",
126+
"axs.fill(xs, ys, alpha=0.5, fc=\"g\", ec=\"none\")\n",
121127
"\n",
122128
"plt.show()"
123129
]

docs/tutorials/cql2-filter.ipynb

+34-56
Original file line numberDiff line numberDiff line change
@@ -20,32 +20,33 @@
2020
"metadata": {},
2121
"outputs": [],
2222
"source": [
23-
"from pystac_client import Client\n",
24-
"\n",
2523
"# set pystac_client logger to DEBUG to see API calls\n",
2624
"import logging\n",
27-
"logging.basicConfig()\n",
28-
"logger = logging.getLogger('pystac_client')\n",
29-
"logger.setLevel(logging.INFO)\n",
30-
"\n",
31-
"# function for creating GeoDataFrame from Items\n",
3225
"from copy import deepcopy\n",
26+
"\n",
3327
"import geopandas as gpd\n",
3428
"import pandas as pd\n",
3529
"from shapely.geometry import shape\n",
3630
"\n",
31+
"from pystac_client import Client\n",
32+
"\n",
33+
"logging.basicConfig()\n",
34+
"logger = logging.getLogger(\"pystac_client\")\n",
35+
"logger.setLevel(logging.INFO)\n",
36+
"\n",
37+
"\n",
3738
"# convert a list of STAC Items into a GeoDataFrame\n",
3839
"def items_to_geodataframe(items):\n",
3940
" _items = []\n",
4041
" for i in items:\n",
4142
" _i = deepcopy(i)\n",
42-
" _i['geometry'] = shape(_i['geometry'])\n",
43+
" _i[\"geometry\"] = shape(_i[\"geometry\"])\n",
4344
" _items.append(_i)\n",
4445
" gdf = gpd.GeoDataFrame(pd.json_normalize(_items))\n",
45-
" for field in ['properties.datetime', 'properties.created', 'properties.updated']:\n",
46+
" for field in [\"properties.datetime\", \"properties.created\", \"properties.updated\"]:\n",
4647
" if field in gdf:\n",
4748
" gdf[field] = pd.to_datetime(gdf[field])\n",
48-
" gdf.set_index('properties.datetime', inplace=True)\n",
49+
" gdf.set_index(\"properties.datetime\", inplace=True)\n",
4950
" return gdf"
5051
]
5152
},
@@ -57,7 +58,7 @@
5758
"outputs": [],
5859
"source": [
5960
"# STAC API root URL\n",
60-
"URL = 'https://planetarycomputer.microsoft.com/api/stac/v1'\n",
61+
"URL = \"https://planetarycomputer.microsoft.com/api/stac/v1\"\n",
6162
"\n",
6263
"# custom headers\n",
6364
"headers = []\n",
@@ -82,33 +83,22 @@
8283
"metadata": {},
8384
"outputs": [],
8485
"source": [
86+
"import json\n",
87+
"\n",
88+
"import hvplot.pandas # noqa: F401\n",
89+
"\n",
8590
"# AOI around Delfzijl, in the north of The Netherlands\n",
8691
"geom = {\n",
8792
" \"type\": \"Polygon\",\n",
8893
" \"coordinates\": [\n",
89-
" [\n",
90-
" [\n",
91-
" 6.42425537109375,\n",
92-
" 53.174765470134616\n",
93-
" ],\n",
94-
" [\n",
95-
" 7.344360351562499,\n",
96-
" 53.174765470134616\n",
97-
" ],\n",
98-
" [\n",
99-
" 7.344360351562499,\n",
100-
" 53.67393435835391\n",
101-
" ],\n",
102-
" [\n",
103-
" 6.42425537109375,\n",
104-
" 53.67393435835391\n",
105-
" ],\n",
10694
" [\n",
107-
" 6.42425537109375,\n",
108-
" 53.174765470134616\n",
95+
" [6.42425537109375, 53.174765470134616],\n",
96+
" [7.344360351562499, 53.174765470134616],\n",
97+
" [7.344360351562499, 53.67393435835391],\n",
98+
" [6.42425537109375, 53.67393435835391],\n",
99+
" [6.42425537109375, 53.174765470134616],\n",
109100
" ]\n",
110-
" ]\n",
111-
" ]\n",
101+
" ],\n",
112102
"}\n",
113103
"\n",
114104
"params = {\n",
@@ -118,20 +108,20 @@
118108
" \"datetime\": \"2018-01-01/2020-12-31\",\n",
119109
"}\n",
120110
"\n",
121-
"import hvplot.pandas\n",
122-
"import json\n",
123111
"\n",
124112
"# reusable search function\n",
125113
"def search_fetch_plot(params, filt):\n",
126114
" # limit sets the # of items per page so we can see multiple pages getting fetched\n",
127-
" params['filter'] = filt\n",
115+
" params[\"filter\"] = filt\n",
128116
" search = cat.search(**params)\n",
129-
" items = list(search.items_as_dicts()) # safe b/c we set max_items = 100\n",
117+
" items = list(search.items_as_dicts()) # safe b/c we set max_items = 100\n",
130118
" # DataFrame\n",
131119
" items_df = pd.DataFrame(items_to_geodataframe(items))\n",
132120
" print(f\"{len(items_df.index)} items found\")\n",
133-
" field = 'properties.eo:cloud_cover'\n",
134-
" return items_df.hvplot(y=field, label=json.dumps(filt), frame_height=500, frame_width=800) "
121+
" field = \"properties.eo:cloud_cover\"\n",
122+
" return items_df.hvplot(\n",
123+
" y=field, label=json.dumps(filt), frame_height=500, frame_width=800\n",
124+
" )"
135125
]
136126
},
137127
{
@@ -151,10 +141,7 @@
151141
"metadata": {},
152142
"outputs": [],
153143
"source": [
154-
"filt = {\n",
155-
" \"op\": \"lte\",\n",
156-
" \"args\": [{\"property\": \"eo:cloud_cover\"}, 10]\n",
157-
"}\n",
144+
"filt = {\"op\": \"lte\", \"args\": [{\"property\": \"eo:cloud_cover\"}, 10]}\n",
158145
"\n",
159146
"search_fetch_plot(params, filt)"
160147
]
@@ -166,10 +153,7 @@
166153
"metadata": {},
167154
"outputs": [],
168155
"source": [
169-
"filt = {\n",
170-
" \"op\": \"gte\",\n",
171-
" \"args\" : [{\"property\": \"eo:cloud_cover\"}, 80]\n",
172-
"}\n",
156+
"filt = {\"op\": \"gte\", \"args\": [{\"property\": \"eo:cloud_cover\"}, 80]}\n",
173157
"\n",
174158
"search_fetch_plot(params, filt)"
175159
]
@@ -181,18 +165,12 @@
181165
"metadata": {},
182166
"outputs": [],
183167
"source": [
184-
"filt = { \n",
168+
"filt = {\n",
185169
" \"op\": \"and\",\n",
186170
" \"args\": [\n",
187-
" { \n",
188-
" \"op\":\"lte\", \n",
189-
" \"args\": [{\"property\": \"eo:cloud_cover\"}, 60]\n",
190-
" },\n",
191-
" { \n",
192-
" \"op\": \"gte\", \n",
193-
" \"args\": [{\"property\": \"eo:cloud_cover\"}, 40]\n",
194-
" }\n",
195-
" ]\n",
171+
" {\"op\": \"lte\", \"args\": [{\"property\": \"eo:cloud_cover\"}, 60]},\n",
172+
" {\"op\": \"gte\", \"args\": [{\"property\": \"eo:cloud_cover\"}, 40]},\n",
173+
" ],\n",
196174
"}\n",
197175
"\n",
198176
"search_fetch_plot(params, filt)"

0 commit comments

Comments
 (0)