cpalfonso / stellar-data-mining

Scripts to extract subduction-related data for mineral exploration data mining
1 stars 1 forks source link

create probability animations notebook #8

Open RichardScottOZ opened 1 month ago

RichardScottOZ commented 1 month ago
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[6], line 9
      6 probs_dir = os.path.join(output_dir, algorithm, "probability_grids")
      8 print(f"{algorithm} example plot:")
----> 9 fig = plot(
     10     gplot=gplot,
     11     probabilities=os.path.join(
     12         probs_dir,
     13         f"probability_grid_{t_example:0.0f}Ma.nc",
     14     ),
     15     positives=positives,
     16     projection=projection,
     17     time=t_example,
     18     central_meridian=-100,
     19 )

File ~/data/stellar-data-mining/lib/visualisation.py:184, in plot(gplot, probabilities, projection, time, positives, output_filename, central_meridian, imshow_kwargs)
    174 gplot.plot_all_topological_sections(
    175     ax=ax,
    176     central_meridian=central_meridian,
    177     **TOPOLOGIES_KWARGS,
    178 )
    179 gplot.plot_ridges_and_transforms(
    180     ax=ax,
    181     central_meridian=central_meridian,
    182     **RIDGES_KWARGS,
    183 )
--> 184 gplot.plot_subduction_teeth(ax=ax, **TEETH_KWARGS)
    186 if positives is not None:
    187     ax.plot(
    188         "lon",
    189         "lat",
    190         data=positives,
    191         **SCATTER_KWARGS,
    192     )

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/gplately/plot.py:2403, in PlotTopologies.plot_subduction_teeth(self, ax, spacing, size, aspect, color, **kwargs)
   2392 trench_left_features = shapelify_feature_lines(
   2393     self.trench_left,
   2394     tessellate_degrees=tessellate_degrees,
   2395     central_meridian=central_meridian,
   2396 )
   2397 trench_right_features = shapelify_feature_lines(
   2398     self.trench_right,
   2399     tessellate_degrees=tessellate_degrees,
   2400     central_meridian=central_meridian,
   2401 )
-> 2403 plot_subduction_teeth(
   2404     trench_left_features,
   2405     size,
   2406     "l",
   2407     height,
   2408     spacing,
   2409     projection=projection,
   2410     ax=ax,
   2411     color=color,
   2412     **kwargs,
   2413 )
   2414 plot_subduction_teeth(
   2415     trench_right_features,
   2416     size,
   (...)
   2423     **kwargs,
   2424 )

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/gplately/plot.py:159, in plot_subduction_teeth(geometries, width, polarity, height, spacing, projection, transform, ax, **kwargs)
    156     triangles = [domain.intersection(i) for i in triangles]
    158 if hasattr(ax, "add_geometries") and projection is not None:
--> 159     ax.add_geometries(triangles, crs=projection, **kwargs)
    160 else:
    161     for triangle in triangles:

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:748, in GeoAxes.add_geometries(self, geoms, crs, **kwargs)
    746 styler = kwargs.pop('styler', None)
    747 feature = cartopy.feature.ShapelyFeature(geoms, crs, **kwargs)
--> 748 return self.add_feature(feature, styler=styler)

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/cartopy/mpl/geoaxes.py:717, in GeoAxes.add_feature(self, feature, **kwargs)
    696 """
    697 Add the given :class:`~cartopy.feature.Feature` instance to the axes.
    698 
   (...)
    714 
    715 """
    716 # Instantiate an artist to draw the feature and add it to the axes.
--> 717 artist = feature_artist.FeatureArtist(feature, **kwargs)
    718 return self.add_collection(artist)

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/cartopy/mpl/feature_artist.py:127, in FeatureArtist.__init__(self, feature, **kwargs)
    124 self.set_zorder(1.5)
    126 # Update drawing styles from the feature and **kwargs.
--> 127 self.set(**feature.kwargs)
    128 self.set(**self._kwargs)
    130 self._feature = feature

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/matplotlib/artist.py:147, in Artist.__init_subclass__.<locals>.<lambda>(self, **kwargs)
    139 if not hasattr(cls.set, '_autogenerated_signature'):
    140     # Don't overwrite cls.set if the subclass or one of its parents
    141     # has defined a set method set itself.
    142     # If there was no explicit definition, cls.set is inherited from
    143     # the hierarchy of auto-generated set methods, which hold the
    144     # flag _autogenerated_signature.
    145     return
--> 147 cls.set = lambda self, **kwargs: Artist.set(self, **kwargs)
    148 cls.set.__name__ = "set"
    149 cls.set.__qualname__ = f"{cls.__qualname__}.set"

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/matplotlib/artist.py:1224, in Artist.set(self, **kwargs)
   1220 def set(self, **kwargs):
   1221     # docstring and signature are auto-generated via
   1222     # Artist._update_set_signature_and_docstring() at the end of the
   1223     # module.
-> 1224     return self._internal_update(cbook.normalize_kwargs(kwargs, self))

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/matplotlib/artist.py:1216, in Artist._internal_update(self, kwargs)
   1209 def _internal_update(self, kwargs):
   1210     """
   1211     Update artist properties without prenormalizing them, but generating
   1212     errors as if calling `set`.
   1213 
   1214     The lack of prenormalization is to maintain backcompatibility.
   1215     """
-> 1216     return self._update_props(
   1217         kwargs, "{cls.__name__}.set() got an unexpected keyword argument "
   1218         "{prop_name!r}")

File ~/miniconda3/envs/sdm/lib/python3.12/site-packages/matplotlib/artist.py:1190, in Artist._update_props(self, props, errfmt)
   1188             func = getattr(self, f"set_{k}", None)
   1189             if not callable(func):
-> 1190                 raise AttributeError(
   1191                     errfmt.format(cls=type(self), prop_name=k))
   1192             ret.append(func(v))
   1193 if ret:

AttributeError: FeatureArtist.set() got an unexpected keyword argument 'markerfacecolor'
RichardScottOZ commented 1 month ago

Another plot subduction teeth issue