Skip to content
代码片段 群组 项目
提交 2fee7115 编辑于 作者: Sean Gillies's avatar Sean Gillies
浏览文件

Remove cells.

上级 03a636fa
无相关合并请求
{
"metadata": {
"name": "",
"signature": "sha256:1f4a71e4b75cc1f61fe31b06e7896548a61c21374da560610a923999cf0800f6"
"signature": "sha256:668cc72f84bf7467ee8cfef29fc14ef9cd1fd272e3352c5152ded54490865f5e"
},
"nbformat": 3,
"nbformat_minor": 0,
......@@ -212,7 +212,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"You can't read from or write to a closed dataset, but you"
"You can't read from or write to a closed dataset, but you can access its properties."
]
},
{
......@@ -235,72 +235,6 @@
],
"prompt_number": 23
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"with rasterio.drivers(CPL_DEBUG=True):\n",
"\n",
" # Read raster bands directly to Numpy arrays.\n",
" with rasterio.open('../tests/data/RGB.byte.tif') as src:\n",
" r, g, b = src.read()\n",
"\n",
" # Combine arrays using the 'iadd' ufunc. Expecting that the sum will\n",
" # exceed the 8-bit integer range, initialize it as 16-bit. Adding other\n",
" # arrays to it in-place converts those arrays up and preserves the type\n",
" # of the total array.\n",
" total = np.zeros(r.shape, dtype=rasterio.uint16)\n",
" for band in (r, g, b):\n",
" total += band\n",
" total /= 3\n",
"\n",
" # Write the product as a raster band to a new 8-bit file. For keyword\n",
" # arguments, we start with the meta attributes of the source file, but\n",
" # then change the band count to 1, set the dtype to uint8, and specify\n",
" # LZW compression.\n",
" kwds = src.meta\n",
" kwds.update(\n",
" dtype=rasterio.uint8,\n",
" count=1,\n",
" compress='lzw')\n",
"\n",
" with rasterio.open('output.tif', 'w', **kwds) as dst:\n",
" dst.write_band(1, total.astype(rasterio.uint8))"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 9
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"%matplotlib inline"
],
"language": "python",
"metadata": {},
"outputs": [],
"prompt_number": 8
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import matplotlib.pyplot as plt"
],
"language": "python",
"metadata": {},
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {},
......
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册