@@ -82,12 +82,12 @@ resolution, while the scene classification layer has a lower resolution (20 m):
82
82
import rioxarray
83
83
scl = rioxarray.open_rasterio(scl_href)
84
84
visual = rioxarray.open_rasterio(visual_href)
85
- scl.rio.resolution(), visual.rio.resolution()
85
+ print( scl.rio.resolution(), visual.rio.resolution() )
86
86
~~~
87
87
{: .language-python}
88
88
89
89
~~~
90
- (( 20.0, -20.0), (10.0, -10.0) )
90
+ (20.0, -20.0), (10.0, -10.0)
91
91
~~~
92
92
{: .output}
93
93
@@ -101,7 +101,7 @@ image we thus open the first level overview (zoom factor 2) and check that the r
101
101
102
102
~~~
103
103
visual = rioxarray.open_rasterio(visual_href, overview_level=0)
104
- visual.rio.resolution()
104
+ print( visual.rio.resolution() )
105
105
~~~
106
106
{: .language-python}
107
107
@@ -228,15 +228,15 @@ Xarray and Dask also provide a graphical representation of the raster data array
228
228
> > depending on the application! Here, we might select a chunks shape of `(1, 6144, 6144)`:
229
229
> >
230
230
> > ~~~
231
- > > band = rioxarray.open_rasterio(band_url , chunks=(1, 6144, 6144))
231
+ > > band = rioxarray.open_rasterio(blue_band_href , chunks=(1, 6144, 6144))
232
232
> > ~~~
233
233
> > {: .language-python}
234
234
> >
235
235
> > which leads to chunks 72 MB large: ((1 x 6144 x 6144) x 2 bytes / 2^20 = 72 MB). Also, we can let `rioxarray` and Dask
236
236
> > figure out appropriate chunk shapes by setting `chunks="auto"`:
237
237
> >
238
238
> > ~~~
239
- > > band = rioxarray.open_rasterio(band_url , chunks="auto")
239
+ > > band = rioxarray.open_rasterio(blue_band_href , chunks="auto")
240
240
> > ~~~
241
241
> > {: .language-python}
242
242
> >
@@ -300,7 +300,7 @@ from threading import Lock
300
300
%%time
301
301
mask = scl.squeeze().isin([ 8, 9] )
302
302
visual_masked = visual.where(~ mask, other=0)
303
- visual_store = visual_masked.rio.to_raster("band_masked.tif", tiled=True, lock=threading. Lock(), compute=False)
303
+ visual_store = visual_masked.rio.to_raster("band_masked.tif", tiled=True, lock=Lock(), compute=False)
304
304
~~~
305
305
{: .language-python}
306
306
0 commit comments