0

There's a very similar problem to my problem here, but the solution recommended on this page does not work in my case. For projection 'cyl', beach balls are plotted. Changing this projection to 'robin' (robinson) creates the projection without the data (beach balls). The recommendation for the other similar problem was to use:

x,y = map(lat, lon)

in order to convert the coordinates to the applicable projection but this is also included in my code (see below):

m = Basemap(projection='cyl', lon_0=0, resolution='c')
m.drawmapboundary(fill_color='cornflowerblue')
m.drawcountries()
m.fillcontinents(color='white',lake_color='cornflowerblue',
zorder=0)
m.drawcoastlines()
m.drawparallels(np.arange(-90.,120.,30.))
m.drawmeridians(np.arange(0.,420.,60.))

lats = [38.3215, -55.285, -56.241, -60.274]
lons = [142.36929, -31.877, -26.935, -46.401]

x, y = m(lons, lats)
focmecs = [[193, 9, 78], [301, 62, 84], [101, 69, -56], [190, 89, -140]]
eq_mw = [9.0, 7.4, 7.2, 7.7]

ax = plt.gca()
for i in range(len(focmecs)):
# Loop to set the tensor (beach ball) colors
eq = eq_mw[i]
if eq < 6:
    beachball_color = 'y'
elif 6 <= eq < 8:
    beachball_color = 'orange'
elif 8 <= eq:
    beachball_color = 'r'

b = beach(focmecs[i], facecolor=beachball_color, xy=(x[i], y[i]), width=10, linewidth=1, alpha=0.85)
b.set_zorder(10)
ax.add_collection(b)
mtrw
  • 34,200
  • 7
  • 63
  • 71
pymat
  • 1,090
  • 1
  • 23
  • 45

1 Answers1

0

The problem lies it seems with the projection and the axis or data coordinates transformation. When the width was changed from 10 to 1000000, then this resolves the issue:

b = beach(focmecs[i], facecolor=beachball_color, xy=(x[i], y[i]), width=1000000, linewidth=1, alpha=0.85)
pymat
  • 1,090
  • 1
  • 23
  • 45