Skip to content

Commit d4c2278

Browse files
committed
Update binder
1 parent e3df611 commit d4c2278

File tree

4 files changed

+36
-77
lines changed

4 files changed

+36
-77
lines changed

binder/environment.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,4 @@ dependencies:
88
- dask
99
- rasterio=1.2.6
1010
- jupyterlab=3
11-
- xarray_leaflet
12-
- pip
13-
- pip:
14-
- ipyurl=0.1.2
11+
- xarray_leaflet=0.1.15

binder/postBuild

Lines changed: 0 additions & 1 deletion
This file was deleted.

examples/custom_projection.ipynb

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"from xarray_leaflet.transform import passthrough\n",
3232
"import matplotlib.pyplot as plt\n",
3333
"from matplotlib.colors import ListedColormap\n",
34-
"from ipyleaflet import Map, basemaps, projections\n",
35-
"from ipywidgets import Output"
34+
"from ipyleaflet import Map, basemaps, projections"
3635
]
3736
},
3837
{
@@ -104,9 +103,7 @@
104103
{
105104
"cell_type": "code",
106105
"execution_count": null,
107-
"metadata": {
108-
"scrolled": false
109-
},
106+
"metadata": {},
110107
"outputs": [],
111108
"source": [
112109
"m = Map(center=(64.47601699176504, -40.652543092440325),\n",
@@ -117,16 +114,6 @@
117114
"m"
118115
]
119116
},
120-
{
121-
"cell_type": "code",
122-
"execution_count": null,
123-
"metadata": {},
124-
"outputs": [],
125-
"source": [
126-
"debug_output = Output()\n",
127-
"debug_output"
128-
]
129-
},
130117
{
131118
"cell_type": "code",
132119
"execution_count": null,
@@ -135,14 +122,14 @@
135122
},
136123
"outputs": [],
137124
"source": [
138-
"l = da.leaflet.plot(m, transform2=passthrough, colormap=cmap, fit_bounds=False, debug_output=debug_output)\n",
125+
"l = da.leaflet.plot(m, transform2=passthrough, colormap=cmap, fit_bounds=False)\n",
139126
"l.interact(opacity=(0.0,1.0,0.1))"
140127
]
141128
}
142129
],
143130
"metadata": {
144131
"kernelspec": {
145-
"display_name": "Python 3",
132+
"display_name": "Python 3 (ipykernel)",
146133
"language": "python",
147134
"name": "python3"
148135
},
@@ -156,7 +143,7 @@
156143
"name": "python",
157144
"nbconvert_exporter": "python",
158145
"pygments_lexer": "ipython3",
159-
"version": "3.8.6"
146+
"version": "3.9.6"
160147
}
161148
},
162149
"nbformat": 4,

examples/dynamic.ipynb

Lines changed: 30 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,7 @@
3535
"import xarray_leaflet\n",
3636
"from rasterio.warp import Resampling\n",
3737
"from xarray_leaflet.transform import passthrough, normalize\n",
38-
"from ipyleaflet import Map, basemaps\n",
39-
"from ipywidgets import Output"
38+
"from ipyleaflet import Map, basemaps"
4039
]
4140
},
4241
{
@@ -159,38 +158,28 @@
159158
"The third transformation applies to the data contained in each Leaflet tile before reprojection. Reprojection needs your data to fit into memory, so you may want to downsample your data and keep approximately the same number of points as there are in a tile (256 x 256). The default transformation for this stage does just that, but we will change it a little bit so that the aggregation function is not `mean` but `max`. We also downsample our data but it is very specific to this dataset."
160159
]
161160
},
162-
{
163-
"cell_type": "code",
164-
"execution_count": null,
165-
"metadata": {},
166-
"outputs": [],
167-
"source": [
168-
"debug_output = Output()"
169-
]
170-
},
171161
{
172162
"cell_type": "code",
173163
"execution_count": null,
174164
"metadata": {},
175165
"outputs": [],
176166
"source": [
177167
"def transform2(array, *args, **kwargs):\n",
178-
" with debug_output:\n",
179-
" tile_width = kwargs['tile_width']\n",
180-
" tile_height = kwargs['tile_height']\n",
181-
" ny, nx = array.shape\n",
182-
" wx = nx // (tile_width // 2)\n",
183-
" wy = ny // (tile_height // 2)\n",
184-
" dim = {}\n",
185-
" if wx > 1:\n",
186-
" dim['x'] = wx\n",
187-
" if wy > 1:\n",
188-
" dim['y'] = wy\n",
189-
" array = array.coarsen(**dim, boundary='pad')\n",
190-
" with warnings.catch_warnings():\n",
191-
" warnings.simplefilter(\"ignore\", category=RuntimeWarning)\n",
192-
" array = xr.core.rolling.DataArrayCoarsen.max(array)\n",
193-
" return array"
168+
" tile_width = kwargs['tile_width']\n",
169+
" tile_height = kwargs['tile_height']\n",
170+
" ny, nx = array.shape\n",
171+
" wx = nx // (tile_width // 2)\n",
172+
" wy = ny // (tile_height // 2)\n",
173+
" dim = {}\n",
174+
" if wx > 1:\n",
175+
" dim['x'] = wx\n",
176+
" if wy > 1:\n",
177+
" dim['y'] = wy\n",
178+
" array = array.coarsen(**dim, boundary='pad')\n",
179+
" with warnings.catch_warnings():\n",
180+
" warnings.simplefilter(\"ignore\", category=RuntimeWarning)\n",
181+
" array = xr.core.rolling.DataArrayCoarsen.max(array)\n",
182+
" return array"
194183
]
195184
},
196185
{
@@ -207,17 +196,16 @@
207196
"outputs": [],
208197
"source": [
209198
"def transform3(array, *args, **kwargs):\n",
210-
" with debug_output:\n",
211-
" radius = 2\n",
212-
" circle = np.zeros((2*radius+1, 2*radius+1)).astype('uint8')\n",
213-
" y, x = np.ogrid[-radius:radius+1,-radius:radius+1]\n",
214-
" index = x**2 + y**2 <= radius**2\n",
215-
" circle[index] = 1\n",
216-
" with warnings.catch_warnings():\n",
217-
" warnings.simplefilter(\"ignore\", category=RuntimeWarning)\n",
218-
" array = np.sqrt(array)\n",
219-
" array = scipy.ndimage.maximum_filter(array, footprint=circle)\n",
220-
" return array"
199+
" radius = 2\n",
200+
" circle = np.zeros((2*radius+1, 2*radius+1)).astype('uint8')\n",
201+
" y, x = np.ogrid[-radius:radius+1,-radius:radius+1]\n",
202+
" index = x**2 + y**2 <= radius**2\n",
203+
" circle[index] = 1\n",
204+
" with warnings.catch_warnings():\n",
205+
" warnings.simplefilter(\"ignore\", category=RuntimeWarning)\n",
206+
" array = np.sqrt(array)\n",
207+
" array = scipy.ndimage.maximum_filter(array, footprint=circle)\n",
208+
" return array"
221209
]
222210
},
223211
{
@@ -230,9 +218,7 @@
230218
{
231219
"cell_type": "code",
232220
"execution_count": null,
233-
"metadata": {
234-
"scrolled": false
235-
},
221+
"metadata": {},
236222
"outputs": [],
237223
"source": [
238224
"m = Map(center=[-20, -60], zoom=3, basemap=basemaps.CartoDB.DarkMatter, interpolation='nearest')\n",
@@ -246,15 +232,6 @@
246232
"To show our data on the map, we call `leaflet.plot()` on our `DataArray`, and pass as parameters the map, the transformation functions, the `dynamic` value, and the resampling method for the reprojection."
247233
]
248234
},
249-
{
250-
"cell_type": "code",
251-
"execution_count": null,
252-
"metadata": {},
253-
"outputs": [],
254-
"source": [
255-
"debug_output"
256-
]
257-
},
258235
{
259236
"cell_type": "code",
260237
"execution_count": null,
@@ -270,8 +247,7 @@
270247
" transform3=transform3,\n",
271248
" colormap=plt.cm.inferno,\n",
272249
" dynamic=dynamic,\n",
273-
" resampling=Resampling.max,\n",
274-
" debug_output=debug_output)\n",
250+
" resampling=Resampling.max)\n",
275251
"l.interact(opacity=(0.0,1.0,0.1))"
276252
]
277253
},
@@ -285,7 +261,7 @@
285261
],
286262
"metadata": {
287263
"kernelspec": {
288-
"display_name": "Python 3",
264+
"display_name": "Python 3 (ipykernel)",
289265
"language": "python",
290266
"name": "python3"
291267
},
@@ -299,7 +275,7 @@
299275
"name": "python",
300276
"nbconvert_exporter": "python",
301277
"pygments_lexer": "ipython3",
302-
"version": "3.8.6"
278+
"version": "3.9.6"
303279
}
304280
},
305281
"nbformat": 4,

0 commit comments

Comments
 (0)