# -*- coding: utf-8 -*-
# ---------------------------------------------------------------------------
# updateIsosurface.py
# Created on: 2014-06-12 09:49:56.00000
# (generated by ArcGIS/ModelBuilder)
# Description:
# ---------------------------------------------------------------------------
# Import arcpy module
import os
import httplib
import urllib
import threading
import time
import datetime
urlInfo = "127.0.0.1"
portInfo = 8888
addressInfo = "/watf/gisAction.jsp?method=isoAnalyzeTask"
startTime = '2014-08-20 08:00:00'
endTime = '2014-08-20 08:00:00'
sleepTimeSpan = 60 / 4
#
timeInfo = datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M:%S')
timespan = datetime.timedelta(days=1)
def createIsosurface(timeStringInfo, actionInfo, timeSpanInfo):
para = {'action':actionInfo, 'timeSpan':timeSpanInfo, 'dateTime':timeStringInfo}
pageUrl = addressInfo + "&" + urllib.urlencode(para)
print para
conn = httplib.HTTPConnection(urlInfo,portInfo)
conn.request("GET", pageUrl)
res = conn.getresponse()
print res.read()
return
while True:
dateTimeStr = timeInfo.strftime('%Y-%m-%d %H:%M:%S')
# isosurfaceTaskPzh
createIsosurface(dateTimeStr, 'isosurfaceTaskPzh', '1day')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskPzh', '10day')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskPzh', '30day')
time.sleep(sleepTimeSpan) #
#
# isosurfaceTaskPzhWarn
createIsosurface(dateTimeStr, 'isosurfaceTaskPzhWarn', '1day')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskPzhWarn', '10day')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskPzhWarn', '30day')
time.sleep(sleepTimeSpan) #
#
# isosurfaceTaskRainfallDeparture
createIsosurface(dateTimeStr, 'isosurfaceTaskRainfallDeparture', '10day')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskRainfallDeparture', '30day')
time.sleep(sleepTimeSpan) #
#
# isosurfaceTaskRainfallDepartureWarn
createIsosurface(dateTimeStr, 'isosurfaceTaskRainfallDepartureWarn', '10day')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskRainfallDepartureWarn', '30day')
time.sleep(sleepTimeSpan) #
#
# isosurfaceTaskNoRainDay
createIsosurface(dateTimeStr, 'isosurfaceTaskNoRainDay', '')
time.sleep(sleepTimeSpan) #
#
# isosurfaceTaskSoilMoisture
createIsosurface(dateTimeStr, 'isosurfaceTaskSoilMoisture', 'average')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskSoilMoisture', '10cm')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskSoilMoisture', '20cm')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskSoilMoisture', '40cm')
time.sleep(sleepTimeSpan) #
#
# isosurfaceTaskSoilWaterRate
createIsosurface(dateTimeStr, 'isosurfaceTaskSoilWaterRate', '10cm')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskSoilWaterRate', '20cm')
time.sleep(sleepTimeSpan) #
#
createIsosurface(dateTimeStr, 'isosurfaceTaskSoilWaterRate', '40cm')
time.sleep(sleepTimeSpan) #
print '-------------------------' + dateTimeStr + ' End------------------------------'
print '-------------------------------------------------------------------------------'
if dateTimeStr == endTime:
break
timeInfo = timeInfo + timespan