--- /tmp/python-xarray-0.19.0-66fnpacgl/debian/python-xarray-doc_0.19.0-6_all.deb +++ python-xarray-doc_0.19.0-6_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2021-09-06 11:21:39.000000 debian-binary │ -rw-r--r-- 0 0 0 5848 2021-09-06 11:21:39.000000 control.tar.xz │ --rw-r--r-- 0 0 0 4159044 2021-09-06 11:21:39.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 4158968 2021-09-06 11:21:39.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -212,16 +212,16 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 43053 2021-08-09 11:57:30.000000 ./usr/share/doc/python-xarray-doc/html/_static/thumbnails/visualization_gallery.png │ │ │ -rw-r--r-- 0 root (0) root (0) 24020 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/_static/where_example.png │ │ │ -rw-r--r-- 0 root (0) root (0) 4588 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/api-hidden.html │ │ │ -rw-r--r-- 0 root (0) root (0) 28948 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/api.html │ │ │ -rw-r--r-- 0 root (0) root (0) 78320 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/contributing.html │ │ │ -rw-r--r-- 0 root (0) root (0) 17937 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/ecosystem.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/ │ │ │ --rw-r--r-- 0 root (0) root (0) 62611 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5071 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 62604 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 5062 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 45090 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/ROMS_ocean_model.html │ │ │ -rw-r--r-- 0 root (0) root (0) 18703 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/ROMS_ocean_model.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 101798 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/apply_ufunc_vectorize_1d.html │ │ │ -rw-r--r-- 0 root (0) root (0) 8107 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/apply_ufunc_vectorize_1d.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 33539 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/area_weighted_temperature.html │ │ │ -rw-r--r-- 0 root (0) root (0) 14569 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/area_weighted_temperature.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 43268 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/examples/monthly-means.html │ │ │ @@ -248,21 +248,21 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 48022 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/internals/how-to-add-new-backend.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6285 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/internals/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 9096 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/internals/variable-objects.html │ │ │ -rw-r--r-- 0 root (0) root (0) 17871 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/internals/zarr-encoding-spec.html │ │ │ -rw-r--r-- 0 root (0) root (0) 15041 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/objects.inv │ │ │ -rw-r--r-- 0 root (0) root (0) 17611 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/roadmap.html │ │ │ -rw-r--r-- 0 root (0) root (0) 4856 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/search.html │ │ │ --rw-r--r-- 0 root (0) root (0) 110589 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/searchindex.js │ │ │ +-rw-r--r-- 0 root (0) root (0) 110582 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/searchindex.js │ │ │ -rw-r--r-- 0 root (0) root (0) 5712 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/team.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6863 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/tutorials-and-videos.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/ │ │ │ -rw-r--r-- 0 root (0) root (0) 56793 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/combining.html │ │ │ -rw-r--r-- 0 root (0) root (0) 124471 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/computation.html │ │ │ --rw-r--r-- 0 root (0) root (0) 76121 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/dask.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 76212 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/dask.html │ │ │ -rw-r--r-- 0 root (0) root (0) 99021 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/data-structures.html │ │ │ -rw-r--r-- 0 root (0) root (0) 14547 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/duckarrays.html │ │ │ -rw-r--r-- 0 root (0) root (0) 37249 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/groupby.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6996 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 245524 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/indexing.html │ │ │ -rw-r--r-- 0 root (0) root (0) 88010 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/interpolation.html │ │ │ -rw-r--r-- 0 root (0) root (0) 121676 2021-09-06 11:21:39.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/io.html │ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.html │ │ │ @@ -600,15 +600,15 @@ │ │ │ /usr/lib/python3.9/os.py in makedirs(name, mode, exist_ok) │ │ │ 223 return │ │ │ 224 try: │ │ │ --> 225 mkdir(name, mode) │ │ │ 226 except OSError: │ │ │ 227 # Cannot rely on checking for EEXIST, since the operating system │ │ │ │ │ │ -PermissionError: [Errno 13] Permission denied: '/sbuild-nonexistent' │ │ │ +PermissionError: [Errno 13] Permission denied: '/nonexistent' │ │ │ │ │ │ │ │ │
│ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.ipynb.gz
│ │ │ ├── ERA5-GRIB-example.ipynb
│ │ │ │ │ --- /tmp/diffoscope_dhg8508i_/tmpdol5i630GzipContainer/667fcad3-3bf3-46cf-b840-2ced42b493c0
│ │ │ │ ├── +++ /tmp/diffoscope_dhg8508i_/tmpnzp4xcqzGzipContainer/0fcac538-7efc-4bfc-b95a-2ee601f6cf3f
│ │ │ │ │┄ Differences: {'replace': "OrderedDict([('cells', [OrderedDict([('cell_type', 'markdown'), ('metadata', "
│ │ │ │ │┄ "OrderedDict()), ('source', ['# GRIB Data Example '])]), OrderedDict([('cell_type', "
│ │ │ │ │┄ "'markdown'), ('metadata', OrderedDict()), ('source', ['GRIB format is commonly used "
│ │ │ │ │┄ 'to disseminate atmospheric model data. With Xarray and the cfgrib engine, GRIB data '
│ │ │ │ │┄ "can easily be analyzed and visualized.'])]), OrderedDict([('cell_type', 'code'), "
│ │ │ │ │┄ "('execution_cou […]
│ │ │ │ │ @@ -108,15 +108,15 @@
│ │ │ │ │ "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0max\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0maxes\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mprojection\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mccrs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mRobinson\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 5\u001b[0m \u001b[0max\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcoastlines\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mresolution\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m'10m'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 6\u001b[0;31m \u001b[0mplot\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mds\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mt2m\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mcmap\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcm\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcoolwarm\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mtransform\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mccrs\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mPlateCarree\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcbar_kwargs\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;34m{\u001b[0m\u001b[0;34m'shrink'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;36m0.6\u001b[0m\u001b[0;34m}\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 7\u001b[0m \u001b[0mplt\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mtitle\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'ERA5 - 2m temperature British Isles March 2019'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;31mNameError\u001b[0m: name 'ds' is not defined"
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "ename": "PermissionError",
│ │ │ │ │ - "evalue": "[Errno 13] Permission denied: '/sbuild-nonexistent'",
│ │ │ │ │ + "evalue": "[Errno 13] Permission denied: '/nonexistent'",
│ │ │ │ │ "output_type": "error",
│ │ │ │ │ "traceback": [
│ │ │ │ │ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
│ │ │ │ │ "\u001b[0;31mPermissionError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3/dist-packages/IPython/core/formatters.py\u001b[0m in \u001b[0;36m__call__\u001b[0;34m(self, obj)\u001b[0m\n\u001b[1;32m 339\u001b[0m \u001b[0;32mpass\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 340\u001b[0m \u001b[0;32melse\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 341\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mprinter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 342\u001b[0m \u001b[0;31m# Finally look for special method names\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 343\u001b[0m \u001b[0mmethod\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mget_real_method\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mobj\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprint_method\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3/dist-packages/IPython/core/pylabtools.py\u001b[0m in \u001b[0;36m\u001b[0;34m(fig)\u001b[0m\n\u001b[1;32m 246\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 247\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m'png'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mformats\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 248\u001b[0;31m \u001b[0mpng_formatter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfor_type\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mFigure\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mlambda\u001b[0m \u001b[0mfig\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mprint_figure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'png'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 249\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0;34m'retina'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mformats\u001b[0m \u001b[0;32mor\u001b[0m \u001b[0;34m'png2x'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mformats\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 250\u001b[0m \u001b[0mpng_formatter\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfor_type\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mFigure\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;32mlambda\u001b[0m \u001b[0mfig\u001b[0m\u001b[0;34m:\u001b[0m \u001b[0mretina_figure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfig\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3/dist-packages/IPython/core/pylabtools.py\u001b[0m in \u001b[0;36mprint_figure\u001b[0;34m(fig, fmt, bbox_inches, **kwargs)\u001b[0m\n\u001b[1;32m 130\u001b[0m \u001b[0mFigureCanvasBase\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mfig\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 131\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 132\u001b[0;31m \u001b[0mfig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcanvas\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mprint_figure\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbytes_io\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkw\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 133\u001b[0m \u001b[0mdata\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mbytes_io\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mgetvalue\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 134\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mfmt\u001b[0m \u001b[0;34m==\u001b[0m \u001b[0;34m'svg'\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ @@ -141,15 +141,15 @@
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3.9/os.py\u001b[0m in \u001b[0;36mmakedirs\u001b[0;34m(name, mode, exist_ok)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhead\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtail\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexists\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 215\u001b[0;31m \u001b[0mmakedirs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mexist_ok\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mFileExistsError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;31m# Defeats race condition when another thread created the path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3.9/os.py\u001b[0m in \u001b[0;36mmakedirs\u001b[0;34m(name, mode, exist_ok)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhead\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtail\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexists\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 215\u001b[0;31m \u001b[0mmakedirs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mexist_ok\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mFileExistsError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;31m# Defeats race condition when another thread created the path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3.9/os.py\u001b[0m in \u001b[0;36mmakedirs\u001b[0;34m(name, mode, exist_ok)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhead\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtail\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexists\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 215\u001b[0;31m \u001b[0mmakedirs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mexist_ok\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mFileExistsError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;31m# Defeats race condition when another thread created the path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3.9/os.py\u001b[0m in \u001b[0;36mmakedirs\u001b[0;34m(name, mode, exist_ok)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhead\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtail\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexists\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 215\u001b[0;31m \u001b[0mmakedirs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mexist_ok\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mFileExistsError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;31m# Defeats race condition when another thread created the path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3.9/os.py\u001b[0m in \u001b[0;36mmakedirs\u001b[0;34m(name, mode, exist_ok)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhead\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtail\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexists\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 215\u001b[0;31m \u001b[0mmakedirs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mexist_ok\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mFileExistsError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;31m# Defeats race condition when another thread created the path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3.9/os.py\u001b[0m in \u001b[0;36mmakedirs\u001b[0;34m(name, mode, exist_ok)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mhead\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mtail\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mexists\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 214\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 215\u001b[0;31m \u001b[0mmakedirs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mhead\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mexist_ok\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 216\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mFileExistsError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 217\u001b[0m \u001b[0;31m# Defeats race condition when another thread created the path\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ "\u001b[0;32m/usr/lib/python3.9/os.py\u001b[0m in \u001b[0;36mmakedirs\u001b[0;34m(name, mode, exist_ok)\u001b[0m\n\u001b[1;32m 223\u001b[0m \u001b[0;32mreturn\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 224\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 225\u001b[0;31m \u001b[0mmkdir\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mname\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmode\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 226\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mOSError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 227\u001b[0m \u001b[0;31m# Cannot rely on checking for EEXIST, since the operating system\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
│ │ │ │ │ - "\u001b[0;31mPermissionError\u001b[0m: [Errno 13] Permission denied: '/sbuild-nonexistent'"
│ │ │ │ │ + "\u001b[0;31mPermissionError\u001b[0m: [Errno 13] Permission denied: '/nonexistent'"
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "data": {
│ │ │ │ │ "text/plain": [
│ │ │ │ │ "
[2]:
│ │ │ @@ -904,15 +904,15 @@
│ │ │
[5]:
│ │ │
│ │ │ -<seaborn.axisgrid.PairGrid at 0x7f43de792070>
│ │ │ +<seaborn.axisgrid.PairGrid at 0x771c1376ad90>
│ │ │
array([[0.9516129 , 0.88709677, 0.93548387], │ │ │ + * month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12
array([[0.9516129 , 0.88709677, 0.93548387], │ │ │ [0.84210526, 0.71929825, 0.77192982], │ │ │ [0.24193548, 0.12903226, 0.16129032], │ │ │ [0. , 0. , 0. ], │ │ │ [0. , 0. , 0. ], │ │ │ [0. , 0. , 0. ], │ │ │ [0. , 0. , 0. ], │ │ │ [0. , 0. , 0. ], │ │ │ [0. , 0. , 0. ], │ │ │ [0. , 0.01612903, 0. ], │ │ │ [0.33333333, 0.35 , 0.23333333], │ │ │ - [0.93548387, 0.85483871, 0.82258065]])
array(['IA', 'IN', 'IL'], dtype='<U2')
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
array(['IA', 'IN', 'IL'], dtype='<U2')
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
[7]:
│ │ │
│ │ │ freeze.to_pandas().plot()
│ │ │ @@ -1817,18 +1817,18 @@
│ │ │ Dimensions: (time: 731, location: 3)
│ │ │ Coordinates:
│ │ │ * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2001-12-31
│ │ │ * location (location) object 'IA' 'IN' 'IL'
│ │ │ month (time) int64 1 1 1 1 1 1 1 1 1 ... 12 12 12 12 12 12 12 12 12
│ │ │ Data variables:
│ │ │ some_missing (time, location) float64 nan nan nan ... 2.063 -1.346 -4.544
│ │ │ - filled (time, location) float64 -5.163 -4.216 ... -1.346 -4.544
array(['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000', │ │ │ + filled (time, location) float64 -5.163 -4.216 ... -1.346 -4.544
array(['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000', │ │ │ '2000-01-03T00:00:00.000000000', ..., '2001-12-29T00:00:00.000000000', │ │ │ '2001-12-30T00:00:00.000000000', '2001-12-31T00:00:00.000000000'], │ │ │ - dtype='datetime64[ns]')
array(['IA', 'IN', 'IL'], dtype=object)
array([ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, │ │ │ + dtype='datetime64[ns]')
array(['IA', 'IN', 'IL'], dtype=object)
array([ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, │ │ │ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, │ │ │ 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, │ │ │ 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, │ │ │ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, │ │ │ 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, │ │ │ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, │ │ │ 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, │ │ │ @@ -1860,27 +1860,27 @@ │ │ │ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, │ │ │ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, │ │ │ 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, │ │ │ 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, │ │ │ 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, │ │ │ 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, │ │ │ 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, │ │ │ - 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12])
array([[ nan, nan, nan], │ │ │ + 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12])
array([[ nan, nan, nan], │ │ │ [ nan, nan, nan], │ │ │ [ nan, nan, nan], │ │ │ ..., │ │ │ [ -5.34723825, -13.37459826, -4.93221199], │ │ │ [ -2.67283594, -5.18072141, -4.11567869], │ │ │ - [ 2.06327582, -1.34576404, -4.54392729]])
array([[ -5.16274935, -4.21616663, -4.68137385], │ │ │ + [ 2.06327582, -1.34576404, -4.54392729]])
array([[ -5.16274935, -4.21616663, -4.68137385], │ │ │ [ -5.16274935, -4.21616663, -4.68137385], │ │ │ [ -5.16274935, -4.21616663, -4.68137385], │ │ │ ..., │ │ │ [ -5.34723825, -13.37459826, -4.93221199], │ │ │ [ -2.67283594, -5.18072141, -4.11567869], │ │ │ - [ 2.06327582, -1.34576404, -4.54392729]])
[12]:
│ │ │
│ │ │ df = both.sel(time="2000").mean("location").reset_coords(drop=True).to_dataframe()
│ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/weather-data.ipynb.gz
│ │ │ ├── weather-data.ipynb
│ │ │ │ │ --- /tmp/diffoscope_dhg8508i_/tmplu_ic59hGzipContainer/48f3f458-6e98-4eb8-8c26-b5b9e5a3f13a
│ │ │ │ ├── +++ /tmp/diffoscope_dhg8508i_/tmpij_k34jkGzipContainer/9b9df215-4929-47d7-a013-ddc8721b1840
│ │ │ │ │┄ Differences: {'replace': "OrderedDict([('cells', [OrderedDict([('cell_type', 'markdown'), ('metadata', "
│ │ │ │ │┄ "OrderedDict()), ('source', ['# Toy weather data\\n', '\\n', 'Here is an example of "
│ │ │ │ │┄ "how to easily manipulate a toy weather dataset using\\n', 'xarray and other "
│ │ │ │ │┄ "recommended Python libraries:'])]), OrderedDict([('cell_type', 'code'), "
│ │ │ │ │┄ "('execution_count', 1), ('metadata', OrderedDict([('ExecuteTime', "
│ │ │ │ │┄ "OrderedDict([('end_time', '2020-01-27T15:43:36.127 […]
│ │ │ │ │ @@ -377,30 +377,30 @@
│ │ │ │ │ "<xarray.Dataset>\n",
│ │ │ │ │ "Dimensions: (time: 731, location: 3)\n",
│ │ │ │ │ "Coordinates:\n",
│ │ │ │ │ " * time (time) datetime64[ns] 2000-01-01 2000-01-02 ... 2001-12-31\n",
│ │ │ │ │ " * location (location) <U2 'IA' 'IN' 'IL'\n",
│ │ │ │ │ "Data variables:\n",
│ │ │ │ │ " tmin (time, location) float64 -8.037 -1.788 -3.932 ... -1.346 -4.544\n",
│ │ │ │ │ - " tmax (time, location) float64 12.98 3.31 6.779 ... 6.636 3.343 3.805
xarray.Dataset- time: 731
- location: 3
- time(time)datetime64[ns]2000-01-01 ... 2001-12-31
array(['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000',\n",
│ │ │ │ │ + " tmax (time, location) float64 12.98 3.31 6.779 ... 6.636 3.343 3.805
xarray.Dataset- time: 731
- location: 3
- time(time)datetime64[ns]2000-01-01 ... 2001-12-31
array(['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000',\n",
│ │ │ │ │ " '2000-01-03T00:00:00.000000000', ..., '2001-12-29T00:00:00.000000000',\n",
│ │ │ │ │ " '2001-12-30T00:00:00.000000000', '2001-12-31T00:00:00.000000000'],\n",
│ │ │ │ │ - " dtype='datetime64[ns]')
- location(location)<U2'IA' 'IN' 'IL'
array(['IA', 'IN', 'IL'], dtype='<U2')
- tmin(time, location)float64-8.037 -1.788 ... -1.346 -4.544
array([[ -8.03736932, -1.78844117, -3.93154201],\n",
│ │ │ │ │ + " dtype='datetime64[ns]')
- location(location)<U2'IA' 'IN' 'IL'
array(['IA', 'IN', 'IL'], dtype='<U2')
- tmin(time, location)float64-8.037 -1.788 ... -1.346 -4.544
array([[ -8.03736932, -1.78844117, -3.93154201],\n",
│ │ │ │ │ " [ -9.34115662, -6.55807323, 0.13203714],\n",
│ │ │ │ │ " [-12.13971902, -6.14641918, -1.06187252],\n",
│ │ │ │ │ " ...,\n",
│ │ │ │ │ " [ -5.34723825, -13.37459826, -4.93221199],\n",
│ │ │ │ │ " [ -2.67283594, -5.18072141, -4.11567869],\n",
│ │ │ │ │ - " [ 2.06327582, -1.34576404, -4.54392729]])
- tmax(time, location)float6412.98 3.31 6.779 ... 3.343 3.805
array([[12.98054898, 3.31040942, 6.77855382],\n",
│ │ │ │ │ + " [ 2.06327582, -1.34576404, -4.54392729]])
- tmax(time, location)float6412.98 3.31 6.779 ... 3.343 3.805
array([[12.98054898, 3.31040942, 6.77855382],\n",
│ │ │ │ │ " [ 0.44785582, 6.37271154, 4.8434966 ],\n",
│ │ │ │ │ " [ 5.32269851, 6.25176289, 5.98033045],\n",
│ │ │ │ │ " ...,\n",
│ │ │ │ │ " [ 6.73078492, 7.74795302, 8.04569651],\n",
│ │ │ │ │ " [ 6.46376911, 6.31695352, 1.55799171],\n",
│ │ │ │ │ - " [ 6.63593435, 3.34271537, 3.80527925]])
"
│ │ │ │ │ + " [ 6.63593435, 3.34271537, 3.80527925]])
array([[0.9516129 , 0.88709677, 0.93548387],\n", │ │ │ │ │ + " * month (month) int64 1 2 3 4 5 6 7 8 9 10 11 12
array([[0.9516129 , 0.88709677, 0.93548387],\n", │ │ │ │ │ " [0.84210526, 0.71929825, 0.77192982],\n", │ │ │ │ │ " [0.24193548, 0.12903226, 0.16129032],\n", │ │ │ │ │ " [0. , 0. , 0. ],\n", │ │ │ │ │ " [0. , 0. , 0. ],\n", │ │ │ │ │ " [0. , 0. , 0. ],\n", │ │ │ │ │ " [0. , 0. , 0. ],\n", │ │ │ │ │ " [0. , 0. , 0. ],\n", │ │ │ │ │ " [0. , 0. , 0. ],\n", │ │ │ │ │ " [0. , 0.01612903, 0. ],\n", │ │ │ │ │ " [0.33333333, 0.35 , 0.23333333],\n", │ │ │ │ │ - " [0.93548387, 0.85483871, 0.82258065]])
array(['IA', 'IN', 'IL'], dtype='<U2')
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
array(['IA', 'IN', 'IL'], dtype='<U2')
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
array(['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000',\n", │ │ │ │ │ + " filled (time, location) float64 -5.163 -4.216 ... -1.346 -4.544
array(['2000-01-01T00:00:00.000000000', '2000-01-02T00:00:00.000000000',\n", │ │ │ │ │ " '2000-01-03T00:00:00.000000000', ..., '2001-12-29T00:00:00.000000000',\n", │ │ │ │ │ " '2001-12-30T00:00:00.000000000', '2001-12-31T00:00:00.000000000'],\n", │ │ │ │ │ - " dtype='datetime64[ns]')
array(['IA', 'IN', 'IL'], dtype=object)
array([ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n", │ │ │ │ │ + " dtype='datetime64[ns]')
array(['IA', 'IN', 'IL'], dtype=object)
array([ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,\n", │ │ │ │ │ " 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2,\n", │ │ │ │ │ " 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,\n", │ │ │ │ │ " 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3,\n", │ │ │ │ │ " 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,\n", │ │ │ │ │ " 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,\n", │ │ │ │ │ " 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,\n", │ │ │ │ │ " 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,\n", │ │ │ │ │ @@ -1804,27 +1804,27 @@ │ │ │ │ │ " 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9,\n", │ │ │ │ │ " 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9,\n", │ │ │ │ │ " 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10,\n", │ │ │ │ │ " 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,\n", │ │ │ │ │ " 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,\n", │ │ │ │ │ " 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,\n", │ │ │ │ │ " 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,\n", │ │ │ │ │ - " 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12])
array([[ nan, nan, nan],\n", │ │ │ │ │ + " 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12])
array([[ nan, nan, nan],\n", │ │ │ │ │ " [ nan, nan, nan],\n", │ │ │ │ │ " [ nan, nan, nan],\n", │ │ │ │ │ " ...,\n", │ │ │ │ │ " [ -5.34723825, -13.37459826, -4.93221199],\n", │ │ │ │ │ " [ -2.67283594, -5.18072141, -4.11567869],\n", │ │ │ │ │ - " [ 2.06327582, -1.34576404, -4.54392729]])
array([[ -5.16274935, -4.21616663, -4.68137385],\n", │ │ │ │ │ + " [ 2.06327582, -1.34576404, -4.54392729]])
array([[ -5.16274935, -4.21616663, -4.68137385],\n", │ │ │ │ │ " [ -5.16274935, -4.21616663, -4.68137385],\n", │ │ │ │ │ " [ -5.16274935, -4.21616663, -4.68137385],\n", │ │ │ │ │ " ...,\n", │ │ │ │ │ " [ -5.34723825, -13.37459826, -4.93221199],\n", │ │ │ │ │ " [ -2.67283594, -5.18072141, -4.11567869],\n", │ │ │ │ │ - " [ 2.06327582, -1.34576404, -4.54392729]])
Visualizing your datasets is quick and convenient:
│ │ │In [37]: data.plot()
│ │ │ -Out[37]: <matplotlib.collections.QuadMesh at 0x7fc3bd29ddf0>
│ │ │ +Out[37]: <matplotlib.collections.QuadMesh at 0x701c3fce0820>
│ │ │
Note the automatic labeling with names and units. Our effort in adding metadata attributes has paid off! Many aspects of these figures are customizable: see Plotting.
│ │ │You’ll notice that printing a dataset still shows a preview of array values, │ │ │ even if they are actually Dask arrays. We can do this quickly with Dask because │ │ │ we only need to compute the first few values (typically from the first block). │ │ │ To reveal the true nature of an array, print a DataArray:
│ │ │In [3]: ds.temperature
│ │ │ Out[3]:
│ │ │ <xarray.DataArray 'temperature' (time: 30, latitude: 180, longitude: 180)>
│ │ │ -dask.array<open_dataset-1f992a72462bbf01f0a4af7f5d4cdadetemperature, shape=(30, 180, 180), dtype=float64, chunksize=(10, 180, 180), chunktype=numpy.ndarray>
│ │ │ +dask.array<open_dataset-58c297e9f6692b8495e98010797a3d77temperature, shape=(30, 180, 180), dtype=float64, chunksize=(10, 180, 180), chunktype=numpy.ndarray>
│ │ │ Coordinates:
│ │ │ * time (time) datetime64[ns] 2015-01-01 2015-01-02 ... 2015-01-30
│ │ │ * longitude (longitude) int64 0 1 2 3 4 5 6 7 ... 173 174 175 176 177 178 179
│ │ │ * latitude (latitude) float64 89.5 88.5 87.5 86.5 ... -87.5 -88.5 -89.5
│ │ │
Once you’ve manipulated a Dask array, you can still write a dataset too big to │ │ │ @@ -128,15 +128,16 @@ │ │ │ In [6]: delayed_obj = ds.to_netcdf("manipulated-example-data.nc", compute=False) │ │ │ │ │ │ In [7]: with ProgressBar(): │ │ │ ...: results = delayed_obj.compute() │ │ │ ...: │ │ │ │ │ │ [ ] | 0% Completed | 0.0s │ │ │ -[########################################] | 100% Completed | 0.1s │ │ │ +[################################### ] | 87% Completed | 0.8s │ │ │ +[########################################] | 100% Completed | 0.9s │ │ │
Note
│ │ │When using Dask’s distributed scheduler to write NETCDF4 files,
│ │ │ it may be necessary to set the environment variable HDF5_USE_FILE_LOCKING=FALSE
│ │ │ to avoid competing locks within the HDF5 SWMR file locking scheme. Note that
│ │ ├── ./usr/share/doc/python-xarray-doc/html/user-guide/data-structures.html
│ │ │ @@ -684,18 +684,18 @@
│ │ │ a method call with an external function (e.g., ds.pipe(func)
) instead of
│ │ │ simply calling it (e.g., func(ds)
). This allows you to write pipelines for
│ │ │ transforming your data (using “method chaining”) instead of writing hard to
│ │ │ follow nested function calls:
# these lines are equivalent, but with pipe we can make the logic flow
│ │ │ # entirely from left to right
│ │ │ In [60]: plt.plot((2 * ds.temperature.sel(x=0)).mean("y"))
│ │ │ -Out[60]: [<matplotlib.lines.Line2D at 0x7fc3a5721730>]
│ │ │ +Out[60]: [<matplotlib.lines.Line2D at 0x701c3c41aa30>]
│ │ │
│ │ │ In [61]: (ds.temperature.sel(x=0).pipe(lambda x: 2 * x).mean("y").pipe(plt.plot))
│ │ │ -Out[61]: [<matplotlib.lines.Line2D at 0x7fc3a57256a0>]
│ │ │ +Out[61]: [<matplotlib.lines.Line2D at 0x701c3c42c670>]
│ │ │
Both pipe
and assign
replicate the pandas methods of the same names
│ │ │ (DataFrame.pipe
and
│ │ │ DataFrame.assign
).
With xarray, there is no performance penalty for creating new datasets, even if │ │ │ variables are lazily loaded from a file on disk. Creating new objects instead │ │ ├── ./usr/share/doc/python-xarray-doc/html/user-guide/interpolation.html │ │ │ @@ -215,24 +215,24 @@ │ │ │ ....: np.sin(np.linspace(0, 2 * np.pi, 10)), │ │ │ ....: dims="x", │ │ │ ....: coords={"x": np.linspace(0, 1, 10)}, │ │ │ ....: ) │ │ │ ....: │ │ │ │ │ │ In [17]: da.plot.line("o", label="original") │ │ │ -Out[17]: [<matplotlib.lines.Line2D at 0x7fc3a5197d60>] │ │ │ +Out[17]: [<matplotlib.lines.Line2D at 0x701c37603670>] │ │ │ │ │ │ In [18]: da.interp(x=np.linspace(0, 1, 100)).plot.line(label="linear (default)") │ │ │ -Out[18]: [<matplotlib.lines.Line2D at 0x7fc3a517d610>] │ │ │ +Out[18]: [<matplotlib.lines.Line2D at 0x701c54fe1850>] │ │ │ │ │ │ In [19]: da.interp(x=np.linspace(0, 1, 100), method="cubic").plot.line(label="cubic") │ │ │ -Out[19]: [<matplotlib.lines.Line2D at 0x7fc3a5126460>] │ │ │ +Out[19]: [<matplotlib.lines.Line2D at 0x701c37603d30>] │ │ │ │ │ │ In [20]: plt.legend() │ │ │ -Out[20]: <matplotlib.legend.Legend at 0x7fc3bdb406a0> │ │ │ +Out[20]: <matplotlib.legend.Legend at 0x701c626783d0> │ │ │
Additional keyword arguments can be passed to scipy’s functions.
│ │ │# fill 0 for the outside of the original coordinates.
│ │ │ In [21]: da.interp(x=np.linspace(-0.5, 1.5, 10), kwargs={"fill_value": 0.0})
│ │ │ Out[21]:
│ │ ├── ./usr/share/doc/python-xarray-doc/html/user-guide/io.html
│ │ │ @@ -834,15 +834,15 @@
│ │ │ ....: "y": pd.date_range("2000-01-01", periods=5),
│ │ │ ....: "z": ("x", list("abcd")),
│ │ │ ....: },
│ │ │ ....: )
│ │ │ ....:
│ │ │
│ │ │ In [39]: ds.to_zarr("path/to/directory.zarr")
│ │ │ -Out[39]: <xarray.backends.zarr.ZarrStore at 0x7fc3a4f3c4a0>
│ │ │ +Out[39]: <xarray.backends.zarr.ZarrStore at 0x701c3741d5f0>
│ │ │
(The suffix .zarr
is optional–just a reminder that a zarr store lives
│ │ │ there.) If the directory does not exist, it will be created. If a zarr
│ │ │ store is already present at that path, an error will be raised, preventing it
│ │ │ from being overwritten. To override this behavior and overwrite an existing
│ │ │ store, add mode='w'
when invoking to_zarr()
.
to_zarr
method as variable encoding.
│ │ │ For example:
│ │ │ In [42]: import zarr
│ │ │
│ │ │ In [43]: compressor = zarr.Blosc(cname="zstd", clevel=3, shuffle=2)
│ │ │
│ │ │ In [44]: ds.to_zarr("foo.zarr", encoding={"foo": {"compressor": compressor}})
│ │ │ -Out[44]: <xarray.backends.zarr.ZarrStore at 0x7fc3a50a83c0>
│ │ │ +Out[44]: <xarray.backends.zarr.ZarrStore at 0x701c3758a510>
│ │ │
Note
│ │ │Not all native zarr compression and filtering options have been tested with │ │ │ xarray.
│ │ │Finally, you can use region
to write to limited regions of existing arrays
│ │ │ in an existing Zarr store. This is a good option for writing data in parallel
│ │ │ from independent processes.
To scale this up to writing large datasets, the first step is creating an │ │ │ initial Zarr store without writing all of its array data. This can be done by │ │ │ @@ -1013,33 +1013,33 @@ │ │ │ │ │ │ In [51]: ds = xr.Dataset({"foo": ("x", dummies)}) │ │ │ │ │ │ In [52]: path = "path/to/directory.zarr" │ │ │ │ │ │ # Now we write the metadata without computing any array values │ │ │ In [53]: ds.to_zarr(path, compute=False) │ │ │ -Out[53]: Delayed('_finalize_store-fb38ea2f-f378-4484-837d-3f2ef7872d55') │ │ │ +Out[53]: Delayed('_finalize_store-1c338037-733e-4cbd-b479-86b8fea62dba') │ │ │ │ │ │ │ │ │
Now, a Zarr store with the correct variable shapes and attributes exists that
│ │ │ can be filled out by subsequent calls to to_zarr
. The region
provides a
│ │ │ mapping from dimension names to Python slice
objects indicating where the
│ │ │ data should be written (in index space, not coordinate space), e.g.,
# For convenience, we'll slice a single dataset, but in the real use-case
│ │ │ # we would create them separately possibly even from separate processes.
│ │ │ In [54]: ds = xr.Dataset({"foo": ("x", np.arange(30))})
│ │ │
│ │ │ In [55]: ds.isel(x=slice(0, 10)).to_zarr(path, region={"x": slice(0, 10)})
│ │ │ -Out[55]: <xarray.backends.zarr.ZarrStore at 0x7fc3a4ee2e40>
│ │ │ +Out[55]: <xarray.backends.zarr.ZarrStore at 0x701c3741d430>
│ │ │
│ │ │ In [56]: ds.isel(x=slice(10, 20)).to_zarr(path, region={"x": slice(10, 20)})
│ │ │ -Out[56]: <xarray.backends.zarr.ZarrStore at 0x7fc3a4ee2dd0>
│ │ │ +Out[56]: <xarray.backends.zarr.ZarrStore at 0x701c373cc0b0>
│ │ │
│ │ │ In [57]: ds.isel(x=slice(20, 30)).to_zarr(path, region={"x": slice(20, 30)})
│ │ │ -Out[57]: <xarray.backends.zarr.ZarrStore at 0x7fc3a571cb30>
│ │ │ +Out[57]: <xarray.backends.zarr.ZarrStore at 0x701c3c420c80>
│ │ │
Concurrent writes with region
are safe as long as they modify distinct
│ │ │ chunks in the underlying Zarr arrays (or use an appropriate lock
).
As a safety check to make it harder to inadvertently override existing values,
│ │ │ if you set region
then all variables included in a Dataset must have
│ │ │ dimensions included in region
. Other variables (typically coordinates)
│ │ ├── ./usr/share/doc/python-xarray-doc/html/user-guide/plotting.html
│ │ │ @@ -631,15 +631,15 @@
│ │ │ --> 173 ref_var = variables[ref_name]
│ │ │ 174
│ │ │ 175 if var_name is None:
│ │ │
│ │ │ KeyError: 'lat'
│ │ │
│ │ │ In [51]: b.plot()
│ │ │ -Out[51]: [<matplotlib.lines.Line2D at 0x7fc3a4d5b910>]
│ │ │ +Out[51]: [<matplotlib.lines.Line2D at 0x701c371c2f70>]
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
There are several other options for plotting 2D data.
│ │ │ @@ -1133,88 +1133,88 @@ │ │ │ B (x, y, z, w) float64 0.0 0.0 0.0 0.0 ... 1.369 1.408 1.387 1.417 │ │ │Suppose we want to scatter A
against B
In [98]: ds.plot.scatter(x="A", y="B")
│ │ │ -Out[98]: <matplotlib.collections.PathCollection at 0x7fc3a4ba8850>
│ │ │ +Out[98]: <matplotlib.collections.PathCollection at 0x701c3708acd0>
│ │ │
The hue
kwarg lets you vary the color by variable value
In [99]: ds.plot.scatter(x="A", y="B", hue="w")
│ │ │ Out[99]:
│ │ │ -[<matplotlib.collections.PathCollection at 0x7fc3a4b61d00>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b61bb0>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b75910>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b75e50>]
│ │ │ +[<matplotlib.collections.PathCollection at 0x701c370580d0>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c37058b20>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c37058250>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c37058a90>]
│ │ │
When hue
is specified, a colorbar is added for numeric hue
DataArrays by
│ │ │ default and a legend is added for non-numeric hue
DataArrays (as above).
│ │ │ You can force a legend instead of a colorbar by setting hue_style='discrete'
.
│ │ │ Additionally, the boolean kwarg add_guide
can be used to prevent the display of a legend or colorbar (as appropriate).
In [100]: ds = ds.assign(w=[1, 2, 3, 5])
│ │ │
│ │ │ In [101]: ds.plot.scatter(x="A", y="B", hue="w", hue_style="discrete")
│ │ │ Out[101]:
│ │ │ -[<matplotlib.collections.PathCollection at 0x7fc3a4b20880>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b9bc70>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b9b850>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b9b6d0>]
│ │ │ +[<matplotlib.collections.PathCollection at 0x701c371c2910>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c37058970>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c3707d850>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c370584c0>]
│ │ │
The markersize
kwarg lets you vary the point’s size by variable value. You can additionally pass size_norm
to control how the variable’s values are mapped to point sizes.
In [102]: ds.plot.scatter(x="A", y="B", hue="z", hue_style="discrete", markersize="z")
│ │ │ Out[102]:
│ │ │ -[<matplotlib.collections.PathCollection at 0x7fc3a4b12d00>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b125e0>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b12e50>,
│ │ │ - <matplotlib.collections.PathCollection at 0x7fc3a4b12d60>]
│ │ │ +[<matplotlib.collections.PathCollection at 0x701c36ff0e20>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c36ff0df0>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c36ff0ca0>,
│ │ │ + <matplotlib.collections.PathCollection at 0x701c36ff09a0>]
│ │ │
Faceting is also possible
│ │ │In [103]: ds.plot.scatter(x="A", y="B", col="x", row="z", hue="w", hue_style="discrete")
│ │ │ -Out[103]: <xarray.plot.facetgrid.FacetGrid at 0x7fc3a4ab2940>
│ │ │ +Out[103]: <xarray.plot.facetgrid.FacetGrid at 0x701c36fa4040>
│ │ │
For more advanced scatter plots, we recommend converting the relevant data variables to a pandas DataFrame and using the extensive plotting capabilities of seaborn
.
Visualizing vector fields is supported with quiver plots:
│ │ │In [104]: ds.isel(w=1, z=1).plot.quiver(x="x", y="y", u="A", v="B")
│ │ │ -Out[104]: <matplotlib.quiver.Quiver at 0x7fc3a4ff4880>
│ │ │ +Out[104]: <matplotlib.quiver.Quiver at 0x701c3747e580>
│ │ │
where u
and v
denote the x and y direction components of the arrow vectors. Again, faceting is also possible:
In [105]: ds.plot.quiver(x="x", y="y", u="A", v="B", col="w", row="z", scale=4)
│ │ │ -Out[105]: <xarray.plot.facetgrid.FacetGrid at 0x7fc3a49c1610>
│ │ │ +Out[105]: <xarray.plot.facetgrid.FacetGrid at 0x701c36cd5b20>
│ │ │
scale
is required for faceted quiver plots. The scale determines the number of data units per arrow length unit, i.e. a smaller scale parameter makes the arrow longer.
Visualizing vector fields is also supported with streamline plots:
│ │ │In [106]: ds.isel(w=1, z=1).plot.streamplot(x="x", y="y", u="A", v="B")
│ │ │ -Out[106]: <matplotlib.collections.LineCollection at 0x7fc3a4628820>
│ │ │ +Out[106]: <matplotlib.collections.LineCollection at 0x701c36b158b0>
│ │ │
where u
and v
denote the x and y direction components of the vectors tangent to the streamlines. Again, faceting is also possible:
In [107]: ds.plot.streamplot(x="x", y="y", u="A", v="B", col="w", row="z")
│ │ │ -Out[107]: <xarray.plot.facetgrid.FacetGrid at 0x7fc3a4fff640>
│ │ │ +Out[107]: <xarray.plot.facetgrid.FacetGrid at 0x701c54ffc370>
│ │ │
In [116]: import xarray.plot as xplt
│ │ │
│ │ │ In [117]: da = xr.DataArray(range(5))
│ │ │
│ │ │ In [118]: fig, axes = plt.subplots(ncols=2, nrows=2)
│ │ │
│ │ │ In [119]: da.plot(ax=axes[0, 0])
│ │ │ -Out[119]: [<matplotlib.lines.Line2D at 0x7fc39757b760>]
│ │ │ +Out[119]: [<matplotlib.lines.Line2D at 0x701c37219a90>]
│ │ │
│ │ │ In [120]: da.plot.line(ax=axes[0, 1])
│ │ │ -Out[120]: [<matplotlib.lines.Line2D at 0x7fc3a47c74f0>]
│ │ │ +Out[120]: [<matplotlib.lines.Line2D at 0x701c3c0ff640>]
│ │ │
│ │ │ In [121]: xplt.plot(da, ax=axes[1, 0])
│ │ │ -Out[121]: [<matplotlib.lines.Line2D at 0x7fc3973e8b80>]
│ │ │ +Out[121]: [<matplotlib.lines.Line2D at 0x701c358df640>]
│ │ │
│ │ │ In [122]: xplt.line(da, ax=axes[1, 1])
│ │ │ -Out[122]: [<matplotlib.lines.Line2D at 0x7fc3974500d0>]
│ │ │ +Out[122]: [<matplotlib.lines.Line2D at 0x701c36aa1220>]
│ │ │
│ │ │ In [123]: plt.tight_layout()
│ │ │
│ │ │ In [124]: plt.draw()
│ │ │
The plot will produce an image corresponding to the values of the array. │ │ │ Hence the top left pixel will be a different color than the others. │ │ │ Before reading on, you may want to look at the coordinates and │ │ │ think carefully about what the limits, labels, and orientation for │ │ │ each of the axes should be.
│ │ │In [129]: a.plot()
│ │ │ -Out[129]: <matplotlib.collections.QuadMesh at 0x7fc3973a75e0>
│ │ │ +Out[129]: <matplotlib.collections.QuadMesh at 0x701c358b5c70>
│ │ │
It may seem strange that │ │ │ the values on the y axis are decreasing with -0.5 on the top. This is because │ │ │ the pixels are centered over their coordinates, and the │ │ │ axis labels and ranges correspond to the values of the │ │ │ @@ -1433,81 +1433,81 @@ │ │ │ .....: np.arange(20).reshape(4, 5), │ │ │ .....: dims=["y", "x"], │ │ │ .....: coords={"lat": (("y", "x"), lat), "lon": (("y", "x"), lon)}, │ │ │ .....: ) │ │ │ .....: │ │ │ │ │ │ In [134]: da.plot.pcolormesh("lon", "lat") │ │ │ -Out[134]: <matplotlib.collections.QuadMesh at 0x7fc397327eb0> │ │ │ +Out[134]: <matplotlib.collections.QuadMesh at 0x701c358b5520> │ │ │ │ │ │ │ │ │ │ │ │
Note that in this case, xarray still follows the pixel centered convention. │ │ │ This might be undesirable in some cases, for example when your data is defined │ │ │ on a polar projection (GH781). This is why the default is to not follow │ │ │ this convention when plotting on a map:
│ │ │In [135]: import cartopy.crs as ccrs
│ │ │
│ │ │ In [136]: ax = plt.subplot(projection=ccrs.PlateCarree())
│ │ │
│ │ │ In [137]: da.plot.pcolormesh("lon", "lat", ax=ax)
│ │ │ -Out[137]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x7fc3972b3580>
│ │ │ +Out[137]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x701c35785310>
│ │ │
│ │ │ In [138]: ax.scatter(lon, lat, transform=ccrs.PlateCarree())
│ │ │ -Out[138]: <matplotlib.collections.PathCollection at 0x7fc39727ee80>
│ │ │ +Out[138]: <matplotlib.collections.PathCollection at 0x701c3570c9a0>
│ │ │
│ │ │ In [139]: ax.coastlines()
│ │ │ -Out[139]: <cartopy.mpl.feature_artist.FeatureArtist at 0x7fc3972ab5e0>
│ │ │ +Out[139]: <cartopy.mpl.feature_artist.FeatureArtist at 0x701c35785a30>
│ │ │
│ │ │ In [140]: ax.gridlines(draw_labels=True)
│ │ │ -Out[140]: <cartopy.mpl.gridliner.Gridliner at 0x7fc3972ab520>
│ │ │ +Out[140]: <cartopy.mpl.gridliner.Gridliner at 0x701c3579dee0>
│ │ │
You can however decide to infer the cell boundaries and use the
│ │ │ infer_intervals
keyword:
In [141]: ax = plt.subplot(projection=ccrs.PlateCarree())
│ │ │
│ │ │ In [142]: da.plot.pcolormesh("lon", "lat", ax=ax, infer_intervals=True)
│ │ │ -Out[142]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x7fc3970126a0>
│ │ │ +Out[142]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x701c35763b20>
│ │ │
│ │ │ In [143]: ax.scatter(lon, lat, transform=ccrs.PlateCarree())
│ │ │ -Out[143]: <matplotlib.collections.PathCollection at 0x7fc396fc5670>
│ │ │ +Out[143]: <matplotlib.collections.PathCollection at 0x701c354c3f40>
│ │ │
│ │ │ In [144]: ax.coastlines()
│ │ │ -Out[144]: <cartopy.mpl.feature_artist.FeatureArtist at 0x7fc39707e340>
│ │ │ +Out[144]: <cartopy.mpl.feature_artist.FeatureArtist at 0x701c356d2f10>
│ │ │
│ │ │ In [145]: ax.gridlines(draw_labels=True)
│ │ │ -Out[145]: <cartopy.mpl.gridliner.Gridliner at 0x7fc3972c03d0>
│ │ │ +Out[145]: <cartopy.mpl.gridliner.Gridliner at 0x701c356d29d0>
│ │ │
Note
│ │ │The data model of xarray does not support datasets with cell boundaries │ │ │ yet. If you want to use these coordinates, you’ll have to make the plots │ │ │ outside the xarray framework.
│ │ │One can also make line plots with multidimensional coordinates. In this case, hue
must be a dimension name, not a coordinate name.
In [146]: f, ax = plt.subplots(2, 1)
│ │ │
│ │ │ In [147]: da.plot.line(x="lon", hue="y", ax=ax[0])
│ │ │ Out[147]:
│ │ │ -[<matplotlib.lines.Line2D at 0x7fc396f5d340>,
│ │ │ - <matplotlib.lines.Line2D at 0x7fc396f5d3d0>,
│ │ │ - <matplotlib.lines.Line2D at 0x7fc396f5d460>,
│ │ │ - <matplotlib.lines.Line2D at 0x7fc396f5d5e0>]
│ │ │ +[<matplotlib.lines.Line2D at 0x701c3545ec10>,
│ │ │ + <matplotlib.lines.Line2D at 0x701c3545eca0>,
│ │ │ + <matplotlib.lines.Line2D at 0x701c3545ed30>,
│ │ │ + <matplotlib.lines.Line2D at 0x701c3545eeb0>]
│ │ │
│ │ │ In [148]: da.plot.line(x="lon", hue="x", ax=ax[1])
│ │ │ Out[148]:
│ │ │ -[<matplotlib.lines.Line2D at 0x7fc396f6a1c0>,
│ │ │ - <matplotlib.lines.Line2D at 0x7fc396f71a00>,
│ │ │ - <matplotlib.lines.Line2D at 0x7fc396f71ee0>,
│ │ │ - <matplotlib.lines.Line2D at 0x7fc396f71430>,
│ │ │ - <matplotlib.lines.Line2D at 0x7fc396f71370>]
│ │ │ +[<matplotlib.lines.Line2D at 0x701c354c6970>,
│ │ │ + <matplotlib.lines.Line2D at 0x701c354c69a0>,
│ │ │ + <matplotlib.lines.Line2D at 0x701c35476640>,
│ │ │ + <matplotlib.lines.Line2D at 0x701c35401400>,
│ │ │ + <matplotlib.lines.Line2D at 0x701c35401340>]
│ │ │
New xray.Dataset.where
method for masking xray objects according
│ │ │ to some criteria. This works particularly well with multi-dimensional data:
In [44]: ds = xray.Dataset(coords={"x": range(100), "y": range(100)})
│ │ │
│ │ │ In [45]: ds["distance"] = np.sqrt(ds.x ** 2 + ds.y ** 2)
│ │ │
│ │ │ In [46]: ds.distance.where(ds.distance < 100).plot()
│ │ │ -Out[46]: <matplotlib.collections.QuadMesh at 0x7fc396f487c0>
│ │ │ +Out[46]: <matplotlib.collections.QuadMesh at 0x701c347b20a0>
│ │ │
Added new methods xray.DataArray.diff
and xray.Dataset.diff
│ │ │ for finite difference calculations along a given axis.
New xray.DataArray.to_masked_array
convenience method for