refactor dtopotools.create_dtopography to avoid memory issues #664
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As originally written, the deformation dtopo.dZ was computed for each subfault and stored, and then summed up over all subfaults. In a CSZ problem with 8000 subfaults and fine resolution dtopo grids, this ran out of memory. The refactored version computes and uses each subfault dtopo in a way that it can be discarded before computing the next subfault deformation.
Also added a
slip_tolparameter so that the deformation is not computed for any subfaults with smaller slip than this tolerance (which could be a large fraction of the subfaults in some situations, e.g. a small localized earthquake on a large subduction zone fault surface).Also the
verboseparameter can now be an integer, in which case it prints the subfault numberkduring processing only ifnumpy.mod(k,verbose) == 0.I tested this with the dtopotools_examples notebook and both the static and kinematic version seem to work fine, though a small change in maximum
dZof2e-4that violates an assertion in the notebook. But that already failed onmaster, so I'll look into that separately.