home / github / issue_comments

Menu
  • Search all tables
  • GraphQL API

issue_comments: 157642290

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/657#issuecomment-157642290 https://api.github.com/repos/pydata/xarray/issues/657 157642290 MDEyOklzc3VlQ29tbWVudDE1NzY0MjI5MA== 10050469 2015-11-18T08:24:23Z 2015-11-18T08:24:45Z MEMBER

Thanks @pelson ! So now this is when it becomes funny: I've been able to make three similar plots using xray's imshow, pcolormesh and cartopy's pcolormesh. Xray's pcolormesh takes twice the time as cartopy's:

``` python import matplotlib.pyplot as plt from matplotlib.colors import Normalize import xray import numpy as np import cartopy.crs as ccrs import time

nlats, nlons = (241, 480) lats = np.linspace(90, -90, nlats) lons = np.linspace(0, 360-0.75, nlons) l1, l2 = np.meshgrid(lons, lats) data = xray.DataArray(l1 + l2, [('latitude', lats), ('longitude', lons)])

cmap = plt.get_cmap('viridis') norm = Normalize(vmin=0, vmax=data.max().values)

start_time = time.time() fig = plt.figure() ax = plt.axes(projection=ccrs.Robinson()) data.plot.imshow(ax=ax, transform=ccrs.PlateCarree(), add_colorbar=False, cmap=cmap, vmin=0) ax.coastlines() plt.savefig('imshow_xray.png') print("imshow xray: {:.2f} s".format(time.time() - start_time))

start_time = time.time() fig = plt.figure() ax = plt.axes(projection=ccrs.Robinson()) data.plot.pcolormesh(ax=ax, transform=ccrs.PlateCarree(), add_colorbar=False, cmap=cmap, vmin=0) ax.coastlines() plt.savefig('pcolormesh_xray.png') print("pcolormesh xray: {:.2f} s".format(time.time() - start_time))

start_time = time.time() fig = plt.figure() ax = plt.axes(projection=ccrs.Robinson()) ax.pcolormesh(lons, lats, l1 + l2, transform=ccrs.PlateCarree(), cmap=cmap, norm=norm) ax.coastlines() plt.savefig('pcolormesh_cartopy.png') print("pcolormesh cartopy: {:.2f} s".format(time.time() - start_time))

```

imshow xray: 3.06 s pcolormesh xray: 27.50 s pcolormesh cartopy: 12.14 s

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  117002929
Powered by Datasette · Queries took 0.663ms · About: xarray-datasette