Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7ebf146

Browse files
authored
Merge pull request #113 from ICESat2-SlideRule/cmr
can query by date in CMR polygon queries notebook
2 parents aae81f0 + 40b9c39 commit 7ebf146

File tree

2 files changed

+49
-16
lines changed

2 files changed

+49
-16
lines changed

examples/cmr_debug_regions.ipynb

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
"- Creates a leaflet map for creating regions of interest\n",
1010
"- Queries CMR for granules and granule polygons\n",
1111
"- Plots granule polygons on map\n",
12-
"- Retrieves and plots granule tracks on map"
12+
"- Retrieves and plots granule tracks on map\n",
13+
"\n",
14+
"### Jupyter and SlideRule\n",
15+
"[Jupyter widgets](https://ipywidgets.readthedocs.io) are used to set parameters for the SlideRule API. \n",
16+
"\n",
17+
"Regions of interest for submitting to SlideRule are drawn on a [ipyleaflet](https://ipyleaflet.readthedocs.io) map. "
1318
]
1419
},
1520
{
@@ -49,7 +54,17 @@
4954
"cell_type": "markdown",
5055
"metadata": {},
5156
"source": [
52-
"#### Set ICESat-2 Product"
57+
"### Set ICESat-2 Product \n",
58+
"\n",
59+
"- [ATL03: Global Geolocated Photon Data](https://nsidc.org/data/atl03)\n",
60+
"- [ATL06: Land Ice Height](https://nsidc.org/data/atl06)\n",
61+
"- [ATL08: Land and Vegetation Height](https://nsidc.org/data/atl08)\n",
62+
"\n",
63+
"### Interactive Mapping with Leaflet\n",
64+
"\n",
65+
"Interactive maps within the SlideRule python API are built upon [ipyleaflet](https://ipyleaflet.readthedocs.io).\n",
66+
"\n",
67+
"There are 3 projections available within SlideRule for mapping ([Global](https://epsg.io/3857), [North](https://epsg.io/5936) and [South](https://epsg.io/3031)). "
5368
]
5469
},
5570
{
@@ -62,13 +77,16 @@
6277
"icesat2.init(\"slideruleearth.io\", loglevel=logging.WARNING)\n",
6378
"icesat2.get_version()\n",
6479
"\n",
65-
"# dropdown menu for ICESat-2 product\n",
66-
"product_select = widgets.Dropdown(\n",
67-
" options=['ATL03','ATL06','ATL08'],\n",
68-
" description='Product:',\n",
69-
" disabled=False\n",
70-
")\n",
71-
"display(product_select)"
80+
"# display widgets for setting ICESat-2 parameters\n",
81+
"# and the interactive map projection\n",
82+
"SRwidgets = ipysliderule.widgets()\n",
83+
"widgets.VBox([\n",
84+
" SRwidgets.product,\n",
85+
" SRwidgets.release,\n",
86+
" SRwidgets.start_date,\n",
87+
" SRwidgets.end_date,\n",
88+
" SRwidgets.projection\n",
89+
"])"
7290
]
7391
},
7492
{
@@ -84,8 +102,8 @@
84102
"metadata": {},
85103
"outputs": [],
86104
"source": [
87-
"# create ipyleaflet map in projection\n",
88-
"m = ipysliderule.leaflet('Global', center=(-25.3,131))\n",
105+
"# create ipyleaflet map in specified projection\n",
106+
"m = ipysliderule.leaflet(SRwidgets.projection.value)\n",
89107
"m.map"
90108
]
91109
},
@@ -102,13 +120,17 @@
102120
"metadata": {},
103121
"outputs": [],
104122
"source": [
123+
"%%time\n",
105124
"# for each region of interest\n",
106125
"granule_list = []\n",
107126
"granule_polygons = []\n",
108127
"for poly in m.regions:\n",
109128
" # polygon from map\n",
110129
" resources,polygons = icesat2.cmr(polygon=poly,\n",
111-
" short_name=product_select.value,\n",
130+
" short_name=SRwidgets.product.value,\n",
131+
" time_start=SRwidgets.time_start,\n",
132+
" time_end=SRwidgets.time_end,\n",
133+
" version=SRwidgets.release.value,\n",
112134
" return_polygons=True)\n",
113135
" granule_list.extend(resources)\n",
114136
" granule_polygons.extend(polygons)\n",
@@ -270,6 +292,7 @@
270292
"metadata": {},
271293
"outputs": [],
272294
"source": [
295+
"%%time\n",
273296
"# granule resources for selected segments\n",
274297
"perf_start = time.perf_counter()\n",
275298
"gdf = sliderule.icesat2.__emptyframe()\n",
@@ -282,9 +305,6 @@
282305
" gdf = gdf.append(future.result())\n",
283306
"\n",
284307
"# Display Statistics\n",
285-
"perf_stop = time.perf_counter()\n",
286-
"perf_duration = perf_stop - perf_start\n",
287-
"print(\"Completed in {:.3f} seconds of wall-clock time\".format(perf_duration))\n",
288308
"print(\"Reference Ground Tracks: {}\".format(gdf[\"rgt\"].unique()))\n",
289309
"print(\"Cycles: {}\".format(gdf[\"cycle\"].unique()))\n",
290310
"print(\"Received {} segments\".format(gdf.shape[0]))"
@@ -343,7 +363,7 @@
343363
"name": "python",
344364
"nbconvert_exporter": "python",
345365
"pygments_lexer": "ipython3",
346-
"version": "3.8.13"
366+
"version": "3.10.6"
347367
}
348368
},
349369
"nbformat": 4,

sliderule/ipysliderule.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,19 @@ def __init__(self, **kwargs):
8989
style=self.style,
9090
)
9191

92+
# dropdown menu for ICESat-2 product
93+
self.product = ipywidgets.Dropdown(
94+
options=['ATL03','ATL06','ATL08'],
95+
value='ATL03',
96+
description='Product:',
97+
description_tooltip=("Product: ICESat-2 data product "
98+
"\n\tATL03: Global Geolocated Photon Data"
99+
"\n\tATL06: Land Ice Height"
100+
"\n\tATL08: Land and Vegetation Height"),
101+
disabled=False,
102+
style=self.style,
103+
)
104+
92105
# dropdown menu for setting data release
93106
self.release = ipywidgets.Dropdown(
94107
options=['003', '004', '005'],

0 commit comments

Comments
 (0)