WeatherMagic / thor

Back end service for the delivery of climate data
1 stars 1 forks source link

Interpolation fix #26

Closed owodunni closed 7 years ago

owodunni commented 7 years ago

When the going gets tough the tough gets going!

Can interpolate in 2d or 3d depending on what data is requested. Also gives errors if 0d and 1d data/interpolation is requested. No need to lock down the API for now atleast, I'm sure front end will have us doing it eventually.....

Please find a bug there is bound to be one!!!!

hansfilipelo commented 7 years ago
{
    "from-year": "2012",
    "from-month": "6",
    "to-year": "2012",
    "to-month": "6",
    "from-longitude": "-1",
    "to-longitude": "34",
    "from-latitude": "27",
    "to-latitude": "27",
    "return-dimension": [1,200,200]
}

Gives:

[2016-11-22 10:16:42,554] ERROR in app: Exception on /api/temperature [POST]
Traceback (most recent call last):
  File "/Users/fille/src/thor/env/lib/python3.5/site-packages/flask/app.py", line 1988, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/fille/src/thor/env/lib/python3.5/site-packages/flask/app.py", line 1641, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/fille/src/thor/env/lib/python3.5/site-packages/flask/app.py", line 1544, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/Users/fille/src/thor/env/lib/python3.5/site-packages/flask/_compat.py", line 33, in reraise
    raise value
  File "/Users/fille/src/thor/env/lib/python3.5/site-packages/flask/app.py", line 1639, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/fille/src/thor/env/lib/python3.5/site-packages/flask/app.py", line 1625, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/Users/fille/src/thor/thor/routes.py", line 51, in api
    const.log))
  File "/Users/fille/src/thor/thor/request.py", line 83, in handleRequest
    returnDimension)
  File "/Users/fille/src/thor/thor/sigProcess.py", line 52, in interpolate
    interpolDim))
  File "/Users/fille/src/thor/thor/sigProcess.py", line 86, in interpolateFunc
    return weatherInterpolationFunc(interPoints).reshape(returnDimension)
  File "/Users/fille/src/thor/env/lib/python3.5/site-packages/scipy/interpolate/interpolate.py", line 2355, in __call__
    if not np.logical_and(np.all(self.grid[i][0] <= p),
IndexError: index 0 is out of bounds for axis 0 with size 0