# ---------------------------------------------------------------------------
# meteorologicalimageload.py
# Created on:2014-01-24 08:33:03.00000
# Created by Smartmap
# usage:meteorologicalimageload <analyzeType> <analyzeResult>
# Description:
# ---------------------------------------------------------------------------
Import arcpy
Import Shutil
Import Os,sys
Arcpy.env.overwriteOutput = True
Projectnamesatelliteimage = ' geogcs[' gcs_wgs_1984 ', datum[' d_wgs_1984 ', spheroid[' wgs_1984 ', 6378137.0,298.257223563]],primem["Greenwich", 0.0],unit["degree", 0.0174532925199433],authority["EPSG", 4326] "
Projectnamewaterreport = ' projcs[' asia_north_equidistant_conic ', geogcs[' gcs_wgs_1984 ', DATUM[' D_WGS_1984 ', spheroid["wgs_1984", 6378137.0,298.257223563]],primem["Greenwich", 0.0],unit["degree", 0.0174532925199433], projection["Equidistant_conic"],parameter["false_easting", 0.0],parameter["false_northing", 0.0],PARAMETER[" Central_meridian ", 95.0],parameter[" Standard_parallel_1 ", 15.0],parameter[" standard_parallel_2 ", 65.0],PARAMETER[ "Latitude_of_origin", 30.0],unit["Meter", 1.0],authority["ESRI", 102026]] '
Projectnameweatherradar = ' projcs[' asia_lambert_conformal_conic ', geogcs[' gcs_wgs_1984 ', DATUM[' D_WGS_1984 ', spheroid["wgs_1984", 6378137.0,298.257223563]],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", 105.0],parameter["Standard_parallel_1", 30.0],parameter["standard_parallel_2", 62.0], parameter["Latitude_of_origin", 0.0],unit["Meter", 1.0],authority["ESRI", 102012]] '
Analyzeresult = "%scratchworkspace%\\analyzeresult.img"
# Script Arguments
Analyzetype = arcpy. Getparameterastext (0)
if analyzetype = = ' # ' or not analyzetype:
Analyzetype = "Satelliteimage"
Imagedirectory = "d:\\data\\spatialdata\\sourcedir\\" + analyzetype
Copytargetpath = "D:\\data\\spatialdata\\targetdir\\default" + Analyzetype + ". jpg"
Inputlinkfile = "d:\\data\\spatialdata\\targetdir\\" + Analyzetype + "Tic.txt"
Lasttime = 0
Lastfilepath = "#"
If Imagedirectory and imagedirectory! = ' # ':
FileList = Os.listdir (imagedirectory) #列出目录下的所有文件和目录
For line in FileList:
filepath = Os.path.join (imagedirectory,line)
If Os.path.isfile (filepath):
# Os.stat (filepath). St_ctime
LastModifyTime = Os.path.getctime (filepath)
If LastModifyTime > Lasttime:
Lasttime = LastModifyTime
Lastfilepath = FilePath
if Lastfilepath = = "#":
Lastfilepath = "D:\\data\\spatialdata\\default" + Analyzetype + ". jpg"
Shutil.copy (Lastfilepath, Copytargetpath)
# Process:register Raster
arcpy. Registerraster_management (Copytargetpath, "REGISTER", "", Inputlinkfile, "POLYORDER1", "")
# process:copy Raster
arcpy. Copyraster_management (Copytargetpath, Analyzeresult, "", "", "" "," none "," None "," "," none "," none ")
# Process: Defining projections
if Analyzetype = = ' Satelliteimage ':
ProjectName = Projectnamesatelliteimage
elif Analyzetype = = ' Weatherradar ':
ProjectName = Projectnameweatherradar
elif Analyzetype = = ' Waterreport ':
ProjectName = Projectnamewaterreport
Else
ProjectName = Projectnamesatelliteimage
arcpy. Defineprojection_management (Analyzeresult, ProjectName)
arcpy. Setparameterastext (1, Analyzeresult)
Satellite Cloud Map via GP-radar-rainfall forecast