Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Problem with np.sum in 00spinup.py #7

Open
aktriplett opened this issue Oct 30, 2020 · 1 comment
Open

Problem with np.sum in 00spinup.py #7

aktriplett opened this issue Oct 30, 2020 · 1 comment

Comments

@aktriplett
Copy link

When adding up np arrays, using np.sum results in subsurface_storage, surface_storage and et unable to be calculated because they have undefined values outside the mask.
This was fixed for me by changing np.sum to np.nansum. This has worked for myself and Jun Zhang.

Ex. below:
# total subsurface storage for this time step is the summation of substorage across all x/y/z slices
subsurface_storage[i, ...] = np.nansum(
calculate_subsurface_storage(mask, porosity, pressure, saturation, specific_storage, dx, dy, dz),
axis=(0, 1, 2)
)

@vineetbansal
Copy link
Contributor

@aktriplett .. I was purposely avoiding a nansum because undefined values of pressure/saturation outside the mask should have no bearing on the subsurface storage calculations, and the code should be tolerant of those values. The results of the calculate_subsurface_storage function should not return any nans. If they are, then you've likely discovered a bug. Let me get in contact with you to get more details on this..

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants