renjinhao的个人博客分享 http://blog.sciencenet.cn/u/renjinhao

博文

python将栅格的Null值像元设定成0

已有 6085 次阅读 2017-8-10 16:25 |个人分类:python|系统分类:科研笔记

# Name: Con_Ex_02.py

# Requirements: Spatial Analyst Extension

# Import system modules

import arcpy

from arcpy import env

from arcpy.sa import *

arcpy.CheckOutExtension("Spatial")

####################################################

##我勒个擦,因为这个check,折腾了我大半天,真恶心

####################################################

# Set environment settings

env.workspace = "H:/"


# Set local variables

a="2015sum.tif"

inRaster = Raster(a)


# Execute Con using a map algebra expression instead of a where clause

outCon = Con(IsNull(inRaster),0,inRaster)


# Save the outputs

outCon.save("H:/t2t.tif")




https://wap.sciencenet.cn/blog-1304273-1070494.html


下一篇:Arcgis 下的con运用
收藏 IP: 202.119.116.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...
扫一扫,分享此博文

全部作者的其他最新博文

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-4-30 08:00

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部