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

Skip to content

Commit 806241c

Browse files
committed
updates to demos and pytests for latest code
1 parent 34345b7 commit 806241c

13 files changed

+385
-521
lines changed

examples/api_widgets_demo.ipynb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"cell_type": "markdown",
55
"metadata": {},
66
"source": [
7-
"## SlideRule Widgets Example\n",
7+
"## IPython Widgets Example\n",
88
"\n",
99
"### Purpose\n",
1010
"Demonstrate common uses of the `ipysliderule` module"
@@ -357,7 +357,9 @@
357357
},
358358
{
359359
"cell_type": "markdown",
360-
"metadata": {},
360+
"metadata": {
361+
"tags": []
362+
},
361363
"source": [
362364
"### Save GeoDataFrame to output file\n",
363365
"- [pytables HDF5](https://www.pytables.org/): easily read back as a Geopandas GeoDataFrame\n",

examples/arcticdem_mosaic.ipynb

Lines changed: 104 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -11,47 +11,65 @@
1111
"Demonstrate how to sample the ArcticDEM at generated ATL06-SR points"
1212
]
1313
},
14+
{
15+
"cell_type": "markdown",
16+
"id": "e29fa51f-77bf-4c55-a99e-a4f166833755",
17+
"metadata": {},
18+
"source": [
19+
"#### Import Packages"
20+
]
21+
},
1422
{
1523
"cell_type": "code",
1624
"execution_count": null,
17-
"id": "b92cf7a1-67a3-485f-b170-72d2db8727a2",
25+
"id": "9dada6f9-e621-4a3a-825b-065ef6846645",
1826
"metadata": {},
1927
"outputs": [],
2028
"source": [
21-
"#\n",
22-
"# Import Packages\n",
23-
"#\n",
2429
"import matplotlib.pyplot as plt\n",
2530
"import matplotlib\n",
2631
"import sliderule\n",
2732
"from sliderule import icesat2"
2833
]
2934
},
35+
{
36+
"cell_type": "markdown",
37+
"id": "53e68348-2d49-4e22-b665-1acd8b367dcf",
38+
"metadata": {},
39+
"source": [
40+
"#### Initialize SlideRule Python Client"
41+
]
42+
},
3043
{
3144
"cell_type": "code",
3245
"execution_count": null,
33-
"id": "b8167cbe-3fe3-4dc9-a5ad-0cbba51c8a07",
46+
"id": "93edfc47-1cd5-4927-962c-fd447c9e807a",
3447
"metadata": {},
3548
"outputs": [],
3649
"source": [
37-
"#\n",
38-
"# Initialize SlideRule Python Client\n",
39-
"#\n",
4050
"icesat2.init(\"slideruleearth.io\", verbose=True)"
4151
]
4252
},
53+
{
54+
"cell_type": "markdown",
55+
"id": "c588e3ea-8ab8-452b-8f5a-9fd8d6364ca9",
56+
"metadata": {
57+
"tags": []
58+
},
59+
"source": [
60+
"#### Make Processing Request to SlideRule\n",
61+
"ATL06-SR request includes the `samples` parameter to specify that ArcticDEM Mosiac dataset should be sampled at each generated ATL06 elevation."
62+
]
63+
},
4364
{
4465
"cell_type": "code",
4566
"execution_count": null,
46-
"id": "98ef750a-e88b-4125-b951-d1e29ce50ce2",
67+
"id": "4ebef6dc-c05d-4b97-973c-05da9565e841",
4768
"metadata": {
4869
"tags": []
4970
},
5071
"outputs": [],
5172
"source": [
52-
"#\n",
53-
"# Make Processing Request to SlideRule - ATL06-SR with corresponding ArcticDEM Mosiac Samples\n",
54-
"#\n",
5573
"asset = \"nsidc-s3\"\n",
5674
"resource = \"ATL03_20190314093716_11600203_005_01.h5\"\n",
5775
"region = sliderule.toregion(\"../tests/data/dicksonfjord.geojson\")\n",
@@ -66,98 +84,135 @@
6684
"gdf = icesat2.atl06p(parms, asset=asset, resources=[resource])"
6785
]
6886
},
87+
{
88+
"cell_type": "markdown",
89+
"id": "b779ddf2-f9ea-41c2-bb9a-1db92e277fe7",
90+
"metadata": {},
91+
"source": [
92+
"#### Display GeoDataFrame\n",
93+
"Notice the columns that start with \"mosaic\""
94+
]
95+
},
6996
{
7097
"cell_type": "code",
7198
"execution_count": null,
72-
"id": "da7f3823-c32b-4ad7-a7de-cfb99d5ab858",
99+
"id": "e19bae20-140e-4d55-bb73-64a9630096d1",
73100
"metadata": {},
74101
"outputs": [],
75102
"source": [
76-
"#\n",
77-
"# Display GeoDataFrame\n",
78-
"#\n",
79103
"gdf"
80104
]
81105
},
106+
{
107+
"cell_type": "markdown",
108+
"id": "6178683e-2d08-4ccb-a80e-4bb997876330",
109+
"metadata": {},
110+
"source": [
111+
"#### Print Out File Directory\n",
112+
"When a GeoDataFrame includes samples from rasters, each sample value has a file id that is used to look up the file name of the source raster for that value."
113+
]
114+
},
82115
{
83116
"cell_type": "code",
84117
"execution_count": null,
85-
"id": "690b44ac-5257-4d2e-a8fd-8f74c6533ea0",
118+
"id": "b4c99349-c44e-4e59-bd31-ad6121df2f80",
86119
"metadata": {},
87120
"outputs": [],
88121
"source": [
89-
"#\n",
90-
"# Print Out File Directory\n",
91-
"#\n",
92122
"gdf.attrs['file_directory']"
93123
]
94124
},
125+
{
126+
"cell_type": "markdown",
127+
"id": "13185f3c-23f8-4334-a300-68c39284711c",
128+
"metadata": {},
129+
"source": [
130+
"#### Demonstrate How To Access Source Raster Filename for Entry in GeoDataFrame"
131+
]
132+
},
95133
{
96134
"cell_type": "code",
97135
"execution_count": null,
98-
"id": "d2fa07bb-1b89-446c-adb0-916b24eed74e",
136+
"id": "02ddb59c-b63b-4fef-b8c4-ec4b3d7580c6",
99137
"metadata": {},
100138
"outputs": [],
101139
"source": [
102-
"#\n",
103-
"# Demonstrate How To Access Source Raster Filename for Entry in GeoDataFrame\n",
104-
"#\n",
105140
"filedir = gdf.attrs['file_directory']\n",
106141
"filedir[gdf['mosaic.file_id'][0]]"
107142
]
108143
},
144+
{
145+
"cell_type": "markdown",
146+
"id": "88c529c1-9d72-4628-8b34-d850ae9e262d",
147+
"metadata": {},
148+
"source": [
149+
"#### Difference the Sampled Value from ArcticDEM with SlideRule ATL06-SR"
150+
]
151+
},
109152
{
110153
"cell_type": "code",
111154
"execution_count": null,
112-
"id": "59ea096b-3443-4b9a-b114-e818f143ca45",
155+
"id": "f3476592-b5b2-470e-bd35-d63e23e42ca0",
113156
"metadata": {},
114157
"outputs": [],
115158
"source": [
116-
"#\n",
117-
"# Difference the Sampled Value from ArcticDEM with SlideRule ATL06-SR\n",
118-
"#\n",
119159
"gdf[\"value_delta\"] = gdf[\"h_mean\"] - gdf[\"mosaic.value\"]\n",
120160
"gdf[\"value_delta\"].describe()"
121161
]
122162
},
163+
{
164+
"cell_type": "markdown",
165+
"id": "5447dd00-69fa-4ab7-a2f3-674bf72126e9",
166+
"metadata": {},
167+
"source": [
168+
"#### Difference the Zonal Statistic Mean from ArcticDEM with SlideRule ATL06-SR"
169+
]
170+
},
123171
{
124172
"cell_type": "code",
125173
"execution_count": null,
126-
"id": "f80cd750-9b91-406a-ac6a-dc04937cd811",
174+
"id": "54621607-cdbc-4849-8e65-530957c2adc9",
127175
"metadata": {},
128176
"outputs": [],
129177
"source": [
130-
"#\n",
131-
"# Difference the Zonal Statistic Mean from ArcticDEM with SlideRule ATL06-SR\n",
132-
"#\n",
133178
"gdf[\"mean_delta\"] = gdf[\"h_mean\"] - gdf[\"mosaic.mean\"]\n",
134179
"gdf[\"mean_delta\"].describe()"
135180
]
136181
},
182+
{
183+
"cell_type": "markdown",
184+
"id": "279dded2-5165-4b88-b28d-971fa303966d",
185+
"metadata": {},
186+
"source": [
187+
"#### Difference the Zonal Statistic Mdeian from ArcticDEM with SlideRule ATL06-SR"
188+
]
189+
},
137190
{
138191
"cell_type": "code",
139192
"execution_count": null,
140-
"id": "4e8fe135-bc15-4b8b-887f-ae16ac81487f",
193+
"id": "fafc2593-f6b4-44c1-8fb9-a9d345c6561e",
141194
"metadata": {},
142195
"outputs": [],
143196
"source": [
144-
"#\n",
145-
"# Difference the Zonal Statistic Mdeian from ArcticDEM with SlideRule ATL06-SR\n",
146-
"#\n",
147197
"gdf[\"median_delta\"] = gdf[\"h_mean\"] - gdf[\"mosaic.median\"]\n",
148198
"gdf[\"median_delta\"].describe()"
149199
]
150200
},
201+
{
202+
"cell_type": "markdown",
203+
"id": "32beb064-f10f-46e1-8756-a03756e069fd",
204+
"metadata": {},
205+
"source": [
206+
"#### Plot the Different ArcticDEM Values against the SlideRule ATL06-SR Values"
207+
]
208+
},
151209
{
152210
"cell_type": "code",
153211
"execution_count": null,
154-
"id": "d6785ed8-cb0d-49cb-9de1-30ac5792884a",
212+
"id": "12645d05-fda6-44bd-878b-37b0aa217065",
155213
"metadata": {},
156214
"outputs": [],
157215
"source": [
158-
"#\n",
159-
"# Plot the Different ArcticDEM Values against the SlideRule ATL06-SR Values\n",
160-
"\n",
161216
"# Setup Plot\n",
162217
"fig,ax = plt.subplots(num=None, figsize=(10, 8))\n",
163218
"fig.set_facecolor('white')\n",
@@ -189,17 +244,21 @@
189244
"plt.show()"
190245
]
191246
},
247+
{
248+
"cell_type": "markdown",
249+
"id": "343ad4b0-e94b-48bb-ae23-ca57867597fb",
250+
"metadata": {},
251+
"source": [
252+
"#### Plot the Sampled Value and Zonal Statistic Mean Deltas to SlideRule ATL06-SR Values"
253+
]
254+
},
192255
{
193256
"cell_type": "code",
194257
"execution_count": null,
195-
"id": "82c65e28-468e-463e-9afe-2b52064e7bae",
258+
"id": "7154e9db-ff4d-4b17-ac8c-62c3d12d7d54",
196259
"metadata": {},
197260
"outputs": [],
198261
"source": [
199-
"#\n",
200-
"# Plot the Sampled Value and Zonal Statistic Mean Deltas to SlideRule ATL06-SR Values\n",
201-
"#\n",
202-
"\n",
203262
"# Setup Plot\n",
204263
"fig,ax = plt.subplots(num=None, figsize=(10, 8))\n",
205264
"fig.set_facecolor('white')\n",

0 commit comments

Comments
 (0)