Skip to content

Commit

Permalink
Fixed error from contextily provider (#284)
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Augspurger authored Nov 7, 2023
1 parent 95bd38a commit 1f58ec5
Show file tree
Hide file tree
Showing 10 changed files with 1,327 additions and 388 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.11"
- uses: pre-commit/[email protected]
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
repos:
- repo: https://github.com/nbQA-dev/nbQA
rev: 0.12.0
rev: 1.7.0
hooks:
- id: nbqa-black
additional_dependencies: [black==22.3.0]
args: [--nbqa-mutate]
- id: nbqa-flake8
additional_dependencies: [flake8==3.9.2]
additional_dependencies: [flake8==6.1.0]
- repo: local
hooks:
- id: check-headers
Expand Down
21 changes: 17 additions & 4 deletions datasets/fws-nwi/fws-nwi-example.ipynb

Large diffs are not rendered by default.

73 changes: 43 additions & 30 deletions datasets/ms-buildings/ms-buildings-example.ipynb

Large diffs are not rendered by default.

286 changes: 274 additions & 12 deletions datasets/us-census/us-census-example.ipynb

Large diffs are not rendered by default.

213 changes: 120 additions & 93 deletions quickstarts/reading-stac.ipynb

Large diffs are not rendered by default.

224 changes: 116 additions & 108 deletions quickstarts/reading-tabular-data.ipynb

Large diffs are not rendered by default.

143 changes: 74 additions & 69 deletions quickstarts/stac-geoparquet.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,60 +82,60 @@
" <td>Feature</td>\n",
" <td>1.0.0</td>\n",
" <td>[https://stac-extensions.github.io/projection/...</td>\n",
" <td>05L-2017</td>\n",
" <td>12Q-2017</td>\n",
" <td>...</td>\n",
" <td>2018-01-01 00:00:00+00:00</td>\n",
" <td>[10.0, 0.0, 169260.0, 0.0, -10.0, 9115700.0]</td>\n",
" <td>[10.0, 0.0, 178910.0, 0.0, -10.0, 2657470.0]</td>\n",
" <td>2017-01-01 00:00:00+00:00</td>\n",
" <td>05L</td>\n",
" <td>12Q</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Feature</td>\n",
" <td>1.0.0</td>\n",
" <td>[https://stac-extensions.github.io/projection/...</td>\n",
" <td>05M-2017</td>\n",
" <td>15R-2017</td>\n",
" <td>...</td>\n",
" <td>2018-01-01 00:00:00+00:00</td>\n",
" <td>[10.0, 0.0, 166024.76778650173, 0.0, -10.0, 99...</td>\n",
" <td>[10.0, 0.0, 194773.70566898846, 0.0, -10.0, 35...</td>\n",
" <td>2017-01-01 00:00:00+00:00</td>\n",
" <td>05M</td>\n",
" <td>15R</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Feature</td>\n",
" <td>1.0.0</td>\n",
" <td>[https://stac-extensions.github.io/projection/...</td>\n",
" <td>05Q-2017</td>\n",
" <td>16M-2017</td>\n",
" <td>...</td>\n",
" <td>2018-01-01 00:00:00+00:00</td>\n",
" <td>[10.0, 0.0, 178900.28857004497, 0.0, -10.0, 26...</td>\n",
" <td>[10.0, 0.0, 166023.6435927535, 0.0, -10.0, 999...</td>\n",
" <td>2017-01-01 00:00:00+00:00</td>\n",
" <td>05Q</td>\n",
" <td>16M</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Feature</td>\n",
" <td>1.0.0</td>\n",
" <td>[https://stac-extensions.github.io/projection/...</td>\n",
" <td>12Q-2017</td>\n",
" <td>20L-2022</td>\n",
" <td>...</td>\n",
" <td>2018-01-01 00:00:00+00:00</td>\n",
" <td>[10.0, 0.0, 178910.0, 0.0, -10.0, 2657470.0]</td>\n",
" <td>2017-01-01 00:00:00+00:00</td>\n",
" <td>12Q</td>\n",
" <td>2023-01-01 00:00:00+00:00</td>\n",
" <td>[10.0, 0.0, 169256.89710350422, 0.0, -10.0, 91...</td>\n",
" <td>2022-01-01 00:00:00+00:00</td>\n",
" <td>20L</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Feature</td>\n",
" <td>1.0.0</td>\n",
" <td>[https://stac-extensions.github.io/projection/...</td>\n",
" <td>16M-2017</td>\n",
" <td>20M-2019</td>\n",
" <td>...</td>\n",
" <td>2018-01-01 00:00:00+00:00</td>\n",
" <td>[10.0, 0.0, 166023.6435927535, 0.0, -10.0, 999...</td>\n",
" <td>2017-01-01 00:00:00+00:00</td>\n",
" <td>16M</td>\n",
" <td>2020-01-01 00:00:00+00:00</td>\n",
" <td>[10.0, 0.0, 166023.6435927521, 0.0, -10.0, 999...</td>\n",
" <td>2019-01-01 00:00:00+00:00</td>\n",
" <td>20M</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
Expand All @@ -151,25 +151,25 @@
"4 Feature 1.0.0 [https://stac-extensions.github.io/projection/... \n",
"\n",
" id ... end_datetime \\\n",
"0 05L-2017 ... 2018-01-01 00:00:00+00:00 \n",
"1 05M-2017 ... 2018-01-01 00:00:00+00:00 \n",
"2 05Q-2017 ... 2018-01-01 00:00:00+00:00 \n",
"3 12Q-2017 ... 2018-01-01 00:00:00+00:00 \n",
"4 16M-2017 ... 2018-01-01 00:00:00+00:00 \n",
"0 12Q-2017 ... 2018-01-01 00:00:00+00:00 \n",
"1 15R-2017 ... 2018-01-01 00:00:00+00:00 \n",
"2 16M-2017 ... 2018-01-01 00:00:00+00:00 \n",
"3 20L-2022 ... 2023-01-01 00:00:00+00:00 \n",
"4 20M-2019 ... 2020-01-01 00:00:00+00:00 \n",
"\n",
" proj:transform \\\n",
"0 [10.0, 0.0, 169260.0, 0.0, -10.0, 9115700.0] \n",
"1 [10.0, 0.0, 166024.76778650173, 0.0, -10.0, 99... \n",
"2 [10.0, 0.0, 178900.28857004497, 0.0, -10.0, 26... \n",
"3 [10.0, 0.0, 178910.0, 0.0, -10.0, 2657470.0] \n",
"4 [10.0, 0.0, 166023.6435927535, 0.0, -10.0, 999... \n",
"0 [10.0, 0.0, 178910.0, 0.0, -10.0, 2657470.0] \n",
"1 [10.0, 0.0, 194773.70566898846, 0.0, -10.0, 35... \n",
"2 [10.0, 0.0, 166023.6435927535, 0.0, -10.0, 999... \n",
"3 [10.0, 0.0, 169256.89710350422, 0.0, -10.0, 91... \n",
"4 [10.0, 0.0, 166023.6435927521, 0.0, -10.0, 999... \n",
"\n",
" start_datetime io:supercell_id \n",
"0 2017-01-01 00:00:00+00:00 05L \n",
"1 2017-01-01 00:00:00+00:00 05M \n",
"2 2017-01-01 00:00:00+00:00 05Q \n",
"3 2017-01-01 00:00:00+00:00 12Q \n",
"4 2017-01-01 00:00:00+00:00 16M \n",
"0 2017-01-01 00:00:00+00:00 12Q \n",
"1 2017-01-01 00:00:00+00:00 15R \n",
"2 2017-01-01 00:00:00+00:00 16M \n",
"3 2022-01-01 00:00:00+00:00 20L \n",
"4 2019-01-01 00:00:00+00:00 20M \n",
"\n",
"[5 rows x 18 columns]"
]
Expand Down Expand Up @@ -211,18 +211,19 @@
{
"data": {
"text/plain": [
"32616 50\n",
"32719 50\n",
"32638 50\n",
"32649 50\n",
"32615 50\n",
"proj:epsg\n",
"32616 60\n",
"32638 60\n",
"32650 60\n",
"32648 60\n",
"32617 60\n",
" ..\n",
"32726 9\n",
"32710 9\n",
"32708 8\n",
"32727 5\n",
"32711 5\n",
"Name: proj:epsg, Length: 120, dtype: int64"
"32714 12\n",
"32710 11\n",
"32708 10\n",
"32711 6\n",
"32727 6\n",
"Name: count, Length: 120, dtype: int64"
]
},
"execution_count": 3,
Expand Down Expand Up @@ -264,7 +265,7 @@
"<img src=\"https://ai4edatasetspublicassets.blob.core.windows.net/assets/notebook-output/quickstarts-stac-geoparquet.ipynb/5.png\"/>"
],
"text/plain": [
"<Figure size 288x1440 with 1 Axes>"
"<Figure size 400x2000 with 1 Axes>"
]
},
"metadata": {},
Expand All @@ -275,7 +276,9 @@
"import contextily\n",
"\n",
"ax = subset.plot(figsize=(4, 20), color=\"none\", edgecolor=\"yellow\")\n",
"contextily.add_basemap(ax, crs=df.crs.to_string())\n",
"contextily.add_basemap(\n",
" ax, crs=df.crs.to_string(), source=contextily.providers.Esri.NatGeoWorldMap\n",
")\n",
"\n",
"ax.set_axis_off()"
]
Expand Down Expand Up @@ -341,11 +344,11 @@
{
"data": {
"text/plain": [
"['items/sentinel-2-l2a.parquet/part-0000_2015-06-29T10:25:31+00:00_2015-07-06T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0001_2015-07-06T10:25:31+00:00_2015-07-13T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0002_2015-07-13T10:25:31+00:00_2015-07-20T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0003_2015-07-20T10:25:31+00:00_2015-07-27T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0004_2015-07-27T10:25:31+00:00_2015-08-03T10:25:31+00:00.parquet']"
"['items/sentinel-2-l2a.parquet/part-0001_2015-06-29T10:25:31+00:00_2015-07-06T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0002_2015-07-06T10:25:31+00:00_2015-07-13T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0003_2015-07-13T10:25:31+00:00_2015-07-20T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0004_2015-07-20T10:25:31+00:00_2015-07-27T10:25:31+00:00.parquet',\n",
" 'items/sentinel-2-l2a.parquet/part-0005_2015-07-27T10:25:31+00:00_2015-08-03T10:25:31+00:00.parquet']"
]
},
"execution_count": 7,
Expand Down Expand Up @@ -796,11 +799,11 @@
{
"data": {
"text/plain": [
"0 {'data': {'file:size': 53437205, 'file:values'...\n",
"1 {'data': {'file:size': 53622304, 'file:values'...\n",
"2 {'data': {'file:size': 55015984, 'file:values'...\n",
"3 {'data': {'file:size': 53208880, 'file:values'...\n",
"4 {'data': {'file:size': 53981476, 'file:values'...\n",
"0 {'data': {'file:size': 53208880, 'file:values'...\n",
"1 {'data': {'file:size': 114187155, 'file:values...\n",
"2 {'data': {'file:size': 53981476, 'file:values'...\n",
"3 {'data': {'file:size': 165601021, 'file:values...\n",
"4 {'data': {'file:size': 97175834, 'file:values'...\n",
"Name: assets, dtype: object"
]
},
Expand Down Expand Up @@ -862,7 +865,7 @@
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>53437205</td>\n",
" <td>53208880</td>\n",
" <td>[{'summary': 'No Data', 'values': [0]}, {'summ...</td>\n",
" <td>https://ai4edataeuwest.blob.core.windows.net/i...</td>\n",
" <td>[{'nodata': 0, 'spatial_resolution': 10}]</td>\n",
Expand All @@ -874,7 +877,7 @@
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>53622304</td>\n",
" <td>114187155</td>\n",
" <td>[{'summary': 'No Data', 'values': [0]}, {'summ...</td>\n",
" <td>https://ai4edataeuwest.blob.core.windows.net/i...</td>\n",
" <td>[{'nodata': 0, 'spatial_resolution': 10}]</td>\n",
Expand All @@ -886,7 +889,7 @@
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>55015984</td>\n",
" <td>53981476</td>\n",
" <td>[{'summary': 'No Data', 'values': [0]}, {'summ...</td>\n",
" <td>https://ai4edataeuwest.blob.core.windows.net/i...</td>\n",
" <td>[{'nodata': 0, 'spatial_resolution': 10}]</td>\n",
Expand All @@ -898,7 +901,7 @@
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>53208880</td>\n",
" <td>165601021</td>\n",
" <td>[{'summary': 'No Data', 'values': [0]}, {'summ...</td>\n",
" <td>https://ai4edataeuwest.blob.core.windows.net/i...</td>\n",
" <td>[{'nodata': 0, 'spatial_resolution': 10}]</td>\n",
Expand All @@ -910,7 +913,7 @@
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>53981476</td>\n",
" <td>97175834</td>\n",
" <td>[{'summary': 'No Data', 'values': [0]}, {'summ...</td>\n",
" <td>https://ai4edataeuwest.blob.core.windows.net/i...</td>\n",
" <td>[{'nodata': 0, 'spatial_resolution': 10}]</td>\n",
Expand All @@ -927,11 +930,11 @@
],
"text/plain": [
" data.file:size data.file:values \\\n",
"0 53437205 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"1 53622304 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"2 55015984 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"3 53208880 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"4 53981476 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"0 53208880 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"1 114187155 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"2 53981476 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"3 165601021 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"4 97175834 [{'summary': 'No Data', 'values': [0]}, {'summ... \n",
"\n",
" data.href \\\n",
"0 https://ai4edataeuwest.blob.core.windows.net/i... \n",
Expand Down Expand Up @@ -1014,7 +1017,9 @@
"cell_type": "code",
"execution_count": 15,
"id": "ca1df1b1-aa63-4c0f-ae97-b6fc890ff642",
"metadata": {},
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
Expand Down Expand Up @@ -1098,7 +1103,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.13"
"version": "3.11.4"
},
"widgets": {
"application/vnd.jupyter.widget-state+json": {
Expand Down
3 changes: 2 additions & 1 deletion scripts/slim.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import sys
import nbformat
import azure.storage.blob
import azure.identity
import base64
import tempfile

Expand Down Expand Up @@ -45,7 +46,7 @@ def replace_images(nb, path, credential):
if __name__ == "__main__":
path = sys.argv[1]
print("Processing", path)
credential = os.environ["PLANETARY_COMPUTER_EXAMPLES_SAS"]
credential = azure.identity.DefaultAzureCredential()
nb = nbformat.read(path, as_version=4)
replace_images(nb, path, credential)
nbformat.write(nb, path)
Loading

0 comments on commit 1f58ec5

Please sign in to comment.