openskope / skope-interface

The new SKOPE web portal interface.
https://www.openskope.org
4 stars 2 forks source link

Graph view should not display raw error when the focus boundary is not included by the dataset boundary. #199

Open Zodiase opened 6 years ago

Zodiase commented 6 years ago

From @kintigh:

If you select an area outside the dataset boundary (which you probably should not be able to do) you get an error when graph view tries to draw a graph.

Zodiase commented 6 years ago

@kintigh I'm not sure what would be the best way to do the geometry inclusion test on the client. Even though there are only rectangles and points, since we are planning to have more shapes soon (like circles), if there's a check it'd better to cover as much of the use case as possible, which basically means checking between two polygons.

A quick workaround for now, since the server is returning this error, is to present the error better instead of showing the raw message, just like the timeout error. Do you think that would resolve this issue for now? If so, what do you think would be a good error message? How about "Please only select a point or area within the boundary"?

kintigh commented 6 years ago

That is reasonable. I just didn't want a data error. How about. "Please select a point or area within the dataset boundary. "

bocinsky commented 6 years ago

I just wanted to note that if a user selects an area that crosses the dataset boundary, it succeeds silently, presumably just averaging over the desired area within the dataset. This is probably the desired behavior, but we might want to alert the user somehow that the calculated area is smaller than that which they specified. Perhaps automatically crop their selected area to the dataset boundary?

tmcphillips commented 6 years ago

This issue is resolved for points, but not rectangular regions.

If I click on a point outside the data set coverage in Graph View I get the error "Please select a point or area within the dataset boundary", as expected.

However, if I select a rectangle outside the data set coverage, I still get the error message, "Error when requesting data."

Zodiase commented 6 years ago

@tmcphillips

When a point outside of the boundary is used, I receive the following error from the time-series server:

{  
   "timestamp":1530110557814,
   "status":400,
   "error":"Bad Request",
   "exception":"org.openskope.timeseries.controller.InvalidArgumentException",
   "message":"Coordinates are outside region covered by the dataset",
   "path":"/timeseries-service/api/v1/timeseries/lbda-v2/palmer_modified_drought_index"
}

and a match with the error message "Coordinates are outside region covered by the dataset" is used to determine the cause of the error (for displaying the user friendly error message).

But for a rectangle that is completely outside of the boundary, I get something like this:

{  
   "timestamp":1530110569634,
   "status":400,
   "error":"Bad Request",
   "exception":"org.openskope.timeseries.controller.InvalidArgumentException",
   "message":"Traceback (most recent call last):\n  File \"/usr/local/bin/zonalinfo.py\", line 149, in <module>\n    main()\n  File \"/usr/local/bin/zonalinfo.py\", line 118, in main\n    masked, transform, window = raster_geometry_mask(src, geoms, crop=True, all_touched=True)\n  File \"/usr/local/lib/python2.7/dist-packages/rasterio/mask.py\", line 87, in raster_geometry_mask\n    raise ValueError('Input shapes do not overlap raster.')\nValueError: Input shapes do not overlap raster.\n",
   "path":"/timeseries-service/api/v1/timeseries/lbda-v2/palmer_modified_drought_index"
}

I don't think I can reliably use the message to determine the cause of the error. Can I?

Also there is no error when the geometry is partially out of boundary.

tmcphillips commented 6 years ago

I just made changes to timeseries-service to return a Bad Request response with the message property set to "The selected area does not overlap the region covered by the dataset" when a request is made for a time series over an area entirely outside the coverage of the data set.

I'll build a new Docker image for the service.

Zodiase commented 6 years ago

The work here is for @tmcphillips to update the time series service to return proper error messages when the box selection is completely outside of the dataset boundary.

tmcphillips commented 6 years ago

I fixed this 12 days ago and thought it would be in the latest image running on staging, but I'm still seeing the old error when selecting a rectangle fully outside the dataset coverage. I'll try to figure out why the changes aren't reflected on staging.

tmcphillips commented 6 years ago

Ok, I manually pulled the latest image for the timeseries-service to both tacc-staging and staging. They now both return the following kind of response when selecting a rectangle outside the coverage:

{
"timestamp":1531175545250,
"status":400,"error":"Bad Request",
"exception":"org.openskope.timeseries.controller.InvalidArgumentException",
"message":"The selected area does not overlap the region covered by the dataset",
"path":"/timeseries-service/api/v1/timeseries/paleocar_2/water_year_precipitation"
}
Zodiase commented 6 years ago

Should be resolved in v0.1.30.