Skip to content

Commit

Permalink
Change a "is" to "==" check in process_weights()
Browse files Browse the repository at this point in the history
When checking for equality of weights grid and raster grid, relative sizes
of lat were checked with "is", but lon with "==". "==" is the more robust
option for this.
  • Loading branch information
ks905383 committed Feb 17, 2022
1 parent 1e1cd5e commit 4ac0c0f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xagg/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def process_weights(ds,weights=None,target='ds'):

# Regrid, if necessary (do nothing if the grids match up to within
# floating-point precision)
if ((not ((ds.sizes['lat'] is weights.sizes['lat']) & (ds.sizes['lon'] == weights.sizes['lon']))) or
if ((not ((ds.sizes['lat'] == weights.sizes['lat']) & (ds.sizes['lon'] == weights.sizes['lon']))) or
(not (np.allclose(ds.lat,weights.lat) & np.allclose(ds.lon,weights.lon)))):
if target == 'ds':
print('regridding weights to data grid...')
Expand Down

0 comments on commit 4ac0c0f

Please sign in to comment.