@@ -292,12 +292,6 @@ def test_geopandas(self):
292292 expected_df = gpd .GeoDataFrame (
293293 # pylint: disable=line-too-long
294294 {
295- "scalerank" : [7 , 7 , 6 , 5 , 5 , 5 , 3 ],
296- "website" : ["www.ghanaports.gov.gh" , "www.nationalportauthorityliberia.org" , None , "www.paa-ci.org" , None , None , "www.paa-ci.org" ],
297- "NDVI" : [nan , 178.0 , 108.0 , 99.0 , 159.0 , 128.0 , 126.0 ],
298- "natlscale" : [10.0 , 10.0 , 20.0 , 30.0 , 30.0 , 30.0 , 75.0 ],
299- "featurecla" : ["Port" , "Port" , "Port" , "Port" , "Port" , "Port" , "Port" ],
300- "name" : ["Tema" , "Buchanan" , "Nieuw Nickerie" , "Abidjan" , "Kourou" , "Paramaribo" , "Abidjan" ],
301295 "geometry" : [
302296 Point (0.007420495 , 5.631944444 ),
303297 Point (- 10.05265018 , 5.858055556 ),
@@ -307,6 +301,12 @@ def test_geopandas(self):
307301 Point (- 55.13898704 , 5.82 ),
308302 Point (- 4.021260306 , 5.283333333 ),
309303 ],
304+ "scalerank" : [7 , 7 , 6 , 5 , 5 , 5 , 3 ],
305+ "website" : ["www.ghanaports.gov.gh" , "www.nationalportauthorityliberia.org" , None , "www.paa-ci.org" , None , None , "www.paa-ci.org" ],
306+ "NDVI" : [nan , 178.0 , 108.0 , 99.0 , 159.0 , 128.0 , 126.0 ],
307+ "natlscale" : [10.0 , 10.0 , 20.0 , 30.0 , 30.0 , 30.0 , 75.0 ],
308+ "featurecla" : ["Port" , "Port" , "Port" , "Port" , "Port" , "Port" , "Port" ],
309+ "name" : ["Tema" , "Buchanan" , "Nieuw Nickerie" , "Abidjan" , "Kourou" , "Paramaribo" , "Abidjan" ],
310310 "start" : [datetime .strptime (
311311 '2014-04-01T00:00:00.000Z' , "%Y-%m-%dT%H:%M:%S.%f%z" ) for _ in range (7 )],
312312 "end" : [datetime .strptime (
@@ -404,6 +404,103 @@ def test_wfs_curl(self):
404404 """curl -X GET -H "Authorization: Bearer e327d9c3-a4f3-4bd7-a5e1-30b26cae8064" 'http://mock-instance/wfs/956d3656-2d14-5951-96a0-f962b92371cd?service=WFS&version=2.0.0&request=GetFeature&outputFormat=application%2Fjson&typeNames=956d3656-2d14-5951-96a0-f962b92371cd&bbox=-60.0%2C5.0%2C61.0%2C6.0&time=2014-04-01T12%3A00%3A00.000%2B00%3A00&srsName=EPSG%3A4326&queryResolution=0.1%2C0.1'"""
405405 )
406406
407+ def test_wfs_error (self ):
408+ with requests_mock .Mocker () as m :
409+ m .post ('http://mock-instance/anonymous' , json = {
410+ "id" : "e327d9c3-a4f3-4bd7-a5e1-30b26cae8064" ,
411+ "user" : {
412+ "id" : "328ca8d1-15d7-4f59-a989-5d5d72c98744" ,
413+ },
414+ "created" : "2021-06-08T15:22:22.605891994Z" ,
415+ "validUntil" : "2021-06-08T16:22:22.605892183Z" ,
416+ "project" : None ,
417+ "view" : None
418+ })
419+
420+ m .post ('http://mock-instance/workflow' ,
421+ json = {
422+ "id" : "956d3656-2d14-5951-96a0-f962b92371cd"
423+ },
424+ request_headers = {'Authorization' : 'Bearer e327d9c3-a4f3-4bd7-a5e1-30b26cae8064' })
425+
426+ m .get ('http://mock-instance/workflow/956d3656-2d14-5951-96a0-f962b92371cd/metadata' ,
427+ json = {
428+ "type" : "vector" ,
429+ "dataType" : "MultiPoint" ,
430+ "spatialReference" : "EPSG:4326" ,
431+ "columns" : {
432+ "natlscale" : "float" ,
433+ "featurecla" : "text" ,
434+ "scalerank" : "int" ,
435+ "name" : "text" ,
436+ "NDVI" : "int" ,
437+ "website" : "text"
438+ }
439+ },
440+ request_headers = {'Authorization' : 'Bearer e327d9c3-a4f3-4bd7-a5e1-30b26cae8064' })
441+
442+ m .get ('http://mock-instance/wfs/956d3656-2d14-5951-96a0-f962b92371cd' ,
443+ json = {
444+ "error" : "Operator" ,
445+ "message" : 'Operator: Could not open gdal dataset for file path '
446+ '"test_data/raster/modis_ndvi/MOD13A2_M_NDVI_2004-04-01.TIFF"'
447+ },
448+ status_code = 400 ,
449+ request_headers = {'Authorization' : 'Bearer e327d9c3-a4f3-4bd7-a5e1-30b26cae8064' }
450+ )
451+
452+ ge .initialize ("http://mock-instance" )
453+
454+ workflow_definition = {
455+ "type" : "Vector" ,
456+ "operator" : {
457+ "type" : "RasterVectorJoin" ,
458+ "params" : {
459+ "names" : ["NDVI" ],
460+ "featureAggregation" : "first" ,
461+ "temporalAggregation" : "none"
462+ },
463+ "sources" : {
464+ "vector" : {
465+ "type" : "OgrSource" ,
466+ "params" : {
467+ "dataset" : {
468+ "type" : "internal" ,
469+ "datasetId" : "a9623a5b-b6c5-404b-bc5a-313ff72e4e75"
470+ },
471+ "attributeProjection" : None
472+ }
473+ },
474+ "rasters" : [{
475+ "type" : "GdalSource" ,
476+ "params" : {
477+ "dataset" : {
478+ "type" : "internal" ,
479+ "datasetId" : "36574dc3-560a-4b09-9d22-d5945f2b8093"
480+ }
481+ }
482+ }]
483+ }
484+ }
485+ }
486+
487+ time = datetime .strptime (
488+ '2004-04-01T12:00:00.000Z' , "%Y-%m-%dT%H:%M:%S.%f%z" )
489+
490+ workflow = ge .register_workflow (workflow_definition )
491+
492+ with self .assertRaises (ge .GeoEngineException ) as ctx :
493+ workflow .get_dataframe (
494+ QueryRectangle (
495+ [- 60.0 , 5.0 , 61.0 , 6.0 ],
496+ [time , time ]
497+ )
498+ )
499+
500+ self .assertEqual (str (ctx .exception ),
501+ 'Operator: Operator: Could not open gdal dataset for file path '
502+ '"test_data/raster/modis_ndvi/MOD13A2_M_NDVI_2004-04-01.TIFF"' )
503+
407504 def test_repr (self ):
408505 with requests_mock .Mocker () as m :
409506 m .post ('http://mock-instance/anonymous' , json = {
0 commit comments