MCPcopy Create free account
hub / github.com/MarcCoru/locationencoder / draw_globe

Function draw_globe

utils/plot_results.py:176–208  ·  view source on GitHub ↗
(y, lonlats, plot_points, title)

Source from the content-addressed store, hash-verified

174
175
176def draw_globe(y, lonlats, plot_points, title):
177
178 y = y.squeeze()
179
180 fig = plt.figure()
181 map = Basemap(projection='ortho', lat_0=45, lon_0=30, resolution='l')
182 ax = plt.gca()
183 # draw coastlines, country boundaries, fill continents.
184 map.drawcoastlines(linewidth=0.25)
185 # map.drawcountries(linewidth=0.25)
186 map.fillcontinents(color='coral', lake_color='aqua')
187 # draw the edge of the map projection region (the projection limb)
188 # map.drawmapboundary(fill_color='aqua')
189 # draw lat/lon grid lines every 30 degrees.
190 map.drawmeridians(np.arange(0, 360, 30))
191 map.drawparallels(np.arange(-90, 90, 30))
192
193 lons, lats = lonlats.T
194 values = y.detach().numpy() # .reshape(-1)
195
196 x, y = map(lons.numpy() % 360, lats.numpy())
197
198 map.contourf(x.reshape(180, 360), y.reshape(180, 360), values, cmap="RdBu_r", alpha=.75)
199 map.contour(x.reshape(180, 360), y.reshape(180, 360), values, colors="white", alpha=.5)
200
201 if plot_points is not None:
202 plot_x, plot_y = map(plot_points[:, 0].numpy() % 360, plot_points[:, 1])
203 map.scatter(plot_x, plot_y, c="red")
204
205 if title is not None:
206 ax.set_title(title)
207
208 return fig
209
210def find_matrix_plot_filename(resultsdir, pe, nn):
211 candidates = os.listdir(resultsdir)

Callers 1

plot_predictionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected