Ouranosinc / raven

WPS services related to hydrological modeling
https://pavics-raven.readthedocs.io
MIT License
37 stars 12 forks source link

NALCMS not functionning properly for a zipped shapefile archive as delimiting shape #119

Closed richardarsenault closed 5 years ago

richardarsenault commented 5 years ago

Trying to extract NALCMS data using a shapefile as vector shape data. .shp, .shx and .dbf are in a zip archive. Replacing "shape=TESTDATA['mrc_subset'] with a custom path to my zip, the code runs but I get an error:


Traceback (most recent call last): File "/home/ets/src/raven/raven/utilities/gis.py", line 175, in get_raster_wcs subsets=[(x, left, right), (y, down, up)]) File "/home/ets/anaconda3/envs/raven/lib/python3.6/site-packages/owslib/coverage/wcs201.py", line 178, in getCoverage u=openURL(base_url, data, method, self.cookies) File "/home/ets/anaconda3/envs/raven/lib/python3.6/site-packages/owslib/util.py", line 196, in openURL req.raise_for_status() File "/home/ets/anaconda3/envs/raven/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://boreas.ouranos.ca/geoserver/wcs?version=2.0.1&request=GetCoverage&service=WCS&CoverageID=public%3ACEC_NALCMS_LandUse_2010&format=image%2Ftiff&subset=E%280.0%2C0.0%29&subset=N%280.0%2C0.0%29

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/ets/anaconda3/envs/raven/lib/python3.6/site-packages/pywps/app/Process.py", line 200, in _run_process self.handler(wps_request, wps_response) # the user must update the wps_response. File "/home/ets/src/raven/raven/processes/wps_nalcms_zonal_stats.py", line 142, in _handler raster_bytes = gis.get_raster_wcs(bbox, geographic=False, layer=raster_url) File "/home/ets/src/raven/raven/utilities/gis.py", line 178, in get_raster_wcs raise Exception(e) Exception: 404 Client Error: Not Found for url: https://boreas.ouranos.ca/geoserver/wcs?version=2.0.1&request=GetCoverage&service=WCS&CoverageID=public%3ACEC_NALCMS_LandUse_2010&format=image%2Ftiff&subset=E%280.0%2C0.0%29&subset=N%280.0%2C0.0%29

/home/ets/src/raven/tests/test_wps_nalcms_zonal_stats.py(94)test_wcs_simplified_categories() -> assert_response_success(resp)


When I view the XML message by following the link directly (URL: https://boreas.ouranos.ca/geoserver/wcs?version=2.0.1&request=GetCoverage&service=WCS&CoverageID=public%3ACEC_NALCMS_LandUse_2010&format=image%2Ftiff&subset=E%280.0%2C0.0%29&subset=N%280.0%2C0.0%29), I get this:


Subsetting error using NALCMS:

Empty intersection after subsetting [] _______________________ I've placed the zip file here: [Basin_test.zip](https://github.com/Ouranosinc/raven/files/3157025/Basin_test.zip)
richardarsenault commented 5 years ago

I've tried also resaving the file with WGS84 CRS and it still fails. GPKG seems to work on the generic zonal stats though, so I'll try that for the NALCMS zonal stats.

tlvu commented 5 years ago

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://boreas.ouranos.ca/geoserver/wcs?version=2.0.1&request=GetCoverage&service=WCS&CoverageID=public%3ACEC_NALCMS_LandUse_2010&format=image%2Ftiff&subset=E%280.0%2C0.0%29&subset=N%280.0%2C0.0%29

I think you need to replace the server hostname from boreas to pavics.

Zeitsperre commented 5 years ago

From the URL, I can see that it isn't reading the shapefile properly since the coordinates in the subset (E and N) suggest it's a non-geographic CRS. It could be that the zip isn't properly formatted?

Do you think you could zip all the files (including the .prj and .cpj etc) and rerun? I may have added a function to check projection that is failing if the .prj isn't there.

Zeitsperre commented 5 years ago

Never mind, the error is on my side and it's worse than I thought. I'll get this working today.