Skip to content

Commit 1434fef

Browse files
rajeejaphilipc2
andauthored
Reduce Import TIme (#1265)
* o Found one major one - moving imports inside of functions, this was at the top of the list that was taking most time. Need to Apply This Pattern Broadly * o More targetted changes. Move Imports Into Functions * update import ordering, reduce import time * fix backend * update notebooks * update notebooks * keep hvplot outside --------- Co-authored-by: Philip Chmielowiec <[email protected]> Co-authored-by: Philip Chmielowiec <[email protected]>
1 parent 037ff98 commit 1434fef

22 files changed

+276
-3472
lines changed

docs/user-guide/data-structures.ipynb

Lines changed: 81 additions & 90 deletions
Large diffs are not rendered by default.

docs/user-guide/dual-mesh.ipynb

Lines changed: 48 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,8 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": null,
2625
"id": "4fd7d3b3-5186-4157-841e-1b4c9f38bb62",
27-
"metadata": {
28-
"ExecuteTime": {
29-
"start_time": "2024-10-09T20:06:48.348972Z"
30-
},
31-
"jupyter": {
32-
"is_executing": true
33-
}
34-
},
35-
"outputs": [],
26+
"metadata": {},
3627
"source": [
3728
"import warnings\n",
3829
"\n",
@@ -41,19 +32,21 @@
4132
"import uxarray as ux\n",
4233
"\n",
4334
"warnings.filterwarnings(\"ignore\")"
44-
]
35+
],
36+
"outputs": [],
37+
"execution_count": null
4538
},
4639
{
4740
"cell_type": "code",
48-
"execution_count": null,
4941
"id": "1eebd05d-506e-4227-aa8e-f1212aae30f2",
5042
"metadata": {},
51-
"outputs": [],
5243
"source": [
5344
"file = \"../../test/meshfiles/mpas/QU/mesh.QU.1920km.151026.nc\"\n",
5445
"\n",
5546
"uxds = ux.open_dataset(file, file)"
56-
]
47+
],
48+
"outputs": [],
49+
"execution_count": null
5750
},
5851
{
5952
"cell_type": "markdown",
@@ -73,49 +66,49 @@
7366
},
7467
{
7568
"cell_type": "code",
76-
"execution_count": null,
7769
"id": "6486e0e4-1908-4363-8196-2efa9e521e56",
7870
"metadata": {},
79-
"outputs": [],
8071
"source": [
8172
"grid = uxds.uxgrid"
82-
]
73+
],
74+
"outputs": [],
75+
"execution_count": null
8376
},
8477
{
8578
"cell_type": "code",
86-
"execution_count": null,
8779
"id": "925a82d6-2947-4b15-a3ff-0b0612bc5ba0",
8880
"metadata": {},
89-
"outputs": [],
9081
"source": [
9182
"dual = grid.get_dual()"
92-
]
83+
],
84+
"outputs": [],
85+
"execution_count": null
9386
},
9487
{
9588
"cell_type": "code",
96-
"execution_count": null,
9789
"id": "12e9a8a5-526f-4b30-9a0b-de2d6d809f1d",
9890
"metadata": {},
99-
"outputs": [],
10091
"source": [
10192
"(\n",
10293
" grid.plot(title=\"Primal Grid\", backend=\"bokeh\", projection=ccrs.Orthographic())\n",
10394
" + dual.plot(title=\"Dual Grid\", backend=\"bokeh\", projection=ccrs.Orthographic())\n",
10495
")"
105-
]
96+
],
97+
"outputs": [],
98+
"execution_count": null
10699
},
107100
{
108101
"cell_type": "code",
109-
"execution_count": null,
110102
"id": "550be213-245f-4c2e-8a59-c18b36d58e0f",
111103
"metadata": {},
112-
"outputs": [],
113104
"source": [
114105
"(\n",
115106
" grid.plot(backend=\"bokeh\", projection=ccrs.Orthographic(), color=\"red\")\n",
116107
" * dual.plot(backend=\"bokeh\", projection=ccrs.Orthographic(), color=\"blue\")\n",
117108
").opts(title=\"Primal (Red) & Dual (Blue) Grids\")"
118-
]
109+
],
110+
"outputs": [],
111+
"execution_count": null
119112
},
120113
{
121114
"cell_type": "markdown",
@@ -155,38 +148,38 @@
155148
},
156149
{
157150
"cell_type": "code",
158-
"execution_count": null,
159151
"id": "75e86af7-de9c-4013-91f6-9fd9e9c0c3ad",
160152
"metadata": {},
161-
"outputs": [],
162153
"source": [
163154
"uxds_dual_face = uxds[\"latCell\"].get_dual()"
164-
]
155+
],
156+
"outputs": [],
157+
"execution_count": null
165158
},
166159
{
167160
"cell_type": "code",
168-
"execution_count": null,
169161
"id": "ff1407d4-910e-4b89-a6eb-6c4fbed9488a",
170162
"metadata": {},
171-
"outputs": [],
172163
"source": [
173164
"(\n",
174165
" uxds[\"latCell\"].plot.polygons(\n",
175166
" rasterize=True,\n",
176167
" backend=\"matplotlib\",\n",
177168
" title=\"Face centered data on Primal Mesh\",\n",
178-
" cmap=ux.cmaps.sequential_green_blue,\n",
169+
" cmap=\"Blues\",\n",
179170
" projection=ccrs.Orthographic(),\n",
180171
" )\n",
181172
" + uxds_dual_face.topological_mean(destination=\"face\").plot.polygons(\n",
182173
" rasterize=True,\n",
183174
" backend=\"matplotlib\",\n",
184175
" title=\"Node Centered Data on Dual Mesh\",\n",
185-
" cmap=ux.cmaps.sequential_green_blue,\n",
176+
" cmap=\"Blues\",\n",
186177
" projection=ccrs.Orthographic(),\n",
187178
" )\n",
188179
").cols(1).opts(fig_size=125)"
189-
]
180+
],
181+
"outputs": [],
182+
"execution_count": null
190183
},
191184
{
192185
"cell_type": "markdown",
@@ -206,20 +199,18 @@
206199
},
207200
{
208201
"cell_type": "code",
209-
"execution_count": null,
210202
"id": "c68473ae-dac6-422e-b322-71cfbfe3f876",
211203
"metadata": {},
212-
"outputs": [],
213204
"source": [
214205
"uxds_dual_node = uxds[\"latVertex\"].get_dual()"
215-
]
206+
],
207+
"outputs": [],
208+
"execution_count": null
216209
},
217210
{
218211
"cell_type": "code",
219-
"execution_count": null,
220212
"id": "1cec4e98-d35f-41cc-b3a2-b2bcf1db2094",
221213
"metadata": {},
222-
"outputs": [],
223214
"source": [
224215
"(\n",
225216
" uxds[\"latVertex\"]\n",
@@ -228,18 +219,20 @@
228219
" rasterize=True,\n",
229220
" backend=\"matplotlib\",\n",
230221
" title=\"Face centered data on Primal Mesh\",\n",
231-
" cmap=ux.cmaps.sequential_green_blue,\n",
222+
" cmap=\"Blues\",\n",
232223
" projection=ccrs.Orthographic(),\n",
233224
" )\n",
234225
" + uxds_dual_node.plot.polygons(\n",
235226
" rasterize=True,\n",
236227
" backend=\"matplotlib\",\n",
237228
" title=\"Node Centered Data on Dual Mesh\",\n",
238-
" cmap=ux.cmaps.sequential_green_blue,\n",
229+
" cmap=\"Blues\",\n",
239230
" projection=ccrs.Orthographic(),\n",
240231
" )\n",
241232
").cols(1).opts(fig_size=125)"
242-
]
233+
],
234+
"outputs": [],
235+
"execution_count": null
243236
},
244237
{
245238
"cell_type": "markdown",
@@ -275,13 +268,13 @@
275268
},
276269
{
277270
"cell_type": "code",
278-
"execution_count": null,
279271
"id": "97a884d0-5966-4bfc-b505-ceb3c37c4b47",
280272
"metadata": {},
281-
"outputs": [],
282273
"source": [
283274
"uxds"
284-
]
275+
],
276+
"outputs": [],
277+
"execution_count": null
285278
},
286279
{
287280
"cell_type": "markdown",
@@ -293,23 +286,23 @@
293286
},
294287
{
295288
"cell_type": "code",
296-
"execution_count": null,
297289
"id": "9c14a1bd-d06a-4ccb-92a5-9054e063e740",
298290
"metadata": {},
299-
"outputs": [],
300291
"source": [
301292
"uxds_dual = uxds.get_dual()"
302-
]
293+
],
294+
"outputs": [],
295+
"execution_count": null
303296
},
304297
{
305298
"cell_type": "code",
306-
"execution_count": null,
307299
"id": "7c039b32-03cd-4b83-b41e-dc5e06d118a0",
308300
"metadata": {},
309-
"outputs": [],
310301
"source": [
311302
"uxds_dual"
312-
]
303+
],
304+
"outputs": [],
305+
"execution_count": null
313306
},
314307
{
315308
"cell_type": "markdown",
@@ -321,19 +314,19 @@
321314
},
322315
{
323316
"cell_type": "code",
324-
"execution_count": null,
325317
"id": "85dedc57-f179-43b9-a55c-c0b469330988",
326318
"metadata": {},
327-
"outputs": [],
328319
"source": [
329320
"uxds_dual[\"latVertex\"].plot.polygons(\n",
330321
" rasterize=True,\n",
331322
" backend=\"matplotlib\",\n",
332323
" title=\"latVertex from UxDataset dual mesh\",\n",
333-
" cmap=ux.cmaps.sequential_green_blue,\n",
324+
" cmap=\"Blues\",\n",
334325
" projection=ccrs.Orthographic(),\n",
335326
").opts(fig_size=120)"
336-
]
327+
],
328+
"outputs": [],
329+
"execution_count": null
337330
}
338331
],
339332
"metadata": {

docs/user-guide/from_file.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@
222222
")\n",
223223
"\n",
224224
"chicago_relative_humidty[0].plot(\n",
225-
" cmap=ux.cmaps.sequential_blue,\n",
225+
" cmap=\"Blues\",\n",
226226
" title=\"Chicago Neighborhoods Relative Humidty\",\n",
227227
" backend=\"bokeh\",\n",
228228
")"

0 commit comments

Comments
 (0)