def test_bbox_input(self): bbox = BoundingBoxInput("bbox", "BBox foo", crss=["EPSG:4326", "EPSG:3035"]) doc = bbox.describe_xml() [inpt] = xpath_ns(doc, "/Input") [default_crs] = xpath_ns(doc, "./BoundingBoxData/Default/CRS") supported = xpath_ns(doc, "./BoundingBoxData/Supported/CRS") assert inpt.attrib["minOccurs"] == "1" assert default_crs.text == "EPSG:4326" assert len(supported) == 2
def test_bbox_input(self): bbox = BoundingBoxInput('bbox', 'BBox foo', crss=["EPSG:4326", "EPSG:3035"]) doc = bbox.describe_xml() [inpt] = xpath_ns(doc, '/Input') [default_crs] = xpath_ns(doc, './BoundingBoxData/Default/CRS') supported = xpath_ns(doc, './BoundingBoxData/Supported/CRS') self.assertEqual(inpt.attrib['minOccurs'], '1') self.assertEqual(default_crs.text, 'EPSG:4326') self.assertEqual(len(supported), 2)
def __init__(self): inputs = [ BoundingBoxInput('bbox', 'Bounding Box', abstract='Bounding Box Input.', crss=['epsg:4326', 'epsg:3035'], min_occurs=0) ] outputs = [ BoundingBoxOutput('bbox', 'Bounding Box', abstract='Bounding Box Output.', crss=['epsg:4326']) ] super(Box, self).__init__( self._handler, identifier='bbox', version='0.2', title="Bounding box in- and out", abstract='Give bounding box, return the same', metadata=[ Metadata('Birdhouse', 'http://bird-house.github.io/'), Metadata('User Guide', 'http://emu.readthedocs.io/en/latest/') ], inputs=inputs, outputs=outputs, store_supported=True, status_supported=True)
def connected_to(self, task_input, upstream_task, upstream_task_output): """ Override TaskPE fct. See TaskPE.connected_to for details. The ReducePE uses the upstream task output format to set it's own input format and it's set upon connection """ # Set the supported input description which is the same as the upstream task supported output up_task_out_desc = upstream_task.get_output_desc(upstream_task_output) params = dict(identifier=self.REDUCE_INPUT, title=self.REDUCE_INPUT, min_occurs=1, max_occurs=sys.maxint) if up_task_out_desc.dataType == 'ComplexData': params['supported_formats'] = [ Format(mime_type=up_task_out_desc.defaultValue.mimeType, schema=up_task_out_desc.defaultValue.schema, encoding=up_task_out_desc.defaultValue.encoding) ] self.input_desc = Input(ComplexInput(**params).describe_xml()) elif up_task_out_desc.dataType == 'BoundingBoxData': params['crss'] = up_task_out_desc.supportedValues self.input_desc = Input(BoundingBoxInput(**params).describe_xml()) else: params['data_type'] = up_task_out_desc.dataType self.input_desc = Input(LiteralInput(**params).describe_xml())
def __init__(self): inputs = [ BoundingBoxInput('bbox_in', 'ROI to process', ['epsg:4326', 'epsg:3035']), LiteralInput('platform_id', 'Satellite Platform. ex: PLEIADES-1B', data_type='string', min_occurs=0, max_occurs=10), LiteralInput('eodag_active', 'Activate EODAG. default: true', data_type='boolean', min_occurs=0, max_occurs=1, default=1), LiteralInput('roi_test', 'Sub part of the product to process. Expected syntax ex: 1000,1000,5000,5000', data_type='string', min_occurs=0, max_occurs=1), # ComplexInput(identifier='work', # title='Input work parameters', # abstract='Parametres du chantier a produire au format XML', # supported_formats=[Format('text/xml', extension='.xml'), ]), ] outputs = [ # ComplexOutput('outdatafile','Output data',supported_formats=[Format(mime_type="application/tar"), Format(mime_type="application/tar+gzip")]), ComplexOutput('outdatafile', 'Output data', supported_formats=[Format(mime_type="application/json")]), # LiteralOutput('outdata','Output data',data_type='string'), ] super(S2P, self).__init__( self._handler, identifier='S2P', version='0.2', title="BIDSRAF Demo with S2P", abstract="""BIDSRAF demo: process s2p on roi""", inputs=inputs, outputs=outputs, store_supported=True, status_supported=True )
def test_bbox_input(self): bbox = BoundingBoxInput('bbox', 'BBox foo', keywords=['kw1', 'kw2'], crss=["EPSG:4326", "EPSG:3035"]) data = bbox.json assert data["identifier"] == "bbox" assert len(data["keywords"]) == 2 assert len(data["crss"]) == 2 assert data["crss"][0] == "EPSG:4326" assert data["dimensions"] == 2
def create_bbox_process(): def bbox_process(request, response): coords = request.inputs['mybbox'][0].data assert isinstance(coords, list) assert len(coords) == 4 assert coords[0] == '15' response.outputs['outbbox'].data = coords return response return Process(handler=bbox_process, identifier='my_bbox_process', title='Bbox process', inputs=[BoundingBoxInput('mybbox', 'Input name', ["EPSG:4326"])], outputs=[BoundingBoxOutput('outbbox', 'Output message', ["EPSG:4326"])])
def __init__(self): inputs = [BoundingBoxInput('bboxin', 'box in', ['epsg:4326', 'epsg:3035'])] outputs = [BoundingBoxOutput('bboxout', 'box out', ['epsg:4326'])] super(Box, self).__init__( self._handler, identifier='boundingbox', version='0.1', title="Bounding box in- and out", abstract='Give bounding box, return the same', inputs=inputs, outputs=outputs, store_supported=True, status_supported=True )
def __init__(self): inputs = [ LiteralInput('title', 'Title', data_type='string', abstract="Title of run"), LiteralInput('longitude', 'Longitude', data_type='float', abstract="Location of release", default=-24.867222), LiteralInput('latitude', 'Latitude', data_type='float', abstract="Location of release", default=16.863611), LiteralInput('elevation', 'Elevation', data_type='integer', abstract="Elevation of release, m agl for land, m asl for marine release", default=10, min_occurs=0), # LiteralInput('elevation_range_min','Elevation Range Min', data_type='integer', # abstract="Minimum range of elevation", # default=None, min_occurs=0), # LiteralInput('elevation_range_max', 'Elevation Range Max', data_type='integer', # abstract = "Maximum range of elevation", # default=None, min_occurs=0), LiteralInput('runBackwards', 'Run Backwards', data_type='boolean', abstract = 'Whether to run backwards in time or forwards', default = '1', min_occurs=0), LiteralInput('time', 'Time to run model over', data_type='integer', abstract = '', default=1), LiteralInput('timeFmt',' ', data_type='string', abstract='number of days/hours NAME will run over. Maximum is 20 days.', allowed_values = ['days','hours'], default='days'), BoundingBoxInput('domain', 'Computational Domain', crss=['epsg:4326'], abstract='Coordinates to run NAME within', min_occurs=1), LiteralInput('elevationOut', 'Output elevation averaging range(s)', data_type='string', abstract='Elevation range where the particle number is counted (m agl)' " Example: 0-100", default='0-100', min_occurs=1, max_occurs=4), LiteralInput('resolution','Resolution', data_type='float', abstract='degrees, note the UM global Met data was only 17Km resolution', allowed_values=[0.05,0.25], default=0.25, min_occurs=0), LiteralInput('timestamp','Run Type', data_type='string', abstract='how often NAME will run', allowed_values=['3-hourly','daily']), LiteralInput('dailytime','Daily run time (UTC)', data_type='time', abstract='if running daily, at what time will it run', min_occurs = 0), LiteralInput('dailyreleaselen', 'Daily release length', data_type='integer', abstract='if running daily, over how many hours will it release?', allowed_values=[1, 3, 6, 12, 24], min_occurs=0), LiteralInput('startdate', 'Start date', data_type='date', abstract='UTC start date of runs'), LiteralInput('enddate', 'End date', data_type='date', abstract = 'UTC end date of runs (inclusive)'), ] outputs = [ LiteralOutput('runid', 'Run ID', data_type='string', abstract='Unique run identifier, this is needed to create plots'), ComplexOutput('FileContents', 'Output files (zipped)', abstract="Output files (zipped)", supported_formats=[Format('application/x-zipped-shp')], as_reference=True), ComplexOutput('ExamplePlot', 'Example Plot of initial time point', abstract='Example plot of initial time point', supported_formats=[Format('image/tiff')], as_reference=True), ] super(RunNAME, self).__init__( self._handler, identifier='runname', title='Run NAME-on-JASMIN', abstract="Run NAME using user-defined settings", version='0.1', metadata=[ Metadata('NAME-on-JASMIN guide', 'http://jasmin.ac.uk/jasmin-users/stories/processing/'), ], inputs=inputs, outputs=outputs, store_supported=True, status_supported=True)