Skip to content

Commit d57d804

Browse files
committed
Use rioxarray instead of rasterio for satellite data loading (#993)
1 parent cb1b04a commit d57d804

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

examples/user_guide/25_GLCM_Texture.ipynb

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727
"id": "3a06tk9sxuh",
2828
"metadata": {
2929
"execution": {
30-
"iopub.execute_input": "2026-03-09T15:24:35.820959Z",
31-
"iopub.status.busy": "2026-03-09T15:24:35.820856Z",
32-
"iopub.status.idle": "2026-03-09T15:24:36.961690Z",
33-
"shell.execute_reply": "2026-03-09T15:24:36.960684Z"
30+
"iopub.execute_input": "2026-03-09T15:30:49.123715Z",
31+
"iopub.status.busy": "2026-03-09T15:30:49.123629Z",
32+
"iopub.status.idle": "2026-03-09T15:30:50.272830Z",
33+
"shell.execute_reply": "2026-03-09T15:30:50.272259Z"
3434
}
3535
},
3636
"outputs": [],
@@ -57,10 +57,10 @@
5757
"id": "mqtgqmsnvlp",
5858
"metadata": {
5959
"execution": {
60-
"iopub.execute_input": "2026-03-09T15:24:36.963072Z",
61-
"iopub.status.busy": "2026-03-09T15:24:36.962807Z",
62-
"iopub.status.idle": "2026-03-09T15:24:37.032462Z",
63-
"shell.execute_reply": "2026-03-09T15:24:37.031655Z"
60+
"iopub.execute_input": "2026-03-09T15:30:50.274712Z",
61+
"iopub.status.busy": "2026-03-09T15:30:50.274450Z",
62+
"iopub.status.idle": "2026-03-09T15:30:50.338586Z",
63+
"shell.execute_reply": "2026-03-09T15:30:50.338001Z"
6464
}
6565
},
6666
"outputs": [],
@@ -109,10 +109,10 @@
109109
"id": "2fgm4xz3uwj",
110110
"metadata": {
111111
"execution": {
112-
"iopub.execute_input": "2026-03-09T15:24:37.033546Z",
113-
"iopub.status.busy": "2026-03-09T15:24:37.033449Z",
114-
"iopub.status.idle": "2026-03-09T15:24:37.759309Z",
115-
"shell.execute_reply": "2026-03-09T15:24:37.758777Z"
112+
"iopub.execute_input": "2026-03-09T15:30:50.339809Z",
113+
"iopub.status.busy": "2026-03-09T15:30:50.339694Z",
114+
"iopub.status.idle": "2026-03-09T15:30:51.046768Z",
115+
"shell.execute_reply": "2026-03-09T15:30:51.046259Z"
116116
}
117117
},
118118
"outputs": [],
@@ -145,10 +145,10 @@
145145
"id": "7ah4bm6v5ut",
146146
"metadata": {
147147
"execution": {
148-
"iopub.execute_input": "2026-03-09T15:24:37.760483Z",
149-
"iopub.status.busy": "2026-03-09T15:24:37.760378Z",
150-
"iopub.status.idle": "2026-03-09T15:24:38.303162Z",
151-
"shell.execute_reply": "2026-03-09T15:24:38.302527Z"
148+
"iopub.execute_input": "2026-03-09T15:30:51.047924Z",
149+
"iopub.status.busy": "2026-03-09T15:30:51.047834Z",
150+
"iopub.status.idle": "2026-03-09T15:30:51.568614Z",
151+
"shell.execute_reply": "2026-03-09T15:30:51.567915Z"
152152
}
153153
},
154154
"outputs": [],
@@ -190,10 +190,10 @@
190190
"id": "nkzw9wmyxio",
191191
"metadata": {
192192
"execution": {
193-
"iopub.execute_input": "2026-03-09T15:24:38.304357Z",
194-
"iopub.status.busy": "2026-03-09T15:24:38.304247Z",
195-
"iopub.status.idle": "2026-03-09T15:24:38.663836Z",
196-
"shell.execute_reply": "2026-03-09T15:24:38.663308Z"
193+
"iopub.execute_input": "2026-03-09T15:30:51.570036Z",
194+
"iopub.status.busy": "2026-03-09T15:30:51.569932Z",
195+
"iopub.status.idle": "2026-03-09T15:30:51.920501Z",
196+
"shell.execute_reply": "2026-03-09T15:30:51.919825Z"
197197
}
198198
},
199199
"outputs": [],
@@ -225,10 +225,10 @@
225225
"id": "keurc3dmugs",
226226
"metadata": {
227227
"execution": {
228-
"iopub.execute_input": "2026-03-09T15:24:38.664895Z",
229-
"iopub.status.busy": "2026-03-09T15:24:38.664788Z",
230-
"iopub.status.idle": "2026-03-09T15:24:38.792508Z",
231-
"shell.execute_reply": "2026-03-09T15:24:38.791940Z"
228+
"iopub.execute_input": "2026-03-09T15:30:51.921620Z",
229+
"iopub.status.busy": "2026-03-09T15:30:51.921522Z",
230+
"iopub.status.idle": "2026-03-09T15:30:52.045363Z",
231+
"shell.execute_reply": "2026-03-09T15:30:52.044567Z"
232232
}
233233
},
234234
"outputs": [],
@@ -303,8 +303,8 @@
303303
"cell_type": "code",
304304
"id": "2hogpjtllw7",
305305
"source": [
306-
"import os, rasterio\n",
307-
"from rasterio.windows import Window\n",
306+
"import os\n",
307+
"import rioxarray\n",
308308
"\n",
309309
"os.environ['AWS_NO_SIGN_REQUEST'] = 'YES'\n",
310310
"os.environ['GDAL_DISABLE_READDIR_ON_OPEN'] = 'EMPTY_DIR'\n",
@@ -316,8 +316,8 @@
316316
")\n",
317317
"\n",
318318
"try:\n",
319-
" with rasterio.open(COG_URL) as src:\n",
320-
" nir = src.read(1, window=Window(5300, 2100, 500, 500)).astype(np.float64)\n",
319+
" nir_da = rioxarray.open_rasterio(COG_URL).isel(band=0, y=slice(2100, 2600), x=slice(5300, 5800))\n",
320+
" nir = nir_da.load().values.astype(np.float64)\n",
321321
" print(f'Downloaded NIR band: {nir.shape}, range {nir.min():.0f}\u2013{nir.max():.0f}')\n",
322322
"except Exception as exc:\n",
323323
" print(f'Remote read failed ({exc}), using synthetic fallback')\n",
@@ -338,10 +338,10 @@
338338
],
339339
"metadata": {
340340
"execution": {
341-
"iopub.execute_input": "2026-03-09T15:24:38.793620Z",
342-
"iopub.status.busy": "2026-03-09T15:24:38.793519Z",
343-
"iopub.status.idle": "2026-03-09T15:24:40.121299Z",
344-
"shell.execute_reply": "2026-03-09T15:24:40.120560Z"
341+
"iopub.execute_input": "2026-03-09T15:30:52.046807Z",
342+
"iopub.status.busy": "2026-03-09T15:30:52.046700Z",
343+
"iopub.status.idle": "2026-03-09T15:30:53.261434Z",
344+
"shell.execute_reply": "2026-03-09T15:30:53.260895Z"
345345
}
346346
},
347347
"execution_count": null,
@@ -385,10 +385,10 @@
385385
],
386386
"metadata": {
387387
"execution": {
388-
"iopub.execute_input": "2026-03-09T15:24:40.122870Z",
389-
"iopub.status.busy": "2026-03-09T15:24:40.122512Z",
390-
"iopub.status.idle": "2026-03-09T15:24:45.554736Z",
391-
"shell.execute_reply": "2026-03-09T15:24:45.554227Z"
388+
"iopub.execute_input": "2026-03-09T15:30:53.262766Z",
389+
"iopub.status.busy": "2026-03-09T15:30:53.262453Z",
390+
"iopub.status.idle": "2026-03-09T15:30:58.515207Z",
391+
"shell.execute_reply": "2026-03-09T15:30:58.514628Z"
392392
}
393393
},
394394
"execution_count": null,
@@ -445,10 +445,10 @@
445445
],
446446
"metadata": {
447447
"execution": {
448-
"iopub.execute_input": "2026-03-09T15:24:45.556433Z",
449-
"iopub.status.busy": "2026-03-09T15:24:45.556320Z",
450-
"iopub.status.idle": "2026-03-09T15:24:46.981187Z",
451-
"shell.execute_reply": "2026-03-09T15:24:46.980549Z"
448+
"iopub.execute_input": "2026-03-09T15:30:58.517250Z",
449+
"iopub.status.busy": "2026-03-09T15:30:58.517125Z",
450+
"iopub.status.idle": "2026-03-09T15:30:59.860739Z",
451+
"shell.execute_reply": "2026-03-09T15:30:59.860156Z"
452452
}
453453
},
454454
"execution_count": null,
@@ -497,10 +497,10 @@
497497
],
498498
"metadata": {
499499
"execution": {
500-
"iopub.execute_input": "2026-03-09T15:24:46.982646Z",
501-
"iopub.status.busy": "2026-03-09T15:24:46.982318Z",
502-
"iopub.status.idle": "2026-03-09T15:24:47.183340Z",
503-
"shell.execute_reply": "2026-03-09T15:24:47.182726Z"
500+
"iopub.execute_input": "2026-03-09T15:30:59.862223Z",
501+
"iopub.status.busy": "2026-03-09T15:30:59.861896Z",
502+
"iopub.status.idle": "2026-03-09T15:31:00.062349Z",
503+
"shell.execute_reply": "2026-03-09T15:31:00.061769Z"
504504
}
505505
},
506506
"execution_count": null,

0 commit comments

Comments
 (0)