brendanjmeade / celeri

Next generation earthquake cycle kinematics
BSD 3-Clause "New" or "Revised" License
24 stars 7 forks source link

Faster spherical in polygon test and a few other closure improvements. #15

Closed tbenthompson closed 3 years ago

tbenthompson commented 3 years ago

The main thing here is a an optimization that cuts the runtime of assign_points down by ~10x from a couple minutes on the global model down to about 5-10 seconds. Before doing a full point in spherical polygon test, we first check if the point lies in the bounding box surrounding that polygon. Especially on the global model, this brings the runtime back down into "playing around" territory from "kind of annoying to play around" territory.

A couple other small things:

brendanjmeade commented 3 years ago

Trying to install following: https://anaconda.org/conda-forge/spherical-geometry and seeing:

conda install -c conda-forge spherical-geometry Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): \ WARNING conda.models.version:get_matcher(537): Using . with relational operator is superfluous and deprecated and will be removed in a future version of conda. Your spec was 3., but conda is ignoring the .* and treating it as 3 done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: | Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. failed UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:

Specifications:

Your python: python=3.8

If python is on the left-most side of the chain, that's the version you've asked for. When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.

brendanjmeade commented 3 years ago

The conda env celeri works fine after rebuiliding. Note that it took a bunch of vscode reboots for it to see the kernel (thanks for the tip internet). Right now I'm seeing an error on cell 8:

AttributeError: 'BlockClosureResult' object has no attribute 'polygon_vertices'

AttributeError Traceback (most recent call last) /var/folders/fl/sm71y44x3tqc7r1wc40k10gc0000gn/T/ipykernel_35522/1694575940.py in ----> 1 vertices = closure.polygon_vertices[6]

AttributeError: 'BlockClosureResult' object has no attribute 'polygon_vertices'

A bunch of these cells might be leftover from debugging?