NetCDF数据在ArcMap中的使用

1 篇文章 0 订阅
1 篇文章 1 订阅

NetCDF又称科学数据集,可以存储温度、湿度、风速、风向等多个维度的文件格式。本次气象数据来源于地理遥感生态网平台。

下面我们来介绍如何在ArcMap中使用NetCDF。

在ArcMap中显示NetCDF数据

ArcMap不能直接读取NetCDF数据,需要使用GP工具Make NetCDF Raster Layer(创建NetCDF栅格图层),将NetCDF生成栅格图层。

132a414aa25efbd79ca1a26b7d2c3dba.jpeg

acda014b6798de09bcb6f69f4d3641cb.jpeg

显示特定年份的温度图层

方式一:直接在图层属性中设置。

b56a67011ca5ed447619064ddf250fad.jpeg

方式二:使用GP工具Select by Dimention(按维度选择)。

5530266e2b5b4a9c7bc284240e65229b.jpeg

按照时间动态展示数据

首先对图层启用时间。

d9be8f7df21e7dbd1b12d8a2b710795c.jpeg

然后打开时间滑块。

ea50c63363947e2000cf5e4fa43b4ee4.jpeg

ab6d310a0b51f6065a0be64ed9dd328c.jpeg

按照年份,导出NetCDF的每幅栅格

1、设置NetCDF图层的波段维度为Year。

4af61113512a1f674217bdd664f5d141.jpeg

2、点击原文中的链接,下载NetCDF_time_slice_to_Raster.zip,解压后,添加到目录窗口中,然后运行工具。

73bc27e7ce3cd4d11d043242ca2bd4af.jpeg

生成结果是以Band_命名的。我们可以稍微改下代码,以年份命名。脚本如下:

# ---------------------------------------------------------------------

# export_netCDF_slice.py

# Created on: 2011-06-02 10:18:49.00000

# Description: This scipt will create a TIFF raster from a NetCDF layer, and

# save each band of that TIFF as a seperate TIF raster (for each time slcie in a netcdf file) 

# ---------------------------------------------------------------------

# Import modules

import arcpy, os

#Inputs

Input_NetCDF_layer = arcpy.GetParameterAsText(0)

Output_Folder = arcpy.GetParameterAsText(1)

Input_Name = Input_NetCDF_layer

Output_Raster = Output_Folder + os.sep + "NetCDF_Raster.tif"

#Copy the NetCDF layer as a TIF file. 

arcpy.CopyRaster_management(Input_Name, Output_Raster)

arcpy.AddMessage(Output_Raster + " " + "created from NetCDF layer")

#Reading number of band information from saved TIF

bandcount = arcpy.GetRasterProperties_management (Output_Raster, "BANDCOUNT") 

resultValue = bandcount.getOutput(0)

count = 1

# Year

yearN = 1875

arcpy.AddMessage("Exporting individual bands from" + Output_Raster)

#Loop through the bands and copy bands as a seperate TIF file.

while count <= int(resultValue):

&nbsp; &nbsp; Input_Raster_Name = Output_Raster + os.sep+ "Band_" + str(count)

&nbsp; &nbsp; Output_Band = Output_Folder + os.sep +&nbsp; str(yearN) +".tif"

&nbsp; &nbsp; arcpy.CopyRaster_management(Input_Raster_Name, Output_Band)

&nbsp; &nbsp; arcpy.AddMessage("Band_" + str(count) +".tif" + " " "exported" + " " + "successfully")

&nbsp; &nbsp; yearN +=5

&nbsp; &nbsp; count +=1

# The following will delete the TIFF file that was created by CopyRaster tool.&nbsp;&nbsp;

arcpy.Delete_management(Output_Raster,"#")

arcpy.AddMessage("Tool Executed Successfully")


文章来源引用地理遥感生态网平台。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值