zoukankan      html  css  js  c++  java
  • arcgis中转换netCDF为栅格数据

    最近有个同学询问我一个问题,使用arcpy把netcdf转化成栅格文件,忙活了两个小时才搞定,其实主要代码非常简单,只不过要对arcgis 的功能比较熟悉(其实多思考和查考它的帮助文章,无聊)

    # -*- coding: utf-8 -*-
    import arcpy
    from arcpy.sa import *
    
    
    def NetCDF2Tiff(inNetCDFFile,toTIFFFile):
    
        variable = "Qs_GDS0_SFC"
        XDimension = "g0_lon_1"
        YDimension = "g0_lat_0"
        outRasterLayer = "gldasTest"
        bandDimmension = ""
        dimensionValues = ""
        valueSelectionMethod = ""
    
        print "start"
        arcpy.MakeNetCDFRasterLayer_md(inNetCDFFile, variable, XDimension, YDimension,
                                       outRasterLayer, bandDimmension, dimensionValues, 
                                       valueSelectionMethod)
        arcpy.CopyRaster_management(outRasterLayer, toTIFFFile,format="TIFF")
    
        print "finish"
    
    
    ## 
    
    inNetCDFFile = "C:/Users/Administrator/Documents/GLDAS_NOAH025SUBP_3H.A2014058.0600.001.2017040053742.pss.nc"
    toTIFFFile =  "C:/Users/Administrator/Documents/test.tif"
    
    NetCDF2Tiff(inNetCDFFile,toTIFFFile)

    还有,值得注意的是,在使用arcpy的时候,使用ipython和notebook的时候,总是运行程序的时候出现错误

  • 相关阅读:
    延迟消失菜单
    控制产品上下滚动
    百度音乐全选
    百度文库评分两种代码写法
    选项卡
    搜狐视频
    m 调用传参图片切换
    IIS 7.5站点配置
    jquery plugins —— datatables 搜索后汇总
    jquery plugins —— datatables 增加行号
  • 原文地址:https://www.cnblogs.com/wybert/p/6389131.html
Copyright © 2011-2022 走看看