本文整理汇总了Python中owslib.wps.WebProcessingService.describeprocess方法的典型用法代码示例。如果您正苦于以下问题:Python WebProcessingService.describeprocess方法的具体用法?Python WebProcessingService.describeprocess怎么用?Python WebProcessingService.describeprocess使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类owslib.wps.WebProcessingService
的用法示例。
在下文中一共展示了WebProcessingService.describeprocess方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_wps_describeprocess_emu_all
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def test_wps_describeprocess_emu_all():
# Initialize WPS client
wps = WebProcessingService('http://localhost:8094/wps', skip_caps=True)
# Execute fake invocation of DescribeProcess operation by parsing cached response from
xml = open(resource_file('wps_EmuDescribeProcess_all.xml'), 'rb').read()
process = wps.describeprocess('nap', xml=xml)
processes = wps.describeprocess('all', xml=xml)
assert isinstance(process, Process)
assert isinstance(processes, list)
示例2: run_wps
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def run_wps(process_id,input,output):
#choose the first wps engine
my_engine = WebProcessingService('http://appsdev.hydroshare.org:8282/wps/WebProcessingService', verbose=False, skip_caps=True)
my_engine.getcapabilities()
my_process = my_engine.describeprocess(process_id)
my_inputs = my_process.dataInputs
input_names = [] #getting list of input
for input1 in my_inputs:
input_names.append(input1)
#executing the process..
execution = my_engine.execute(process_id, input, output)
request = execution.request
#set store executeresponse to false
request = request.replace('storeExecuteResponse="true"', 'storeExecuteResponse="false"')
url_wps = 'http://appsdev.hydroshare.org:8282/wps/WebProcessingService'
wps_request = urllib2.Request(url_wps,request)
wps_open = urllib2.urlopen(wps_request)
wps_read = wps_open.read()
if 'href' in wps_read:
tag = 'href="'
location = wps_read.find(tag)
new= wps_read[location+len(tag):len(wps_read)]
tag2 = '"/>\n </wps:Output>\n </wps:ProcessOutputs>\n</wps:'
location2 = new.find(tag2)
final = new[0:location2]
split = final.split()
wps_request1 = urllib2.Request(split[0])
wps_open1 = urllib2.urlopen(wps_request1)
wps_read1 = wps_open1.read()
#return [final_output_url, final_data]
return [wps_read1, split]
示例3: test_wps_describeprocess_bbox
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def test_wps_describeprocess_bbox():
# Initialize WPS client
wps = WebProcessingService('http://localhost:8094/wps', skip_caps=True)
# Execute fake invocation of DescribeProcess operation by parsing cached response from Emu service
xml = open(resource_file('wps_bbox_DescribeProcess.xml'), 'rb').read()
process = wps.describeprocess('bbox', xml=xml)
# Check process description
assert process.identifier == 'bbox'
assert process.title == 'Bounding Box'
# Check process inputs
# Example Input:
# identifier=bbox, title=Bounding Box, abstract=None, data type=BoundingBoxData
# Supported Value: EPSG:4326
# Supported Value: EPSG:3035
# Default Value: EPSG:4326
# minOccurs=1, maxOccurs=1
for input in process.dataInputs:
assert input.identifier == 'bbox'
assert input.dataType == 'BoundingBoxData'
# Example Output:
# identifier=bbox, title=Bounding Box, abstract=None, data type=BoundingBoxData
# Supported Value: EPSG:4326
# Default Value: EPSG:4326
# reference=None, mimeType=None
# Check process outputs
for output in process.processOutputs:
assert output.identifier == 'bbox'
assert output.dataType == 'BoundingBoxData'
示例4: ComplexInputs
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
class ComplexInputs(Wizard):
def __init__(self, request):
super(ComplexInputs, self).__init__(
request, name='wizard_complex_inputs',
title="Choose Input Parameter")
from owslib.wps import WebProcessingService
self.wps = WebProcessingService(wps_url(request, self.wizard_state.get('wizard_wps')['identifier']), verify=False)
self.process = self.wps.describeprocess(self.wizard_state.get('wizard_process')['identifier'])
self.title = "Choose Input Parameter of {0}".format(self.process.title)
def breadcrumbs(self):
breadcrumbs = super(ComplexInputs, self).breadcrumbs()
breadcrumbs.append(dict(route_path=self.request.route_path(self.name), title=self.title))
return breadcrumbs
def schema(self):
return Schema().bind(process=self.process)
def success(self, appstruct):
for input in self.process.dataInputs:
if input.identifier == appstruct.get('identifier'):
appstruct['mime_types'] = [value.mimeType for value in input.supportedValues]
super(ComplexInputs, self).success(appstruct)
def next_success(self, appstruct):
self.success(appstruct)
return self.next('wizard_source')
@view_config(route_name='wizard_complex_inputs', renderer='../templates/wizard/default.pt')
def view(self):
return super(ComplexInputs, self).view()
示例5: ExecuteProcess
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
class ExecuteProcess(Processes):
def __init__(self, request):
self.wps_id = request.params.get("wps")
self.wps = WebProcessingService(url=wps_url(request, self.wps_id))
identifier = request.params.get("process")
# TODO: need to fix owslib to handle special identifiers
self.process = self.wps.describeprocess(identifier)
super(ExecuteProcess, self).__init__(request, name="processes_execute", title="")
def breadcrumbs(self):
breadcrumbs = super(ExecuteProcess, self).breadcrumbs()
route_path = self.request.route_path("processes_list", _query=[("wps", self.wps_id)])
breadcrumbs.append(dict(route_path=route_path, title=self.wps.identification.title))
breadcrumbs.append(dict(route_path=self.request.route_path(self.name), title=self.process.title))
return breadcrumbs
def appstruct(self):
return {}
def generate_form(self, formid="deform"):
from phoenix.schema.wps import WPSSchema
schema = WPSSchema(process=self.process, user=self.get_user())
return Form(schema, buttons=("submit",), formid=formid)
def process_form(self, form):
controls = self.request.POST.items()
try:
appstruct = form.validate(controls)
self.execute(appstruct)
except ValidationFailure, e:
logger.exception("validation of exectue view failed.")
self.session.flash("There are errors on this page.", queue="danger")
return dict(description=getattr(self.process, "abstract", ""), form=e.render())
return HTTPFound(location=self.request.route_url("monitor"))
示例6: test_wps_describeprocess_ceda
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def test_wps_describeprocess_ceda():
# Initialize WPS client
wps = WebProcessingService('http://ceda-wps2.badc.rl.ac.uk/wps', skip_caps=True)
# Execute fake invocation of DescribeProcess operation by parsing cached response from CEDA service
xml = open(resource_file('wps_CEDADescribeProcess.xml'), 'rb').read()
process = wps.describeprocess('Doubleit', xml=xml)
# Check process description
assert process.identifier == 'DoubleIt'
assert process.title == 'Doubles the input number and returns value'
assert process.abstract == 'This is test process used to demonstrate how the WPS and the WPS User Interface work. The process accepts an integer or floating point number and returns some XML containing the input number double.' # NOQA
# Check process properties
assert process.statusSupported is False
assert process.storeSupported is True
# Check process inputs
# Example Input:
# identifier=NumberToDouble, title=NumberToDouble, abstract=NumberToDouble, data type=LiteralData
# Any value allowed
# Default Value: None
# minOccurs=1, maxOccurs=-1
for input in process.dataInputs:
assert input.identifier == 'NumberToDouble'
assert input.dataType == 'LiteralData'
# Example Output:
# identifier=OutputXML, title=OutputXML, abstract=OutputXML, data type=ComplexData
# Supported Value: mimeType=text/XML, encoding=UTF-8, schema=NONE
# Default Value: None
# reference=None, mimeType=None
# Check process outputs
for output in process.processOutputs:
assert output.identifier == 'OutputXML'
assert output.dataType == 'ComplexData'
示例7: run_wps
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def run_wps(process_id,input,output):
#choose the first wps engine
#my_engine = WebProcessingService('http://appsdev.hydroshare.org:8282/wps/WebProcessingService', verbose=False, skip_caps=True)
my_engine = WebProcessingService('http://appsdev.hydroshare.org:8282/wps/WebProcessingService',verbose=False, skip_caps=True)
my_engine.getcapabilities()
#wps_engines = list_wps_service_engines()
#my_engine = wps_engines[0]
#choose the r.time-series-converter
my_process = my_engine.describeprocess(process_id)
my_inputs = my_process.dataInputs
input_names = [] #getting list of input
for input1 in my_inputs:
input_names.append(input1)
#executing the process..
execution = my_engine.execute(process_id, input, output)
request = execution.request
#set store executeresponse to false
request = request.replace('storeExecuteResponse="true"', 'storeExecuteResponse="false"')
url_wps = 'http://appsdev.hydroshare.org:8282/wps/WebProcessingService'
wps_request = urllib2.Request(url_wps,request)
wps_open = urllib2.urlopen(wps_request)
wps_read = wps_open.read()
if 'href' in wps_read:
tag = 'href="'
location = wps_read.find(tag)
new= wps_read[location+len(tag):len(wps_read)]
tag2 = '"/>\n </wps:Output>\n </wps:ProcessOutputs>\n</wps:'
location2 = new.find(tag2)
final = new[0:location2]
split = final.split()
wps_request1 = urllib2.Request(split[0])
wps_open1 = urllib2.urlopen(wps_request1)
wps_read1 = wps_open1.read()
#now we must use our own method to send the request1
#we need to use the request
#this code is for the normal wps which is not working right now
# monitorExecution(execution)
# output_data = execution.processOutputs
# final_output_url = output_data[0].reference
# final_data = read_final_data(final_output_url)
#return [final_output_url, final_data]
return [wps_read1, split]
示例8: pyGDPwebProcessing
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
class pyGDPwebProcessing():
"""
This class allows interactive calls to be made into the GDP.
"""
def __init__(self, wfs_url=WFS_URL):
# if WFS_URL is None:
# from pygdp.namespaces import WFS_URL
# wfsUrl = WFS_URL
self.wfsUrl = wfs_url
self.wpsUrl = WPS_URL
self.version = '1.1.0'
self.wps = WebProcessingService(self.wpsUrl)
def WPSgetCapabilities(self, xml=None):
"""
Returns a list of capabilities.
"""
self.wps.getcapabilities(xml)
def WPSdescribeprocess(self, identifier, xml=None):
"""
Returns a list describing a specific identifier/process.
"""
self.wps.describeprocess(identifier, xml)
# pyGDP Submit Feature
def dodsReplace(self, dataSetURI, verbose=False):
if verbose:
ch.setLevel(logging.INFO)
return _execute_request.dodsReplace(dataSetURI, verbose)
def submitFeatureCoverageOPenDAP(self, geoType, dataSetURI, varID, startTime, endTime, attribute='the_geom',
value=None, gmlIDs=None, verbose=False, coverage=True, outputfname=None,
sleepSecs=10, async=False):
if verbose:
ch.setLevel(logging.INFO)
return feature_coverage.submitFeatureCoverageOPenDAP(geoType, dataSetURI, varID, startTime,
endTime, attribute, value, gmlIDs, verbose,
coverage, self.wfsUrl, outputfname, sleepSecs, async=async)
示例9: describe_process
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def describe_process(identifier, wps_host=None, wps_client=None,
version='1.0.0'):
if wps_host:
wps = WebProcessingService(wps_host, version)
return wps.describeprocess(identifier)
else:
response = wps_client.get(
('?service=WPS&request=DescribeProcess&version={0}&'
'identifier={1}').format(version, identifier))
wps_reader = WPSReader()
element = wps_reader.readFromString(response.get_data())
wps = WebProcessingService(None, version, skip_caps=True)
return wps._parseProcessMetadata(element)
示例10: run_wps
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def run_wps(res_ids,gap):
if (gap ==''):
gap = "linear"
# checks if there is two resource IDs
resources = res_ids.split("_")
process_id = 'org.n52.wps.server.r.series_gap_filler_3'
process_input = [('resource_id',str(resources[0])),('fill_function',str(gap))]
#setting the WPS URL is set in app.py
url_wps = GapFillerTool.wps_url + '/WebProcessingService'
my_engine = WebProcessingService(url_wps, verbose=False, skip_caps=True)
my_process = my_engine.describeprocess(process_id)
#executing the process..
# build execution
execution = WPSExecution(version=my_engine.version, url=my_engine.url, username=my_engine.username,
password=my_engine.password, verbose=my_engine.verbose)
requestElement = execution.buildRequest(process_id, process_input, 'output')
request = etree.tostring(requestElement)
#set store executeresponse to false
request = request.replace('storeExecuteResponse="true"', 'storeExecuteResponse="false"')
execution = my_engine.execute(process_id, process_input, 'output', request)
monitorExecution(execution)
status = execution.status
# if the status is successful...
if status == 'ProcessSucceeded':
outputs = execution.processOutputs
output0 = outputs[0]
reference0 = output0.reference
# retrieve the data from the reference
output_data = requests.get(reference0)
resp = HttpResponse(output_data, content_type="application/json")
return resp
else:
return JsonResponse({'status': 'wps request failed'})
示例11: run_wps
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def run_wps(res_ids):
print"launch wps"
print res_ids
# checks if there is two resource IDs
resources = res_ids.split("_")
if len(resources) < 2:
return JsonResponse({'status': 'wps request failed. 2 resources are required, found ' + str(len(resources))})
process_id = 'org.n52.wps.server.r.linear_regression'
process_input = [('x_resource_id',str(resources[0])),('y_resource_id',str(resources[1]))]
#setting the WPS URL is set in app.py
url_wps = CorrelationPlot.wps_url + '/WebProcessingService'
my_engine = WebProcessingService(url_wps, verbose=False, skip_caps=True)
my_process = my_engine.describeprocess(process_id)
#executing the process..
# build execution
execution = WPSExecution(version=my_engine.version, url=my_engine.url, username=my_engine.username,
password=my_engine.password, verbose=my_engine.verbose)
requestElement = execution.buildRequest(process_id, process_input, 'output')
request = etree.tostring(requestElement)
#set store executeresponse to false
request = request.replace('storeExecuteResponse="true"', 'storeExecuteResponse="false"')
print request
execution = my_engine.execute(process_id, process_input, 'output', request)
monitorExecution(execution)
status = execution.status
print status
# if the status is successful...
if status == 'ProcessSucceeded':
outputs = execution.processOutputs
output0 = outputs[0]
reference0 = output0.reference
# retrieve the data from the reference
output_data = requests.get(reference0)
resp = HttpResponse(output_data, content_type="application/json")
return resp
else:
return JsonResponse({'status': 'wps request failed'})
示例12: ExecuteProcess
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
class ExecuteProcess(Processes):
def __init__(self, request):
self.wps_id = request.params.get('wps')
self.wps = WebProcessingService(url=wps_url(request, self.wps_id), verify=False)
identifier = request.params.get('process')
# TODO: need to fix owslib to handle special identifiers
self.process = self.wps.describeprocess(identifier)
super(ExecuteProcess, self).__init__(request, name='processes_execute', title='')
def breadcrumbs(self):
breadcrumbs = super(ExecuteProcess, self).breadcrumbs()
route_path = self.request.route_path('processes_list', _query=[('wps', self.wps_id)])
breadcrumbs.append(dict(route_path=route_path, title=self.wps.identification.title))
breadcrumbs.append(dict(route_path=self.request.route_path(self.name), title=self.process.title))
return breadcrumbs
def appstruct(self):
return {}
def generate_form(self, formid='deform'):
schema = WPSSchema(request=self.request, process=self.process, user=self.get_user())
return Form(
schema,
buttons=('submit',),
formid=formid,
)
def process_form(self, form):
controls = self.request.POST.items()
try:
logger.debug("before validate")
appstruct = form.validate(controls)
logger.debug("before execute %s", appstruct)
self.execute(appstruct)
except ValidationFailure, e:
logger.exception('validation of exectue view failed.')
self.session.flash("There are errors on this page.", queue='danger')
return dict(description=getattr(self.process, 'abstract', ''),
form = e.render())
return HTTPFound(location=self.request.route_url('monitor'))
示例13: pinned_processes
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
def pinned_processes(self):
settings = self.request.db.settings.find_one() or {}
processes = []
if 'pinned_processes' in settings:
for pinned in settings.get('pinned_processes'):
try:
service_name, identifier = pinned.split('.', 1)
url = self.request.route_path(
'processes_execute', _query=[('wps', service_name), ('process', identifier)])
wps = WebProcessingService(
url=self.request.route_url('owsproxy', service_name=service_name), verify=False)
# TODO: need to fix owslib to handle special identifiers
process = wps.describeprocess(identifier)
description = headline(process.abstract)
except Exception:
LOGGER.warn("could not add pinned process %s", pinned)
else:
processes.append(dict(
title=process.identifier,
description=description,
url=url,
service_title=wps.identification.title))
return processes
示例14: LiteralInputs
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
class LiteralInputs(Wizard):
def __init__(self, request):
super(LiteralInputs, self).__init__(request, name='wizard_literal_inputs', title="Literal Inputs")
from owslib.wps import WebProcessingService
self.wps = WebProcessingService(wps_url(request, self.wizard_state.get('wizard_wps')['identifier']))
self.process = self.wps.describeprocess(self.wizard_state.get('wizard_process')['identifier'])
self.title = "Literal inputs of {0}".format(self.process.title)
def breadcrumbs(self):
breadcrumbs = super(LiteralInputs, self).breadcrumbs()
breadcrumbs.append(dict(route_path=self.request.route_path(self.name), title=self.title))
return breadcrumbs
def schema(self):
from phoenix.schema.wps import WPSSchema
return WPSSchema(hide_complex=True, process = self.process)
def next_success(self, appstruct):
self.success(appstruct)
return self.next('wizard_complex_inputs')
@view_config(route_name='wizard_literal_inputs', renderer='../templates/wizard/default.pt')
def view(self):
return super(LiteralInputs, self).view()
示例15: print
# 需要导入模块: from owslib.wps import WebProcessingService [as 别名]
# 或者: from owslib.wps.WebProcessingService import describeprocess [as 别名]
if request == "GetCapabilities":
wps.getcapabilities()
print("WPS Identification type: %s" % wps.identification.type)
print("WPS Identification title: %s" % wps.identification.title)
print("WPS Identification abstract: %s" % wps.identification.abstract)
for operation in wps.operations:
print("WPS Operation: %s" % operation.name)
for process in wps.processes:
print("WPS Process: identifier=%s title=%s" % (process.identifier, process.title))
elif request == "DescribeProcess":
if identifier is None:
print('\nERROR: missing mandatory "-i (or --identifier)" argument')
usage()
sys.exit(4)
process = wps.describeprocess(identifier)
print("WPS Process: identifier=%s" % process.identifier)
print("WPS Process: title=%s" % process.title)
print("WPS Process: abstract=%s" % process.abstract)
for input in process.dataInputs:
print(
"Process input: identifier=%s, data type=%s, minOccurs=%d, maxOccurs=%d"
% (input.identifier, input.dataType, input.minOccurs, input.maxOccurs)
)
for output in process.processOutputs:
print("Process output: identifier=%s, data type=%s" % (output.identifier, output.dataType))
elif request == "Execute":
if xml is None:
print('\nERROR: missing mandatory "-x (or --xml)" argument')
usage()