You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/courses/earth-analytics-python/04-raster-vector-extract-data/2018-06-15-lidar-remote-sensing-uncertainty-landing-page.md
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ category: courses
4
4
title: "Lidar Remote Sensing Uncertainty - Compare Ground to Lidar Measurements of Tree Height in Python"
Copy file name to clipboardExpand all lines: _posts/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values.md
+45-45Lines changed: 45 additions & 45 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ title: "Extract Raster Values at Point Locations in Python"
4
4
excerpt: "For many scientific analyses, it is helpful to be able to select raster pixels based on their relationship to a vector dataset (e.g. locations, boundaries). Learn how to extract data from a raster dataset using a vector dataset."
title="Distribution of Pixel Values \n Lidar Canopy Height Model")
108
+
{:.input}
109
+
```python
110
+
# Explore the data by plotting a histogram with earthpy
111
+
ax=ep.hist(SJER_chm_data,
112
+
figsize=(8,8),
113
+
colors="purple",
114
+
xlabel="Lidar Estimated Tree Height (m)",
115
+
ylabel="Total Pixels",
116
+
title="Distribution of Pixel Values \n Lidar Canopy Height Model")
107
117
108
118
# Turn off scientific notation
109
-
ax.ticklabel_format(useOffset=False,
110
-
style='plain')
119
+
ax[1].ticklabel_format(useOffset=False,
120
+
style='plain')
111
121
```
112
122
113
123
{:.output}
114
124
{:.display_data}
115
125
116
126
<figure>
117
127
118
-
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_5_0.png"alt = "Bar plot showing the distribution of lidar canopy height model pixel values.">
119
-
<figcaption>Bar plot showing the distribution of lidar canopy height model pixel values.</figcaption>
Look at the histogram of the data with the 0's removed. Now you can see the true distribution of heights in the data.
166
-
Notice that below to plot the histogram an additional step is taken to remove `nan` values from the data. There are several ways to do this but here, we simply subset the data using
167
-
168
-
`SJER_chm_data[~np.isnan(SJER_chm_data)])`
169
-
170
-
Then the data are flattened into a 1-dimensional array to create the histogram:
171
-
172
-
`SJER_chm_data[~np.isnan(SJER_chm_data)].ravel()`
173
-
175
+
Look at the histogram of the data with the 0's removed. Now you can see the true distribution of heights in the data without the 0's.
# Explore the data by plotting a histogram with earthpy
180
+
ax=ep.hist(SJER_chm_data,
181
+
figsize=(8,8),
182
+
colors="purple",
183
+
xlabel="Lidar Estimated Tree Height (m)",
184
+
ylabel="Total Pixels",
185
+
title="Distribution of Pixel Values \n Lidar Canopy Height Model")
179
186
180
-
fig, ax = plt.subplots(figsize=(10, 10))
181
-
182
-
ax.hist(SJER_chm_data_no_na, color="purple")
183
-
184
-
ax.set(xlabel='Lidar Estimated Tree Height (m)',
185
-
ylabel='Total Pixels',
186
-
title='Distribution of Pixel Values \n Lidar Canopy Height Model')
187
-
188
-
ax.ticklabel_format(useOffset=False,
189
-
style='plain')
187
+
# Turn off scientific notation
188
+
ax[1].ticklabel_format(useOffset=False,
189
+
style='plain')
190
190
```
191
191
192
192
{:.output}
193
193
{:.display_data}
194
194
195
195
<figure>
196
196
197
-
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_10_0.png"alt = "Bar plot showing the distribution of lidar chm values with 0's removed.">
197
+
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_11_0.png"alt = "Bar plot showing the distribution of lidar chm values with 0's removed.">
198
198
<figcaption>Bar plot showing the distribution of lidar chm values with 0's removed.</figcaption>
199
199
200
200
</figure>
@@ -293,7 +293,7 @@ plt.show()
293
293
294
294
<figure>
295
295
296
-
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_15_0.png"alt = "Map showing SJER plot location points overlayed on top of the SJER Canopy Height Model.">
296
+
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_16_0.png"alt = "Map showing SJER plot location points overlayed on top of the SJER Canopy Height Model.">
297
297
<figcaption>Map showing SJER plot location points overlayed on top of the SJER Canopy Height Model.</figcaption>
298
298
299
299
</figure>
@@ -623,7 +623,7 @@ plt.show()
623
623
624
624
<figure>
625
625
626
-
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_25_0.png"alt = "Bar plot showing maximum tree height per plot in SJER.">
626
+
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_26_0.png"alt = "Bar plot showing maximum tree height per plot in SJER.">
627
627
<figcaption>Bar plot showing maximum tree height per plot in SJER.</figcaption>
628
628
629
629
</figure>
@@ -780,7 +780,7 @@ plt.show()
780
780
781
781
<figure>
782
782
783
-
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_29_0.png"alt = "Bar plots showing pixel value distribution for all SJER sites.">
783
+
<imgsrc = "{{ site.url }}/images/courses/intermediate-earth-data-science-textbook/04-spatial-data-applications/remote-sensing-uncertainty/2016-12-06-uncertainty02-extract-raster-values/2016-12-06-uncertainty02-extract-raster-values_30_0.png"alt = "Bar plots showing pixel value distribution for all SJER sites.">
784
784
<figcaption>Bar plots showing pixel value distribution for all SJER sites.</figcaption>
0 commit comments