大数跨境
0
0

NetCDF数据在ArcMap中的使用

NetCDF数据在ArcMap中的使用 GIS前沿
2020-01-06
1
导读:NetCDF又称科学数据集,可以存储温度、湿度、风速、风向等多个维度的文件格式。


NetCDF又称科学数据集,可以存储温度、湿度、风速、风向等多个维度的文件格式。



1、在ArcMap中显示NetCDF数据


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



2、显示特定年份的温度图层


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



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



3、按照时间动态展示数据


首先对图层启用时间,然后打开时间滑块。



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


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



2)复制这里→(https://pan.baidu.com/s/1acJB6v9RqyMqmWuqVENzwA?errno=0&errmsg=Auth%20Login%20Sucess&&bduss=&ssnerror=0&traceid=#list/path=%2F)下载,NetCDF_time_slice_to_Raster.zip,解压后,添加到目录窗口中,然后运行工具。



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



修改后的脚本如下:

  1. # -------------------------------------------------------------------

  2. # export_netCDF_slice.py

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

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

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

  6. # -------------------------------------------------------------------


  7. # Import modules

  8. import arcpy, os


  9. #Inputs

  10. Input_NetCDF_layer = arcpy.GetParameterAsText(0)

  11. Output_Folder = arcpy.GetParameterAsText(1)


  12. Input_Name = Input_NetCDF_layer

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


  14. #Copy the NetCDF layer as a TIF file. 

  15. arcpy.CopyRaster_management(Input_Name, Output_Raster)

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


  17. #Reading number of band information from saved TIF

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

  19. resultValue = bandcount.getOutput(0)


  20. count = 1


  21. # Year

  22. yearN = 1875


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


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

  25. while count <= int(resultValue):

  26.     Input_Raster_Name = Output_Raster + os.sep+ "Band_" + str(count)

  27.     Output_Band = Output_Folder + os.sep +  str(yearN) +".tif"

  28.     arcpy.CopyRaster_management(Input_Raster_Name, Output_Band)

  29.     arcpy.AddMessage("Band_" + str(count) +".tif" + " " "exported" + " " + "successfully")

  30.     yearN +=5

  31.     count +=1



  32. # The following will delete the TIFF file that was created by CopyRaster tool.  

  33. arcpy.Delete_management(Output_Raster,"#")


  34. arcpy.AddMessage("Tool Executed Successfully")





- END -


ArcGIS数据生产与精细化制图之中国年降水量分布图的制作(附练习数据)
ArcGIS desktop——“热力图”实现方法比较
超级详细ArcGIS入门讲解和土地确权操作流程培训教程【收藏】
7.72GB ARCGIS  ERDAS  ENVI干货教程网盘下载
ArcGIS实战教程:空间统计分析,冷点热点分析

【声明】内容源于网络
0
0
GIS前沿
分享测绘地信资讯,交流行业软件技巧。
内容 4923
粉丝 0
GIS前沿 分享测绘地信资讯,交流行业软件技巧。
总阅读1.4k
粉丝0
内容4.9k