Skip to content
GitLab
探索
登录
主导航
搜索或转到…
项目
R
rasterio
管理
动态
成员
标记
计划
议题
0
议题看板
里程碑
迭代
Wiki
代码
合并请求
0
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
产物
部署
发布
软件包库
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
Contributor analytics
CI/CD 分析
仓库分析
代码评审分析
议题分析
模型实验
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
快捷键
?
支持
扫描加入微信群:
1. 获取企业级DevOps解决方案支持
2. 免费或折扣极狐GitLab 官方培训认证
代码片段
群组
项目
HPCSource
rasterio
提交
2fee7115
提交
2fee7115
编辑于
10年前
作者:
Sean Gillies
浏览文件
操作
下载
补丁
差异文件
Remove cells.
上级
03a636fa
无相关合并请求
变更
1
隐藏空白变更内容
行内
左右并排
显示
1 个更改的文件
examples/introduction.ipynb
+2
-68
2 个添加, 68 个删除
examples/introduction.ipynb
有
2 个添加
和
68 个删除
examples/introduction.ipynb
+
2
−
68
浏览文件 @
2fee7115
{
"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": {},
...
...
This diff is collapsed.
Click to expand it.
预览
0%
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录