uafgeotools / rtm

A Python package for locating infrasound sources using reverse time migration
https://uaf-rtm.readthedocs.io/
MIT License
38 stars 13 forks source link

Regional example plotting error #78

Closed liamtoney closed 1 year ago

liamtoney commented 1 year ago

The final (plotting) cell of the regional example fails, with:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In [6], line 1
----> 1 fig_slice = plot_time_slice(
      2     S, st_proc, label_stations=True, hires=False, plot_peak=True
      3 )
      4 fig_slice.set_size_inches([9, 12])
      5 fig_slice.show()

File ~/repos/rtm/rtm/plotting.py:146, in plot_time_slice(S, processed_st, time_slice, label_stations, hires, dem, plot_peak, xy_grid, cont_int, annot_int)
    144 if dem is None:
    145     if not S.UTM:
--> 146         _plot_geographic_context(ax=ax, hires=hires)
    147         alpha = 0.5
    148     else:

File ~/repos/rtm/rtm/plotting.py:531, in _plot_geographic_context(ax, hires)
    525     lake_scale = '50m'
    527 ax.add_feature(
    528     cfeature.GSHHSFeature(scale=gshhs_scale),
    529     facecolor=cfeature.COLORS['land'], zorder=0,
    530 )
--> 531 ax.background_patch.set_facecolor(cfeature.COLORS['water'])
    532 ax.add_feature(
    533     cfeature.LAKES.with_scale(lake_scale),
    534     facecolor=cfeature.COLORS['water'],
    535     edgecolor='black',
    536     zorder=0,
    537 )
    539 # Add states and provinces borders

AttributeError: 'GeoAxesSubplot' object has no attribute 'background_patch'

I suppose we need to update the plotting code for newer cartopy.