Skip to content

Commit b8ef95a

Browse files
add a zarr sample + vsizip (#253)
* add a zarr sample + vsizip * Update requirements.txt * Update README.md --------- Co-authored-by: Tom Kralidis <tomkralidis@gmail.com>
1 parent 68b24c0 commit b8ef95a

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

workshop/jupyter/content/data/README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ and sometimes also GeoJSON.
1717
NB "Antarctica" has been removed from the "countries" datasets as it gave
1818
problems with reprojections...
1919

20-
The poi-timis.geojson dataset has been downloaded from geofabrik.de, then filtered
21-
on certain types and bounds. Data provided by Open Street Map Editors under the
20+
`sample_geozarr.zarr.zip` has been produced in the scope of this training using numpy with random numbers.
21+
22+
`poi-timis.geojson` has been downloaded from geofabrik.de, then filtered
23+
on certain types and bounds. Data provided by OpenStreetMap editors under the
2224
Open Database License (ODbL) 1.0.
5.87 KB
Binary file not shown.

workshop/jupyter/content/notebooks/05-raster-data.ipynb

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,27 @@
9292
"r = plt.imshow(ds.GetRasterBand(1).ReadAsArray())\n"
9393
]
9494
},
95+
{
96+
"cell_type": "markdown",
97+
"metadata": {},
98+
"source": [
99+
"GDAL supports a wide variety of input format, and can also combine it with virtual filesystems, such as within a zipfile"
100+
]
101+
},
102+
{
103+
"cell_type": "code",
104+
"execution_count": null,
105+
"metadata": {},
106+
"outputs": [],
107+
"source": [
108+
"from osgeo import gdal\n",
109+
"import matplotlib.pyplot as plt\n",
110+
"# Notice how the zarr file is referenced within the zip file\n",
111+
"raster_path = '/vsizip/../data/sample_geozarr.zarr.zip/sample_geozarr.zarr'\n",
112+
"dataset = gdal.Open(raster_path)\n",
113+
"r = plt.imshow(ds.GetRasterBand(1).ReadAsArray())\n"
114+
]
115+
},
95116
{
96117
"cell_type": "markdown",
97118
"metadata": {},

0 commit comments

Comments
 (0)