Skip to content

Commit dfa1aa4

Browse files
vpipktmetasim
authored andcommitted
Masking docs: show preview of clipped df
Signed-off-by: Jason T. Brown <[email protected]> (cherry picked from commit 3c2bde0)
1 parent 8134ca9 commit dfa1aa4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pyrasterframes/src/main/python/docs/masking.pymd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,19 +118,19 @@ to_clip = to_rasterize.withColumn('clip_raster',
118118
rf_rasterize('geom_native', rf_geometry('blue_masked'), lit(1), rf_dimensions('blue_masked').cols, rf_dimensions('blue_masked').rows))
119119

120120
# visualize some of the edges of our circle
121-
to_clip.select('clip_raster', 'blue_masked') \
121+
to_clip.select('blue_masked', 'clip_raster') \
122122
.filter(rf_data_cells('clip_raster') > 20) \
123123
.orderBy(rf_data_cells('clip_raster'))
124124
```
125125

126126
Finally, we create a new _tile_ column with the blue band clipped to our circle. Again we will use the `rf_mask` function to pass the NoData regions along from the rasterized geometry.
127127

128128
```python, clip
129-
clipped = to_clip.select('blue_masked',
130-
'clip_raster',
131-
rf_mask('blue_masked', 'clip_raster').alias('blue_clipped')) \
132-
.filter(rf_data_cells('clip_raster') > 20) \
133-
.orderBy(rf_data_cells('clip_raster'))
129+
to_clip.select('blue_masked',
130+
'clip_raster',
131+
rf_mask('blue_masked', 'clip_raster').alias('blue_clipped')) \
132+
.filter(rf_data_cells('clip_raster') > 20) \
133+
.orderBy(rf_data_cells('clip_raster'))
134134
```
135135

136136
This kind of clipping technique is further used in @ref:[zonal statistics](zonal-algebra.md).

0 commit comments

Comments
 (0)