Skip to content

Commit 4d17ea1

Browse files
authored
Merge pull request #142 from barronh/bugfix/gcnc-ll2ij
Bugfix/gcnc ll2ij
2 parents 1b628c4 + ce530a9 commit 4d17ea1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def find_data():
8383

8484
setup(
8585
name='PseudoNetCDF',
86-
version='3.2.2',
86+
version='3.2.3',
8787
author='Barron Henderson',
8888
author_email='barronh@gmail.com',
8989
maintainer='Barron Henderson',

src/PseudoNetCDF/geoschemfiles/_gcnc.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -69,21 +69,21 @@ def ll2ij(self, lon, lat, bounds='error', clean='none'):
6969
else:
7070
missi, = np.where(i.mask)
7171
missj, = np.where(j.mask)
72-
lowi, = np.where(~easter[missi].any(1))
73-
highi, = np.where(~wester[missi].any(1))
74-
lowj, = np.where(~norther[missj].any(1))
75-
highj, = np.where(~souther[missj].any(1))
76-
outb = (lowi | lowj | highi | highj)
72+
outb = i.mask | j.mask
7773
nout = outb.sum()
7874
if nout > 0:
79-
message = '{} Points out of bounds; {}'.format(
80-
nout, np.where(outb))
75+
message = '{} Points out of bounds {:.1%}; {}'.format(
76+
nout, nout/i.size, np.where(outb))
8177
if bounds == 'error':
8278
raise ValueError(message)
8379
else:
8480
warn(message)
8581

8682
if clean == 'clip':
83+
highi, = np.where(easter[:].all(1))
84+
lowi, = np.where(wester[:].all(1))
85+
highj, = np.where(norther[:].all(1))
86+
lowj, = np.where(souther[:].all(1))
8787
i[lowi] = 0
8888
i[highi] = nx - 1
8989
j[lowj] = 0

0 commit comments

Comments
 (0)