# ---------------------------------------------------------------------------
# -*- coding: utf-8 -*-
# QiXiangAnalyze.py
# Created on: 2012-07-04 08:15:21.00000
# Creater: GISPathfinder
# Usage: isolineAnalyze <station> <reclassificationString> <isoResult>
# Description:
# ---------------------------------------------------------------------------

import time
import datetime
from struct import *
from bz2 import BZ2File
import sys, os, arcpy

arcpy.env.overwriteOutput = True

start = time.clock()

file = open(r"F:/geodata/shanxi/MapData/GP/QiXiang/FL2/1607080900.000", "r")

#
zonName,flag,dataName = unpack("8s3s40s", file.read(51))
zonName = zonName.decode("gbk").rstrip('\x00')
dataName = dataName.decode("gbk").rstrip('\x00')

#
print(zonName)
print(dataName)
#
#file.read(5+3+3+3)
year,month,day,hour = unpack("5s3s3s3s", file.read(14)) # 时间说明
#print(year + " " + month+ " " + day+ " " + hour)
dateTimeData = datetime.datetime(int(year),int(month), int(day), int(hour), 0, 0, 0)
fileNameParseResult = dateTimeData.strftime("%Y%m%d%H%M%S")
asciiGrid = "F:\\geodata\\shanxi\\MapData\\GP\\QiXiang\\temp\\"+fileNameParseResult+".txt"
print(fileNameParseResult)

XNumGrids,YNumGrids,= unpack("5s5s", file.read(10))
XNumGrids = int(XNumGrids.decode("gbk").rstrip('\x00'))
YNumGrids = int(YNumGrids.decode("gbk").rstrip('\x00'))
print("X: " + str(XNumGrids)+" Y: "+str(YNumGrids))

StartLon,StartLat,= unpack("8s8s", file.read(16)) # 开始经度 开始纬度
StartLon = float(StartLon.decode("gbk").rstrip('\x00'))
StartLat = float(StartLat.decode("gbk").rstrip('\x00'))
print("StartLon "+str(StartLon)+" StartLat"+str(StartLat))

project,reso,imageType,= unpack("2s5s2s", file.read(9))
project = int(project.decode("gbk").rstrip('\x00')) # 投影方式
reso = float(reso.decode("gbk").rstrip('\x00')) # 分辨率
imageType = int(imageType.decode("gbk").rstrip('\x00')) # 图象类型
print("project " + str(project))
print("reso " + str(reso))
print("imageType " + str(imageType))

refTable, = unpack("12s", file.read(12))
refTable = refTable.decode("gbk").rstrip('\x00')

CenterLon,CenterLat,= unpack("8s8s", file.read(16)) # 中心经度 中心纬度
CenterLon = float(CenterLon.decode("gbk").rstrip('\x00'))
CenterLat = float(CenterLat.decode("gbk").rstrip('\x00'))
print("CenterLon "+str(CenterLon)+" CenterLat "+str(CenterLat))

textYX = []
for j in range(0, YNumGrids):
textX = []
for k in range(0, XNumGrids):
value, = unpack("B", file.read(1))
textX.append(str(value))
textYX.append(' '.join(textX)+'\n')
file.close()

#
textYX.reverse()
#
#-------------------------------------------------------------------------------
#file_object = open('ASCIIDataQPF.txt', 'w')
#
file_object = open(asciiGrid, 'w')
file_object.write("NCOLS " + str(XNumGrids) + "\n")
file_object.write("NROWS " + str(YNumGrids) + "\n")
file_object.write("XLLCENTER " + str(StartLon) + "\n")
file_object.write("YLLCENTER " + str(StartLat) + "\n") # round(YReso, 3) *
file_object.write("CELLSIZE " + str(reso) + "\n")
file_object.write("NODATA_VALUE " + str(-9999) + "\n")
#
#
file_object.writelines(textYX)
file_object.close()
end = time.clock()
dateSpanTransfer = end - start
print("read: %f s" % dateSpanTransfer)
dateSpanTransfer = end - start

#file.read(1)
#-------------------------------------------------------------------------------

projXa80Proj = 'PROJCS["Xian80_Projected_Coordinate_System",GEOGCS["GCS_Xian_1980",DATUM["D_Xian_1980",SPHEROID["Xian_1980",6378140.0,298.257]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Lambert_Conformal_Conic"],PARAMETER["false_easting",0.0],PARAMETER["false_northing",0.0],PARAMETER["central_meridian",110.0],PARAMETER["standard_parallel_1",30.0],PARAMETER["standard_parallel_2",60.0],PARAMETER["latitude_of_origin",0.0],UNIT["Meters",1.0]]'

projXa80 = 'GEOGCS["GCS_Xian_1980",DATUM["D_Xian_1980",SPHEROID["Xian_1980",6378140.0,298.257]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]]'

projWGS84 = "GEOGCS['GCS_WGS_1984',DATUM['D_WGS_1984',SPHEROID['WGS_1984',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]"

rasterData = "F:\\geodata\\shanxi\\MapData\\GP\\QiXiang\\temp\\" + fileNameParseResult+".img"

#rasterProject = "F:\\geodata\\shanxi\\MapData\\GP\\QiXiang\\Result\\FL2Raster.gdb\\FY" + fileNameParseResult
rasterProject = "F:\\geodata\\shanxi\\MapData\\GP\\QiXiang\\Result\\" + fileNameParseResult+".img"

inputLinkFile = "F:\\geodata\\shanxi\\MapData\\GP\\QiXiang\\Result\\DBZTic.txt"

FL2Dataset = "F:\\geodata\\shanxi\\MapData\\GP\\QiXiang\\Result\\FL2Raster.gdb\\FL2Dataset"

colorMapFile = "F:\\geodata\\shanxi\\MapData\\GP\\QiXiang\\V-02.clr"

# Process: ASCII to Raster
arcpy.ASCIIToRaster_conversion(asciiGrid, rasterData, "INTEGER")

# Process: Define Projection
arcpy.DefineProjection_management(rasterData, projXa80Proj)

# Process: Register Raster
arcpy.RegisterRaster_management(rasterData, "REGISTER", "", inputLinkFile, "POLYORDER1", "")

# Process: Project Raster
arcpy.ProjectRaster_management(rasterData, rasterProject, projXa80, "NEAREST", 0.15, "", "", projXa80Proj)

# Process: Define Projection
arcpy.DefineProjection_management(rasterProject, projWGS84)

# Process: Add Colormap
arcpy.AddColormap_management(rasterProject, "", colorMapFile)

# Process: Add Rasters To Mosaic Dataset
arcpy.AddRastersToMosaicDataset_management(FL2Dataset, "Raster Dataset", rasterProject, "UPDATE_CELL_SIZES", "UPDATE_BOUNDARY", "NO_OVERVIEWS", "", "0", "1500", "", "", "SUBFOLDERS", "ALLOW_DUPLICATES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS", "NO_THUMBNAILS", "", "NO_FORCE_SPATIAL_REFERENCE")

#arcpy.AddRastersToMosaicDataset_management(FL2Dataset, "Raster Dataset", rasterProject, "NO_CELL_SIZES", "NO_BOUNDARY", "NO_OVERVIEWS", "", "0", "1500", "", "", "SUBFOLDERS", "ALLOW_DUPLICATES", "BUILD_PYRAMIDS", "CALCULATE_STATISTICS", "NO_THUMBNAILS", "", "NO_FORCE_SPATIAL_REFERENCE")

print("OK")

风云2号云图Mosaic Dataset处理的更多相关文章

  1. 镶嵌数据集 Mosaic Dataset 的常见数据组织方式

    镶嵌数据集是ESRI公司推出一种用于管理海量影像数据的数据模型,定义在GeoDatabase数据模型中. 它的常见数据组织方式有两种: 1. 源镶嵌数据集 Source Mosaic Dataset ...

  2. 用DataSet方式更新数据库表

    /* 用DataSet的方式更新数据库表 * 注意:用DataSet更新数据库表的时候,该表必须指定主键或者是唯一列 */ string connString = "Data Source= ...

  3. IDLHDF5读取与转换

    需求决定了动力,此时近凌晨一点,忙里偷闲,终于忙完了今天的“这点儿”事儿.参考帮助文档,从hdf的读写,捉摸hdf5的读写,总算弄明白了.稍作总结,以备候查. hdf5作为hdf数据的补充与升级,目前 ...

  4. 使用C#版本的gdal库打开hdf文件

    作者:朱金灿 来源:http://blog.csdn.net/clever101 最近应同事的请求帮忙研究下使用C#版的gdal库读取hdf文件,今天算是有一点成果,特地做一些记录. 首先是编译C#版 ...

  5. taihong

    揭秘!除了台风 我们还能在卫星云图上看到什么? 2019-08-08 09:20:53 来源: 中国天气网   中国天气网讯 说到卫星云图,可能大多数人首先能想到的就是台风.其实,拥有太空视角的卫星能 ...

  6. ArcEngine 栅格数据

    1.ArcEngine中的栅格数据组织方式(详细信息见:http://resources.arcgis.com/zh-cn/help/main/10.1/index.html#/na/009t0000 ...

  7. java上传xls文件

    using System; using System.Collections.Generic; using System.Web; using System.Web.UI; using System. ...

  8. ArGIS Server 服务的更新

    对于普通地图服务更新 [产品版本]:arcgis for server 10.1,10.1 sp1,10.2及以上 [问题分析]: 由于在10.1中地图服务的发布采用的是msd的形式,也就是虽然在Ar ...

  9. ArcGIS提取影像边界

    基于ArcGIS有多重办法可以提取影像边界,比如常用的有以下几种方式: a.System Toolboxes --> 3D Analyst Tools --> Conversion --& ...

随机推荐

  1. django.db.utils.InternalError: (1050, "Table 'tb_content' already exists")

    在goods应用里面写了tb_content数据表的模型类(不该写在这里的),进行了数据迁移,还导入了数据. 在contents应用里也写了tb_content数据表的模型类(应该写在这里的), 解决 ...

  2. Matlab 基础

    命令行(Command Line) 1. help  格式:help  命令 2. cd 配合 Tab 使用 pwd: print current working directory,打印当前工作路径 ...

  3. JavaScript父子页面之间的相互调用

    父页面: <!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head>< ...

  4. django第三课 模版

    第一步 创建项目文件: django-admin.py startproject *** 第二步 进入该文件下创建文件夹templates,在该文件夹下创建thanks.html <!DOCTY ...

  5. JavaMail之-通过邮件激活账号

    关键点就在于: 根据用户的给出的email,给这个email发送一个邮件.这个邮件中应该带有一个激活码?(32位UUID,64位UUID). 大概步骤: 1,  注册功能 - 只要用户注册成功,就给他 ...

  6. 运维甩锅神器---Jumpserver

    简介jumpserver 也就是跳板机,堡垒机,主要用于免密钥登陆web终端,可以对所有操作进行记录,录像!对所有服务器进行资产管理, 给开发人员分配登陆主机的权限和sudo权限,为运维人员省了很多手 ...

  7. windows10下找回照片查看器的方法(仅作记录)

    Windows Registry Editor Version 5.00 ; Change Extension's File Type [HKEY_CURRENT_USER\Software\Clas ...

  8. Java 集合框架(一)—— 接口综述

    前言:凡是使用 Java 编程的,几乎肯定会用到集合框架,比如 ArrayList.LinkedList.HashSet.HashMap 等,集合框架的代码绝对是大师级的实现,所以为了更好地使用集合框 ...

  9. 使用vue2+Axios+Router 之后的总结以及遇到的一些坑

    构建 vue有自己的脚手架构建工具vue-cli,使用起来非常方便,使用webpack来集成各种开发便捷工具,比如: 代码热更新,修改代码之后网页无刷新改变,对前端开发来说非常的方便 PostCss, ...

  10. 微信小程序开发,服务器端获取不到请求参数

    微信的request请求请求方式为 GET 时,可以在后台获取到请求的参数 userName 当为POST请求时则获取不到 userName 参数 解决方案是 在 设置一下 headers 里添加 ' ...