From 4135d06edb041da02fbd75fe2e37044d466d45dc Mon Sep 17 00:00:00 2001 From: Bill Ladwig Date: Thu, 2 Nov 2017 16:35:50 -0600 Subject: [PATCH] Fix issue with incorrect number of gridpoints being computed via the xy routine. Fixes #30 . --- src/wrf/interputils.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wrf/interputils.py b/src/wrf/interputils.py index 114df41..c4af626 100644 --- a/src/wrf/interputils.py +++ b/src/wrf/interputils.py @@ -158,18 +158,19 @@ def _calc_xy(xdim, ydim, pivot_point=None, angle=None, raise ValueError("end_point {} is outside of domain " "with shape {}".format(end_point, (xdim, ydim))) + # From the original NCL code, but the error above will be thrown + # instead. if ( x1 > xdim-1 ): - x1 = xdim + x1 = xdim - 1 if ( y1 > ydim-1): - y1 = ydim + y1 = ydim - 1 else: raise ValueError("invalid start/end or pivot/angle arguments") dx = x1 - x0 dy = y1 - y0 distance = (dx*dx + dy*dy)**0.5 - npts = int(distance) - dxy = distance/npts + npts = int(distance) + 1 xy = np.zeros((npts,2), "float")