Commit 529fd24a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gridsearch: Added tolerance to bounding box (bug fix).

parent cb9c1c63
......@@ -206,8 +206,8 @@ void *gs_create_kdtree(size_t n, const double *restrict lons, const double *rest
for ( unsigned j = 0; j < 3; ++j )
{
// min[j] = min[j] < 0 ? min[j]*1.01 : min[j]*0.99;
// max[j] = max[j] < 0 ? max[j]*0.99 : max[j]*1.01;
min[j] = min[j] < 0 ? min[j]*1.01 : min[j]*0.99;
max[j] = max[j] < 0 ? max[j]*0.99 : max[j]*1.01;
gs->min[j] = min[j];
gs->max[j] = max[j];
}
......@@ -395,7 +395,15 @@ size_t gs_nearest_kdtree(void *search_container, double lon, double lat, double
kdata_t query_pt[3];
LLtoXYZ(lon, lat, query_pt);
/*
if ( lon*RAD2DEG > -27 && lon*RAD2DEG < 60 && lat*RAD2DEG > 30 && lat*RAD2DEG < 35 )
{
printf("lon %g lat %g\n", lon*RAD2DEG, lat*RAD2DEG);
for ( unsigned j = 0; j < 3; ++j )
if ( query_pt[j] < gs->min[j] || query_pt[j] > gs->max[j] )
printf(" %g %g\n", query_pt[j] - gs->min[j], query_pt[j] - gs->max[j]);
}
*/
if ( !gs->extrapolate )
for ( unsigned j = 0; j < 3; ++j )
if ( query_pt[j] < gs->min[j] || query_pt[j] > gs->max[j] ) return index;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment