# ---------------------------------------------------------------------------
# -*- 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. mapreduce程序的按照key值从大到小降序排列

    在近期的Hadoop的学习中,在学习mapreduce时遇到问题:让求所给数据的top10,们我们指导mapreduce中是有默认的排列机制的,是按照key的升序从大到小排列的 然而top10问题的求 ...

  2. 【LeetCode】414. 第三大的数

    给定一个非空数组,返回此数组中第三大的数.如果不存在,则返回数组中最大的数.要求算法时间复杂度必须是O(n). 示例 1: 输入: [3, 2, 1] 输出: 1 解释: 第三大的数是 1. 示例 2 ...

  3. Scala 中的foreach和map方法比较

    Scala中的集合对象都有foreach和map两个方法.两个方法的共同点在于:都是用于遍历集合对象,并对每一项执行指定的方法.而两者的差异在于:foreach无返回值(准确说返回void),map返 ...

  4. 《LeetBook》leetcode题解(17):Letter Combinations of a Phone Number[M]

    我现在在做一个叫<leetbook>的免费开源书项目,力求提供最易懂的中文思路,目前把解题思路都同步更新到gitbook上了,需要的同学可以去看看 书的地址:https://hk029.g ...

  5. [转] 用协议分析工具学习TCP/IP

    一.前言 目前,网络的速度发展非常快,学习网络的人也越来越多,稍有网络常识的人都知道TCP/IP协议是网络的基础,是Internet的语言,可以说没有TCP/IP协议就没有互联网的今天.目前号称搞网的 ...

  6. tensorflow VocabularyProcessor

    from tensorflow.contrib import learn import numpy as np vocab_process = learn.preprocessing.Vocabula ...

  7. Node.js http服务器搭建和发送http的get、post请求

    1.Node.js 搭建http服务器 1.1创建server.js var http = require('http'); var querystring = require('querystrin ...

  8. Oracle11g在Windows和Linux下imp导入表,exp导出表,sqluldr2导出表,sqlldr导入表

    Windows(Win10) 打开cmd 首先输入sqlplus,依次输入用户名.口令 C:\Users\hasee>sqlplus SQL*Plus: Release Production o ...

  9. HTTP协议以及HTTP请求中8种请求方法

    HTTP协议以及HTTP请求中8种请求方法 什么是协议? 协议,是指通信的双方,在通信流程或内容格式上,共同遵守的标准. 什么是http协议? http协议,是互联网中最常见的网络通信标准. http ...

  10. Spring MVC之源码速读之RequestMappingHandlerAdapter

    spring-webmvc-4.3.19.RELEASE 下面来看DispatcherServlet中的执行: /** * Exposes the DispatcherServlet-specific ...