Skip to content

Commit 222072b

Browse files
committed
Merge branch 'development' of github.com:ICESat2-SlideRule/sliderule-python into development
2 parents 16c0bfa + 806241c commit 222072b

19 files changed

Lines changed: 522 additions & 392 deletions

environment.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ dependencies:
1717
- pip
1818
- pyproj
1919
- pytables
20-
- python=3.8
20+
- pytest
21+
- python
2122
- requests
2223
- scikit-learn
2324
- scipy

examples/api_widgets_demo.ipynb

Lines changed: 63 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,10 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"# SlideRule API: Interactive Widget\n",
7+
"## IPython Widgets Example\n",
88
"\n",
9-
"SlideRule is an on-demand science data processing service that runs in on Amazon Web Services and responds to REST API calls to process and return science results. SlideRule was designed to enable researchers and other data systems to have low-latency access to custom-generated, high-level, analysis-ready data products using processing parameters supplied at the time of the request. \n",
10-
"\n",
11-
"The SlideRule ICESat-2 plug-in is a cloud-optimized version of the [ATL06 algorithm](https://nsidc.org/sites/nsidc.org/files/technical-references/ICESat2_ATL06_ATBD_r005.pdf) that can process the lower-level [ATL03 geolocated photon height data products](https://nsidc.org/data/atl03) hosted on AWS by the NSIDC DAAC. \n",
12-
"\n",
13-
"[Documentation for using SlideRule](https://slideruleearth.io/rtd) is available from the [project website](https://slideruleearth.io) \n",
14-
"\n",
15-
"### Background\n",
16-
"SlideRule creates a simplified version of the [ICESat-2 ATL06 land ice height product](https://nsidc.org/data/atl06) that can be adjusted to suit different needs. SlideRule let's you create customized ICESat-2 segment heights _directly_ from the photon height data anywhere on the globe, _on-demand_ and quickly.\n",
17-
"\n",
18-
"### Jupyter and SlideRule\n",
19-
"[Jupyter widgets](https://ipywidgets.readthedocs.io) are used to set parameters for the SlideRule API. \n",
20-
"\n",
21-
"Regions of interest for submitting to SlideRule are drawn on a [ipyleaflet](https://ipyleaflet.readthedocs.io) map. \n",
22-
"The results from SlideRule can be displayed on the interactive [ipyleaflet](https://ipyleaflet.readthedocs.io) map along with additional contextual layers."
9+
"### Purpose\n",
10+
"Demonstrate common uses of the `ipysliderule` module"
2311
]
2412
},
2513
{
@@ -32,10 +20,12 @@
3220
{
3321
"cell_type": "code",
3422
"execution_count": null,
35-
"metadata": {},
23+
"metadata": {
24+
"tags": []
25+
},
3626
"outputs": [],
3727
"source": [
38-
"from sliderule import icesat2, ipysliderule, io\n",
28+
"from sliderule import icesat2, ipysliderule, io, sliderule\n",
3929
"import ipywidgets as widgets\n",
4030
"import logging\n",
4131
"import warnings\n",
@@ -58,7 +48,9 @@
5848
{
5949
"cell_type": "code",
6050
"execution_count": null,
61-
"metadata": {},
51+
"metadata": {
52+
"tags": []
53+
},
6254
"outputs": [],
6355
"source": [
6456
"# set the url for the sliderule service\n",
@@ -84,7 +76,9 @@
8476
{
8577
"cell_type": "code",
8678
"execution_count": null,
87-
"metadata": {},
79+
"metadata": {
80+
"tags": []
81+
},
8882
"outputs": [],
8983
"source": [
9084
"# display widgets for setting SlideRule parameters\n",
@@ -165,7 +159,9 @@
165159
{
166160
"cell_type": "code",
167161
"execution_count": null,
168-
"metadata": {},
162+
"metadata": {
163+
"tags": []
164+
},
169165
"outputs": [],
170166
"source": [
171167
"widgets.VBox([\n",
@@ -188,7 +184,9 @@
188184
{
189185
"cell_type": "code",
190186
"execution_count": null,
191-
"metadata": {},
187+
"metadata": {
188+
"tags": []
189+
},
192190
"outputs": [],
193191
"source": [
194192
"# create ipyleaflet map in specified projection\n",
@@ -201,7 +199,9 @@
201199
{
202200
"cell_type": "code",
203201
"execution_count": null,
204-
"metadata": {},
202+
"metadata": {
203+
"tags": []
204+
},
205205
"outputs": [],
206206
"source": [
207207
"m.add_layer(\n",
@@ -226,7 +226,9 @@
226226
{
227227
"cell_type": "code",
228228
"execution_count": null,
229-
"metadata": {},
229+
"metadata": {
230+
"tags": []
231+
},
230232
"outputs": [],
231233
"source": [
232234
"%%time\n",
@@ -237,7 +239,7 @@
237239
"parms = SRwidgets.build_atl06()\n",
238240
"\n",
239241
"# create an empty geodataframe\n",
240-
"gdf = icesat2.emptyframe()\n",
242+
"gdf = sliderule.emptyframe()\n",
241243
"\n",
242244
"# for each region of interest\n",
243245
"for poly in m.regions:\n",
@@ -261,7 +263,9 @@
261263
{
262264
"cell_type": "code",
263265
"execution_count": null,
264-
"metadata": {},
266+
"metadata": {
267+
"tags": []
268+
},
265269
"outputs": [],
266270
"source": [
267271
"print(f'Returned {gdf.shape[0]} records')\n",
@@ -282,7 +286,9 @@
282286
{
283287
"cell_type": "code",
284288
"execution_count": null,
285-
"metadata": {},
289+
"metadata": {
290+
"tags": []
291+
},
286292
"outputs": [],
287293
"source": [
288294
"widgets.VBox([\n",
@@ -295,7 +301,9 @@
295301
{
296302
"cell_type": "code",
297303
"execution_count": null,
298-
"metadata": {},
304+
"metadata": {
305+
"tags": []
306+
},
299307
"outputs": [],
300308
"source": [
301309
"%matplotlib inline\n",
@@ -320,7 +328,9 @@
320328
{
321329
"cell_type": "code",
322330
"execution_count": null,
323-
"metadata": {},
331+
"metadata": {
332+
"tags": []
333+
},
324334
"outputs": [],
325335
"source": [
326336
"widgets.VBox([\n",
@@ -334,7 +344,9 @@
334344
{
335345
"cell_type": "code",
336346
"execution_count": null,
337-
"metadata": {},
347+
"metadata": {
348+
"tags": []
349+
},
338350
"outputs": [],
339351
"source": [
340352
"%matplotlib widget\n",
@@ -345,7 +357,9 @@
345357
},
346358
{
347359
"cell_type": "markdown",
348-
"metadata": {},
360+
"metadata": {
361+
"tags": []
362+
},
349363
"source": [
350364
"### Save GeoDataFrame to output file\n",
351365
"- [pytables HDF5](https://www.pytables.org/): easily read back as a Geopandas GeoDataFrame\n",
@@ -355,7 +369,9 @@
355369
{
356370
"cell_type": "code",
357371
"execution_count": null,
358-
"metadata": {},
372+
"metadata": {
373+
"tags": []
374+
},
359375
"outputs": [],
360376
"source": [
361377
"display(SRwidgets.filesaver)"
@@ -364,7 +380,9 @@
364380
{
365381
"cell_type": "code",
366382
"execution_count": null,
367-
"metadata": {},
383+
"metadata": {
384+
"tags": []
385+
},
368386
"outputs": [],
369387
"source": [
370388
"# append sliderule api version to attributes\n",
@@ -392,7 +410,9 @@
392410
{
393411
"cell_type": "code",
394412
"execution_count": null,
395-
"metadata": {},
413+
"metadata": {
414+
"tags": []
415+
},
396416
"outputs": [],
397417
"source": [
398418
"display(SRwidgets.fileloader)"
@@ -401,7 +421,9 @@
401421
{
402422
"cell_type": "code",
403423
"execution_count": null,
404-
"metadata": {},
424+
"metadata": {
425+
"tags": []
426+
},
405427
"outputs": [],
406428
"source": [
407429
"# read from file in format (HDF5 or netCDF)\n",
@@ -422,7 +444,9 @@
422444
{
423445
"cell_type": "code",
424446
"execution_count": null,
425-
"metadata": {},
447+
"metadata": {
448+
"tags": []
449+
},
426450
"outputs": [],
427451
"source": [
428452
"gdf.head()"
@@ -438,7 +462,9 @@
438462
{
439463
"cell_type": "code",
440464
"execution_count": null,
441-
"metadata": {},
465+
"metadata": {
466+
"tags": []
467+
},
442468
"outputs": [],
443469
"source": [
444470
"SRwidgets.set_values(parms)\n",
@@ -472,7 +498,7 @@
472498
"name": "python",
473499
"nbconvert_exporter": "python",
474500
"pygments_lexer": "ipython3",
475-
"version": "3.8.13"
501+
"version": "3.11.0"
476502
}
477503
},
478504
"nbformat": 4,

0 commit comments

Comments
 (0)