home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 117002929

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
117002929 MDU6SXNzdWUxMTcwMDI5Mjk= 657 Plotting on map projection much slower on v0.6.1 than 0.6.0 10050469 closed 0     19 2015-11-15T16:39:56Z 2016-06-15T21:10:38Z 2016-06-15T18:17:51Z MEMBER      

The following code snippet produces an average of ERA-Interim temperature on a map:

``` python import matplotlib.pyplot as plt import xray import cartopy.crs as ccrs import time

netcdf = xray.open_dataset('ERA-Int-Monthly-2mTemp.nc') t2_avg = netcdf.t2m.mean(dim='time')

start_time = time.time() ax = plt.axes(projection=ccrs.Robinson()) if xray.version == '0.6.0': t2_avg.plot(ax=ax, origin='upper', aspect='equal', transform=ccrs.PlateCarree()) else: t2_avg.plot(ax=ax, transform=ccrs.PlateCarree()) ax.coastlines() plt.savefig('t_xray.png') print("xray V{}: {:.2f} s".format(xray.version, time.time() - start_time)) ```

I've been very careful to check that my environments are exact same (mpl 1.4.3, numpy 1.10.1, cartopy 0.13.0).

See the output for V0.6.0 and 0.6.1 (output from the latest master is similar to 0.6.1):

0.6.0:

python python test_xray.py /home/mowglie/.bin/conda/envs/climate/lib/python3.4/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'): xray V0.6.0: 3.21 s

0.6.1:

python python test_xray.py /home/mowglie/.bin/conda/envs/upclim/lib/python3.4/site-packages/numpy/lib/shape_base.py:431: FutureWarning: in the future np.array_split will retain the shape of arrays with a zero size, instead of replacing them by `array([])`, which always has a shape of (0,). FutureWarning) /home/mowglie/.bin/conda/envs/upclim/lib/python3.4/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'): xray V0.6.1: 28.52 s

The first warning seems related to recent numpy. Note that a second warning appeared with xray V0.6.1.

It's interesting to mention that the bottleneck clearly is in the rendering (plt.savefig('t_xray.png')). Removing this line will make xray V0.6.1 faster than xray V0.6.0.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/657/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 0 rows from issues_id in issues_labels
  • 19 rows from issue in issue_comments
Powered by Datasette · Queries took 0.583ms · About: xarray-datasette