Skip to content

Commit 98e8cbd

Browse files
committed
Merge branch 'master' into ard-126
2 parents 652d15d + ed8c299 commit 98e8cbd

17 files changed

+5147
-252
lines changed

CONTRIBUTING.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,28 @@
77
Notebook filenames cannot have spaces. Use underscores instead. This is
88
because pytest does not like spaces in command line arguments.
99

10+
## Style
11+
12+
For maximum portability, accessibility, and ease of use, Notebooks in this
13+
repository should not use a custom style or theme.
14+
15+
1016
## Dependencies
1117

1218
When a new notebook has a dependency that is not yet supported by the Docker image,
1319
a new Docker image must be built. Additionally, add the new dependency to the
1420
[imports_test notebook](dev/imports_test.ipynb).
1521

16-
## Area of Interest
22+
## Planet Data
23+
24+
It is the intention of this notebook repository that a user be able to easily
25+
determine the permissions needed within the Planet ecosystem to be able to run
26+
all notebooks successfully. Therefore, we standardize and track Planet data
27+
that are used across all notebooks within this repository. Right now, this applies
28+
to Planet Imagery in the form of Areas of Interest and to Planet
29+
Analytic Feeds in the form of suscription IDs.
30+
31+
### Imagery - Area of Interest
1732

1833
The first choice of area of interest (AOI) for any notebook is an AOI that is
1934
already used in this repository. The geojson description of these AOIs is given
@@ -30,7 +45,23 @@ add the AOI to the
3045
[repository_aois notebook](dev/repository_aois.ipynb). Run that notebook
3146
through to the end to update [aois.geojson](dev/imports_test.ipynb).
3247

33-
## Skipping Validation
48+
### Analytics Feed - Subscription ID
49+
50+
The fist choice of Analytics Feed subscription id for any notebooks is a
51+
subscription ID that is already used in this repository. The subscription IDs
52+
used in this repository are maintained in the
53+
[analygics_feeds notebook](analytics_feeds.ipynb). This notebook also helpfully
54+
pulls the feed information from these subscription IDs. It is good practice
55+
to add your notebook to the list of notebooks using each subscription ID.
56+
57+
Currently, subscription IDs are not being tracked in any demo permissions program.
58+
However, this may change in the future. If the subscription ID for a notebook
59+
cannot be satisfied by the subscription IDs already in the repository, add
60+
the subscription ID to the notebook and email <[email protected]> to notify us
61+
of the change. (**NOTE**: this is likely to change to a request when demo
62+
permissions for the analytics feed are established).
63+
64+
## Notebook Validation
3465

3566
To enable validation of the Docker image, every notebook should run successfully
3667
when run from the command line. For notebooks where that just is not possible,

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ In this repository, you'll find a collection of [Jupyter notebooks](http://jupyt
2121
* [Getting Feed Results](https://github.com/planetlabs/notebooks/blob/master/jupyter-notebooks/analytics/02_fetching_feed_results.ipynb)
2222
* [Visualizing Raster Results](https://github.com/planetlabs/notebooks/blob/master/jupyter-notebooks/analytics/03_visualizing_raster_results.ipynb)
2323
* [Converting Raster Results to Vector Features](https://github.com/planetlabs/notebooks/blob/master/jupyter-notebooks/analytics-snippets/README.md)
24+
* [Creating a Heatmap of Vector Results](https://github.com/planetlabs/notebooks/blob/master/jupyter-notebooks/analytics/change_detection_heatmap.ipynb)
2425

2526
### Process Planet data
2627
* [Create a mosaic from multiple PlanetScope scenes](https://github.com/planetlabs/notebooks/blob/master/jupyter-notebooks/mosaicing/basic_compositing_demo.ipynb)

dev/analytics_feeds.ipynb

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Analytics Feeds\n",
8+
"\n",
9+
"This notebook maintains a list of analytics feeds used in this repository."
10+
]
11+
},
12+
{
13+
"cell_type": "code",
14+
"execution_count": 1,
15+
"metadata": {},
16+
"outputs": [],
17+
"source": [
18+
"subscriptions = [\n",
19+
" {\n",
20+
" 'id': '9db92275-1d89-4d3b-a0b6-68abd2e94142',\n",
21+
" 'used_by': ['analytics/02_fetching_feed_results']\n",
22+
" },\n",
23+
" {\n",
24+
" 'id': 'cda3398b-1283-4ad9-87a6-e25796b5ca80',\n",
25+
" 'used_by': ['analytics/03_visualizing_raster_results']\n",
26+
" },\n",
27+
" {\n",
28+
" 'id': '02c4f912-090f-45aa-a18b-ac4a55e4b9ba',\n",
29+
" 'used_by': ['analytics-snippets/building_footprints_as_vector']\n",
30+
" },\n",
31+
" {\n",
32+
" 'id': 'f184516c-b948-406f-b257-deaa66c3f38a',\n",
33+
" 'used_by': ['analytics-snippets/roads_as_vector']\n",
34+
" },\n",
35+
"]"
36+
]
37+
},
38+
{
39+
"cell_type": "markdown",
40+
"metadata": {},
41+
"source": [
42+
"## Get feeds from subscription ids"
43+
]
44+
},
45+
{
46+
"cell_type": "code",
47+
"execution_count": 2,
48+
"metadata": {},
49+
"outputs": [],
50+
"source": [
51+
"from pprint import pprint\n",
52+
"import os\n",
53+
"\n",
54+
"from planet import api"
55+
]
56+
},
57+
{
58+
"cell_type": "code",
59+
"execution_count": 3,
60+
"metadata": {},
61+
"outputs": [],
62+
"source": [
63+
"# if your Planet API Key is not set as an environment variable, you can paste it below\n",
64+
"API_KEY = os.environ.get('PL_API_KEY', 'PASTE_YOUR_KEY_HERE')\n",
65+
"\n",
66+
"analytics_client = api.ClientV1(api_key=API_KEY)"
67+
]
68+
},
69+
{
70+
"cell_type": "code",
71+
"execution_count": 4,
72+
"metadata": {},
73+
"outputs": [
74+
{
75+
"name": "stdout",
76+
"output_type": "stream",
77+
"text": [
78+
"['Port of Oakland, USA', 'Hefei, China', 'Sazgin, Turkey', 'Kirazli, Turkey']\n",
79+
"['1b4c9ee2-699b-4621-bb4f-934eda8090b5', '36d9d1b0-dcd4-40bc-b411-5eb8e06062a2', 'b442c53b-fc72-4bee-bab4-0b7aa318ccd9', '36d9d1b0-dcd4-40bc-b411-5eb8e06062a2']\n",
80+
"['Ship Detections', 'Roads (v7)', 'Buildings (v7)', 'Roads (v7)']\n"
81+
]
82+
}
83+
],
84+
"source": [
85+
"def get_sub_info(subscription_id):\n",
86+
" return analytics_client.get_subscription_info(subscription_id).get()\n",
87+
"\n",
88+
"def get_sub_title(subscription_id):\n",
89+
" return get_sub_info(subscription_id)['title']\n",
90+
"\n",
91+
"def get_feed_id(subscription_id):\n",
92+
" return get_sub_info(subscription_id)['feedID']\n",
93+
"\n",
94+
"def get_feed_info(feed_id):\n",
95+
" return analytics_client.get_feed_info(feed_id).get()\n",
96+
"\n",
97+
"def get_feed_title(feed_id):\n",
98+
" return get_feed_info(feed_id)['title']\n",
99+
" \n",
100+
"\n",
101+
"titles = [get_sub_title(s['id']) for s in subscriptions]\n",
102+
"print(titles)\n",
103+
"\n",
104+
"feed_ids = [get_feed_id(s['id']) for s in subscriptions]\n",
105+
"print(feed_ids)\n",
106+
"\n",
107+
"feed_titles = [get_feed_title(fid) for fid in feed_ids]\n",
108+
"print(feed_titles)"
109+
]
110+
}
111+
],
112+
"metadata": {
113+
"kernelspec": {
114+
"display_name": "Python 3",
115+
"language": "python",
116+
"name": "python3"
117+
},
118+
"language_info": {
119+
"codemirror_mode": {
120+
"name": "ipython",
121+
"version": 3
122+
},
123+
"file_extension": ".py",
124+
"mimetype": "text/x-python",
125+
"name": "python",
126+
"nbconvert_exporter": "python",
127+
"pygments_lexer": "ipython3",
128+
"version": "3.7.6"
129+
}
130+
},
131+
"nbformat": 4,
132+
"nbformat_minor": 4
133+
}

0 commit comments

Comments
 (0)