Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4e4d4e3

Browse files
Misc example updates
1 parent 918b3b5 commit 4e4d4e3

File tree

3 files changed

+24
-17
lines changed

3 files changed

+24
-17
lines changed

‎2-analysis-examples/bird-migration.ipynb‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@
146146
"metadata": {},
147147
"outputs": [],
148148
"source": [
149-
"traj_collection = mpd.TrajectoryCollection(df, 'individual-local-identifier', t='timestamp', min_length=100) \n",
150-
"traj_collection"
149+
"tc = mpd.TrajectoryCollection(df, 'individual-local-identifier', t='timestamp', min_length=100) \n",
150+
"tc"
151151
]
152152
},
153153
{
@@ -163,7 +163,7 @@
163163
"metadata": {},
164164
"outputs": [],
165165
"source": [
166-
"traj_collection = mpd.MinTimeDeltaGeneralizer(traj_collection).generalize(tolerance=timedelta(days=1))"
166+
"tc = mpd.MinTimeDeltaGeneralizer(tc).generalize(tolerance=timedelta(days=1))"
167167
]
168168
},
169169
{
@@ -186,7 +186,7 @@
186186
"metadata": {},
187187
"outputs": [],
188188
"source": [
189-
"filtered = traj_collection.filter('individual-local-identifier', '91916A')\n",
189+
"filtered = tc.filter('individual-local-identifier', '91916A')\n",
190190
"my_traj = filtered.trajectories[0].copy()\n",
191191
"my_traj.df.head()"
192192
]
@@ -375,7 +375,7 @@
375375
"outputs": [],
376376
"source": [
377377
"year_of_interest = 2010\n",
378-
"trajs_in_aoi = traj_collection.clip(area_of_interest)\n",
378+
"trajs_in_aoi = tc.clip(area_of_interest)\n",
379379
"relevant = [ traj for traj in trajs_in_aoi if traj.get_start_time().year <= year_of_interest and traj.get_end_time().year >= year_of_interest]\n",
380380
"print(\"Found {} arrivals\".format(len(relevant)))"
381381
]
@@ -407,7 +407,7 @@
407407
"metadata": {},
408408
"outputs": [],
409409
"source": [
410-
"my_traj = traj_collection.get_trajectory('91761A')\n",
410+
"my_traj = tc.get_trajectory('91761A')\n",
411411
"segment = my_traj.get_segment_between(datetime(year_of_interest,1,1), datetime(year_of_interest,12,31))\n",
412412
"\n",
413413
"segment.hvplot(color='black', line_width=1.0) * plotted_area_of_interest "
@@ -453,7 +453,7 @@
453453
"name": "python",
454454
"nbconvert_exporter": "python",
455455
"pygments_lexer": "ipython3",
456-
"version": "3.10.8"
456+
"version": "3.10.10"
457457
}
458458
},
459459
"nbformat": 4,

‎3-tech-demos/ever-given.ipynb‎ renamed to ‎2-analysis-examples/ever-given.ipynb‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"metadata": {},
8989
"outputs": [],
9090
"source": [
91-
"trajs = mpd.TrajectoryCollection(gdf, 'ID')"
91+
"tc = mpd.TrajectoryCollection(gdf, 'ID')"
9292
]
9393
},
9494
{
@@ -97,7 +97,7 @@
9797
"metadata": {},
9898
"outputs": [],
9999
"source": [
100-
"evergiven = trajs.get_trajectory(EVERID)\n",
100+
"evergiven = tc.get_trajectory(EVERID)\n",
101101
"evergiven.hvplot(line_width=7, frame_width=FSIZE, frame_height=FSIZE)"
102102
]
103103
},
@@ -107,7 +107,7 @@
107107
"metadata": {},
108108
"outputs": [],
109109
"source": [
110-
"stop_pts = mpd.TrajectoryStopDetector(trajs).get_stop_points(min_duration=timedelta(hours=3), max_diameter=1000)"
110+
"stop_pts = mpd.TrajectoryStopDetector(tc).get_stop_points(min_duration=timedelta(hours=3), max_diameter=1000)"
111111
]
112112
},
113113
{
@@ -196,7 +196,7 @@
196196
"name": "python",
197197
"nbconvert_exporter": "python",
198198
"pygments_lexer": "ipython3",
199-
"version": "3.9.15"
199+
"version": "3.10.10"
200200
},
201201
"vscode": {
202202
"interpreter": {

‎2-analysis-examples/soccer-game.ipynb‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"cells": [
33
{
4+
"attachments": {},
45
"cell_type": "markdown",
56
"metadata": {
67
"tags": []
@@ -48,6 +49,7 @@
4849
]
4950
},
5051
{
52+
"attachments": {},
5153
"cell_type": "markdown",
5254
"metadata": {},
5355
"source": [
@@ -93,6 +95,7 @@
9395
]
9496
},
9597
{
98+
"attachments": {},
9699
"cell_type": "markdown",
97100
"metadata": {},
98101
"source": [
@@ -172,13 +175,15 @@
172175
]
173176
},
174177
{
178+
"attachments": {},
175179
"cell_type": "markdown",
176180
"metadata": {},
177181
"source": [
178182
"Finally, let's create trajectories:"
179183
]
180184
},
181185
{
186+
"attachments": {},
182187
"cell_type": "markdown",
183188
"metadata": {},
184189
"source": [
@@ -193,9 +198,9 @@
193198
"source": [
194199
"%%time\n",
195200
"CRS = None\n",
196-
"traj_collection = mpd.TrajectoryCollection(df, 'player', x='x', y='y', crs=CRS)\n",
197-
"mpd.TemporalSplitter(traj_collection).split(mode=\"day\")\n",
198-
"print(f\"Finished creating {len(traj_collection)} trajectories\")"
201+
"tc = mpd.TrajectoryCollection(df, 'player', x='x', y='y', crs=CRS)\n",
202+
"mpd.TemporalSplitter(tc).split(mode=\"day\")\n",
203+
"print(f\"Finished creating {len(tc)} trajectories\")"
199204
]
200205
},
201206
{
@@ -214,10 +219,11 @@
214219
"metadata": {},
215220
"outputs": [],
216221
"source": [
217-
"plotted_pitch * traj_collection.filter('player_num', 20).hvplot(**hvplot_defaults)"
222+
"plotted_pitch * tc.filter('player_num', 20).hvplot(**hvplot_defaults)"
218223
]
219224
},
220225
{
226+
"attachments": {},
221227
"cell_type": "markdown",
222228
"metadata": {},
223229
"source": [
@@ -232,7 +238,7 @@
232238
"source": [
233239
"PLAY = 2\n",
234240
"title = f'Play {PLAY} {plays[PLAY]}'\n",
235-
"play_trajs = traj_collection.filter('play', plays[PLAY])\n",
241+
"play_trajs = tc.filter('play', plays[PLAY])\n",
236242
"play_trajs"
237243
]
238244
},
@@ -318,6 +324,7 @@
318324
]
319325
},
320326
{
327+
"attachments": {},
321328
"cell_type": "markdown",
322329
"metadata": {},
323330
"source": [
@@ -348,7 +355,7 @@
348355
"name": "python",
349356
"nbconvert_exporter": "python",
350357
"pygments_lexer": "ipython3",
351-
"version": "3.10.8"
358+
"version": "3.10.10"
352359
}
353360
},
354361
"nbformat": 4,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /