Skip to content

Commit

Permalink
Fix the new Field slicing capability. Now passes all tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
brian-rose committed Apr 1, 2016
1 parent c109258 commit 4ecc4b8
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions climlab/domain/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,14 @@ def __getitem__(self, indx):
# dout._sharedmask = True
# # Note: Don't try to check for m.any(), that'll take too long
# Update the domain information ... at least the heat capacity
dout.domain.heat_capacity = domain.heat_capacity[indx]
dout.domain.shape = dout.shape
if hasattr(domain, 'heat_capacity'):
# in some cases (but not others) we need to slice this
try:
dout.domain.heat_capacity = domain.heat_capacity[indx]
except:
pass # preserve existing heat_capacity array
if hasattr(domain, 'shape'):
dout.domain.shape = dout.shape
return dout

# def __setitem__(self, indx, value):
Expand Down

0 comments on commit 4ecc4b8

Please sign in to comment.