--- /srv/rebuilderd/tmp/rebuilderdDjOM8V/inputs/python-xarray-doc_2025.03.1-8_all.deb +++ /srv/rebuilderd/tmp/rebuilderdDjOM8V/out/python-xarray-doc_2025.03.1-8_all.deb ├── file list │ @@ -1,3 +1,3 @@ │ -rw-r--r-- 0 0 0 4 2025-05-05 09:04:03.000000 debian-binary │ --rw-r--r-- 0 0 0 7568 2025-05-05 09:04:03.000000 control.tar.xz │ --rw-r--r-- 0 0 0 5266132 2025-05-05 09:04:03.000000 data.tar.xz │ +-rw-r--r-- 0 0 0 7564 2025-05-05 09:04:03.000000 control.tar.xz │ +-rw-r--r-- 0 0 0 5266332 2025-05-05 09:04:03.000000 data.tar.xz ├── control.tar.xz │ ├── control.tar │ │ ├── ./md5sums │ │ │ ├── ./md5sums │ │ │ │┄ Files differ ├── data.tar.xz │ ├── data.tar │ │ ├── file list │ │ │ @@ -278,31 +278,31 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 461 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/dask.html │ │ │ -rw-r--r-- 0 root (0) root (0) 494 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/data-structures.html │ │ │ -rw-r--r-- 0 root (0) root (0) 8448 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/developers-meeting.html │ │ │ -rw-r--r-- 0 root (0) root (0) 479 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/duckarrays.html │ │ │ -rw-r--r-- 0 root (0) root (0) 22909 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/ecosystem.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/ │ │ │ -rw-r--r-- 0 root (0) root (0) 196815 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.html │ │ │ --rw-r--r-- 0 root (0) root (0) 15999 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 16006 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 82000 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/ROMS_ocean_model.html │ │ │ --rw-r--r-- 0 root (0) root (0) 27736 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/ROMS_ocean_model.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 27740 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/ROMS_ocean_model.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 165093 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/apply_ufunc_vectorize_1d.html │ │ │ --rw-r--r-- 0 root (0) root (0) 13306 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/apply_ufunc_vectorize_1d.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 13310 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/apply_ufunc_vectorize_1d.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 73045 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/area_weighted_temperature.html │ │ │ --rw-r--r-- 0 root (0) root (0) 25151 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/area_weighted_temperature.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 25156 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/area_weighted_temperature.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 58861 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/blank_template.html │ │ │ --rw-r--r-- 0 root (0) root (0) 5159 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/blank_template.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 5156 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/blank_template.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 81893 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/monthly-means.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7222 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/monthly-means.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 7224 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/monthly-means.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 74674 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/multidimensional-coords.html │ │ │ --rw-r--r-- 0 root (0) root (0) 14758 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/multidimensional-coords.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 14770 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/multidimensional-coords.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 81800 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/visualization_gallery.html │ │ │ --rw-r--r-- 0 root (0) root (0) 7005 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/visualization_gallery.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 7006 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/visualization_gallery.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 87944 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/weather-data.html │ │ │ --rw-r--r-- 0 root (0) root (0) 368070 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/weather-data.ipynb.gz │ │ │ +-rw-r--r-- 0 root (0) root (0) 368067 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/examples/weather-data.ipynb.gz │ │ │ -rw-r--r-- 0 root (0) root (0) 491 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/faq.html │ │ │ -rw-r--r-- 0 root (0) root (0) 15073 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/gallery.html │ │ │ -rw-r--r-- 0 root (0) root (0) 16306 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/genindex.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/getting-started-guide/ │ │ │ -rw-r--r-- 0 root (0) root (0) 51674 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/getting-started-guide/faq.html │ │ │ -rw-r--r-- 0 root (0) root (0) 7741 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/getting-started-guide/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 25661 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/getting-started-guide/installing.html │ │ │ @@ -332,36 +332,36 @@ │ │ │ -rw-r--r-- 0 root (0) root (0) 473 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/plotting.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6546 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/py-modindex.html │ │ │ -rw-r--r-- 0 root (0) root (0) 524 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/quick-overview.html │ │ │ -rw-r--r-- 0 root (0) root (0) 443 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/related-projects.html │ │ │ -rw-r--r-- 0 root (0) root (0) 476 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/reshaping.html │ │ │ -rw-r--r-- 0 root (0) root (0) 24428 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/roadmap.html │ │ │ -rw-r--r-- 0 root (0) root (0) 6341 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/search.html │ │ │ --rw-r--r-- 0 root (0) root (0) 269881 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/searchindex.js │ │ │ +-rw-r--r-- 0 root (0) root (0) 270135 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/searchindex.js │ │ │ -rw-r--r-- 0 root (0) root (0) 482 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/terminology.html │ │ │ -rw-r--r-- 0 root (0) root (0) 482 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/time-series.html │ │ │ -rw-r--r-- 0 root (0) root (0) 13358 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/tutorials-and-videos.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/ │ │ │ -rw-r--r-- 0 root (0) root (0) 58676 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/combining.html │ │ │ --rw-r--r-- 0 root (0) root (0) 140285 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/computation.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 140282 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/computation.html │ │ │ -rw-r--r-- 0 root (0) root (0) 71358 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/dask.html │ │ │ -rw-r--r-- 0 root (0) root (0) 150064 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/data-structures.html │ │ │ -rw-r--r-- 0 root (0) root (0) 35119 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/duckarrays.html │ │ │ -rw-r--r-- 0 root (0) root (0) 50924 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/groupby.html │ │ │ -rw-r--r-- 0 root (0) root (0) 120436 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/hierarchical-data.html │ │ │ -rw-r--r-- 0 root (0) root (0) 9025 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/index.html │ │ │ -rw-r--r-- 0 root (0) root (0) 140669 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/indexing.html │ │ │ -rw-r--r-- 0 root (0) root (0) 68768 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/interpolation.html │ │ │ -rw-r--r-- 0 root (0) root (0) 147716 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/io.html │ │ │ -rw-r--r-- 0 root (0) root (0) 11704 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/options.html │ │ │ -rw-r--r-- 0 root (0) root (0) 42223 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/pandas.html │ │ │ -rw-r--r-- 0 root (0) root (0) 135402 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/plotting.html │ │ │ -rw-r--r-- 0 root (0) root (0) 63021 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/reshaping.html │ │ │ -rw-r--r-- 0 root (0) root (0) 46813 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/terminology.html │ │ │ --rw-r--r-- 0 root (0) root (0) 47842 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/testing.html │ │ │ +-rw-r--r-- 0 root (0) root (0) 47529 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/testing.html │ │ │ -rw-r--r-- 0 root (0) root (0) 53681 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/time-series.html │ │ │ -rw-r--r-- 0 root (0) root (0) 47248 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/user-guide/weather-climate.html │ │ │ -rw-r--r-- 0 root (0) root (0) 494 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/weather-climate.html │ │ │ -rw-r--r-- 0 root (0) root (0) 1051865 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/whats-new.html │ │ │ -rw-r--r-- 0 root (0) root (0) 512 2025-05-05 09:04:03.000000 ./usr/share/doc/python-xarray-doc/html/why-xarray.html │ │ │ drwxr-xr-x 0 root (0) root (0) 0 2025-05-05 09:04:03.000000 ./usr/share/doc-base/ │ │ │ -rw-r--r-- 0 root (0) root (0) 290 2025-05-05 09:04:03.000000 ./usr/share/doc-base/python-xarray-doc.python-xarray-doc │ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.html │ │ │ @@ -149,15 +149,15 @@ │ │ │ 705 server_hostname: str = self.host │ │ │ │ │ │ File /usr/lib/python3/dist-packages/urllib3/connection.py:205, in HTTPConnection._new_conn(self) │ │ │ 204 except socket.gaierror as e: │ │ │ --> 205 raise NameResolutionError(self.host, self, e) from e │ │ │ 206 except SocketTimeout as e: │ │ │ │ │ │ -NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7f6085870050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution) │ │ │ +NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7ff1ef9d8050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution) │ │ │ │ │ │ The above exception was the direct cause of the following exception: │ │ │ │ │ │ MaxRetryError Traceback (most recent call last) │ │ │ File /usr/lib/python3/dist-packages/requests/adapters.py:667, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies) │ │ │ 666 try: │ │ │ --> 667 resp = conn.urlopen( │ │ │ @@ -183,15 +183,15 @@ │ │ │ 844 retries.sleep() │ │ │ │ │ │ File /usr/lib/python3/dist-packages/urllib3/util/retry.py:519, in Retry.increment(self, method, url, response, error, _pool, _stacktrace) │ │ │ 518 reason = error or ResponseError(cause) │ │ │ --> 519 raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] │ │ │ 521 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry) │ │ │ │ │ │ -MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f6085870050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)")) │ │ │ +MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7ff1ef9d8050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)")) │ │ │ │ │ │ During handling of the above exception, another exception occurred: │ │ │ │ │ │ ConnectionError Traceback (most recent call last) │ │ │ Cell In[2], line 1 │ │ │ ----> 1 ds = xr.tutorial.load_dataset("era5-2mt-2019-03-uk.grib", engine="cfgrib") │ │ │ │ │ │ @@ -280,15 +280,15 @@ │ │ │ 696 if isinstance(e.reason, _SSLError): │ │ │ 697 # This branch is for urllib3 v1.22 and later. │ │ │ 698 raise SSLError(e, request=request) │ │ │ --> 700 raise ConnectionError(e, request=request) │ │ │ 702 except ClosedPoolError as e: │ │ │ 703 raise ConnectionError(e, request=request) │ │ │ │ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f6085870050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)")) │ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7ff1ef9d8050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)")) │ │ │ │ │ │ │ │ │
Let’s create a simple plot of 2-m air temperature in degrees Celsius:
│ │ │[3]:
│ │ │
│ │ │ -Error in callback <function _draw_all_if_interactive at 0x7f6085c31bc0> (for post_execute), with arguments args (),kwargs {}:
│ │ │ +Error in callback <function _draw_all_if_interactive at 0x7ff1efd9dbc0> (for post_execute), with arguments args (),kwargs {}:
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -93,15 +93,15 @@
│ │ │ │ File /usr/lib/python3/dist-packages/urllib3/connection.py:205, in
│ │ │ │ HTTPConnection._new_conn(self)
│ │ │ │ 204 except socket.gaierror as e:
│ │ │ │ --> 205 raise NameResolutionError(self.host, self, e) from e
│ │ │ │ 206 except SocketTimeout as e:
│ │ │ │
│ │ │ │ NameResolutionError: : Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ +0x7ff1ef9d8050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ in name resolution)
│ │ │ │
│ │ │ │ The above exception was the direct cause of the following exception:
│ │ │ │
│ │ │ │ MaxRetryError Traceback (most recent call last)
│ │ │ │ File /usr/lib/python3/dist-packages/requests/adapters.py:667, in
│ │ │ │ HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
│ │ │ │ @@ -137,15 +137,15 @@
│ │ │ │ --> 519 raise MaxRetryError(_pool, url, reason) from reason # type: ignore
│ │ │ │ [arg-type]
│ │ │ │ 521 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
│ │ │ │
│ │ │ │ MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries
│ │ │ │ exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib
│ │ │ │ (Caused by NameResolutionError(": Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ +0x7ff1ef9d8050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ in name resolution)"))
│ │ │ │
│ │ │ │ During handling of the above exception, another exception occurred:
│ │ │ │
│ │ │ │ ConnectionError Traceback (most recent call last)
│ │ │ │ Cell In[2], line 1
│ │ │ │ ----> 1 ds = xr.tutorial.load_dataset("era5-2mt-2019-03-uk.grib",
│ │ │ │ @@ -255,15 +255,15 @@
│ │ │ │ --> 700 raise ConnectionError(e, request=request)
│ │ │ │ 702 except ClosedPoolError as e:
│ │ │ │ 703 raise ConnectionError(e, request=request)
│ │ │ │
│ │ │ │ ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries
│ │ │ │ exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib
│ │ │ │ (Caused by NameResolutionError(": Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ +0x7ff1ef9d8050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ in name resolution)"))
│ │ │ │ Let’s create a simple plot of 2-m air temperature in degrees Celsius:
│ │ │ │ [3]:
│ │ │ │ ds = ds - 273.15
│ │ │ │ ds.t2m[0].plot(cmap=plt.cm.coolwarm)
│ │ │ │ ---------------------------------------------------------------------------
│ │ │ │ NameError Traceback (most recent call last)
│ │ │ │ @@ -298,15 +298,15 @@
│ │ │ │ 10 plt.title("ERA5 - 2m temperature British Isles March 2019")
│ │ │ │
│ │ │ │ NameError: name 'ds' is not defined
│ │ │ │ /usr/lib/python3/dist-packages/cartopy/io/__init__.py:241: DownloadWarning:
│ │ │ │ Downloading: https://naturalearth.s3.amazonaws.com/10m_physical/
│ │ │ │ ne_10m_coastline.zip
│ │ │ │ warnings.warn(f'Downloading: {url}', DownloadWarning)
│ │ │ │ -Error in callback (for
│ │ │ │ +Error in callback (for
│ │ │ │ post_execute), with arguments args (),kwargs {}:
│ │ │ │ ---------------------------------------------------------------------------
│ │ │ │ gaierror Traceback (most recent call last)
│ │ │ │ File /usr/lib/python3.13/urllib/request.py:1319, in AbstractHTTPHandler.do_open
│ │ │ │ (self, http_class, req, **http_conn_args)
│ │ │ │ 1318 try:
│ │ │ │ -> 1319 h.request(req.get_method(), req.selector, req.data, headers,
│ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/ERA5-GRIB-example.ipynb.gz
│ │ │ ├── ERA5-GRIB-example.ipynb
│ │ │ │ ├── Pretty-printed
│ │ │ │ │┄ Similarity: 0.9983880154932787%
│ │ │ │ │┄ Differences: {"'cells'": "{2: {'metadata': {'execution': {'iopub.execute_input': '2025-07-22T10:01:19.620617Z', "
│ │ │ │ │┄ "'iopub.status.busy': '2025-07-22T10:01:19.620392Z', 'iopub.status.idle': "
│ │ │ │ │┄ "'2025-07-22T10:01:21.793989Z', 'shell.execute_reply': "
│ │ │ │ │┄ "'2025-07-22T10:01:21.793291Z'}}}, 4: {'metadata': {'execution': "
│ │ │ │ │┄ "{'iopub.execute_input': '2025-07-22T10:01:21.796420Z', 'iopub.status.busy': "
│ │ │ │ │┄ "'2025-07-22T10:01:21.796047Z', 'iopub.status.idle': '2025-07-22T10:01:2 […]
│ │ │ │ │ @@ -15,18 +15,18 @@
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "cell_type": "code",
│ │ │ │ │ "execution_count": 1,
│ │ │ │ │ "metadata": {
│ │ │ │ │ "execution": {
│ │ │ │ │ - "iopub.execute_input": "2025-05-05T11:44:25.386771Z",
│ │ │ │ │ - "iopub.status.busy": "2025-05-05T11:44:25.386423Z",
│ │ │ │ │ - "iopub.status.idle": "2025-05-05T11:44:27.215832Z",
│ │ │ │ │ - "shell.execute_reply": "2025-05-05T11:44:27.214622Z"
│ │ │ │ │ + "iopub.execute_input": "2025-07-22T10:01:19.620617Z",
│ │ │ │ │ + "iopub.status.busy": "2025-07-22T10:01:19.620392Z",
│ │ │ │ │ + "iopub.status.idle": "2025-07-22T10:01:21.793989Z",
│ │ │ │ │ + "shell.execute_reply": "2025-07-22T10:01:21.793291Z"
│ │ │ │ │ }
│ │ │ │ │ },
│ │ │ │ │ "outputs": [],
│ │ │ │ │ "source": [
│ │ │ │ │ "import xarray as xr\n",
│ │ │ │ │ "import matplotlib.pyplot as plt"
│ │ │ │ │ ]
│ │ │ │ │ @@ -39,24 +39,24 @@
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "cell_type": "code",
│ │ │ │ │ "execution_count": 2,
│ │ │ │ │ "metadata": {
│ │ │ │ │ "execution": {
│ │ │ │ │ - "iopub.execute_input": "2025-05-05T11:44:27.219900Z",
│ │ │ │ │ - "iopub.status.busy": "2025-05-05T11:44:27.219480Z",
│ │ │ │ │ - "iopub.status.idle": "2025-05-05T11:44:27.842576Z",
│ │ │ │ │ - "shell.execute_reply": "2025-05-05T11:44:27.841304Z"
│ │ │ │ │ + "iopub.execute_input": "2025-07-22T10:01:21.796420Z",
│ │ │ │ │ + "iopub.status.busy": "2025-07-22T10:01:21.796047Z",
│ │ │ │ │ + "iopub.status.idle": "2025-07-22T10:01:22.493424Z",
│ │ │ │ │ + "shell.execute_reply": "2025-07-22T10:01:22.492771Z"
│ │ │ │ │ }
│ │ │ │ │ },
│ │ │ │ │ "outputs": [
│ │ │ │ │ {
│ │ │ │ │ "ename": "ConnectionError",
│ │ │ │ │ - "evalue": "HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ + "evalue": "HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ "output_type": "error",
│ │ │ │ │ "traceback": [
│ │ │ │ │ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
│ │ │ │ │ "\u001b[0;31mgaierror\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:198\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 197\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 198\u001b[0m sock \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_dns_host\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mport\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[43m \u001b[49m\u001b[43msource_address\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msource_address\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 202\u001b[0m \u001b[43m \u001b[49m\u001b[43msocket_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msocket_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 203\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m socket\u001b[38;5;241m.\u001b[39mgaierror \u001b[38;5;28;01mas\u001b[39;00m e:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/util/connection.py:60\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LocationParseError(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mhost\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, label empty or too long\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m---> 60\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSOCK_STREAM\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 61\u001b[0m af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3.13/socket.py:977\u001b[0m, in \u001b[0;36mgetaddrinfo\u001b[0;34m(host, port, family, type, proto, flags)\u001b[0m\n\u001b[1;32m 976\u001b[0m addrlist \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m--> 977\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43m_socket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproto\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 978\u001b[0m af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n",
│ │ │ │ │ @@ -65,35 +65,35 @@
│ │ │ │ │ "\u001b[0;31mNameResolutionError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:787\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 786\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[0;32m--> 787\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 788\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 789\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 790\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 791\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 792\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 793\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 794\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 795\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 796\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 797\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 798\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 799\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 800\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 802\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:488\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 487\u001b[0m new_e \u001b[38;5;241m=\u001b[39m _wrap_proxy_error(new_e, conn\u001b[38;5;241m.\u001b[39mproxy\u001b[38;5;241m.\u001b[39mscheme)\n\u001b[0;32m--> 488\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m new_e\n\u001b[1;32m 490\u001b[0m \u001b[38;5;66;03m# conn.request() calls http.client.*.request, not the method in\u001b[39;00m\n\u001b[1;32m 491\u001b[0m \u001b[38;5;66;03m# urllib3.request. It also calls makefile (recv) on the socket.\u001b[39;00m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:464\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 464\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_conn\u001b[49m\u001b[43m(\u001b[49m\u001b[43mconn\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (SocketTimeout, BaseSSLError) \u001b[38;5;28;01mas\u001b[39;00m e:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1093\u001b[0m, in \u001b[0;36mHTTPSConnectionPool._validate_conn\u001b[0;34m(self, conn)\u001b[0m\n\u001b[1;32m 1092\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m conn\u001b[38;5;241m.\u001b[39mis_closed:\n\u001b[0;32m-> 1093\u001b[0m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1095\u001b[0m \u001b[38;5;66;03m# TODO revise this, see https://github.com/urllib3/urllib3/issues/2791\u001b[39;00m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:704\u001b[0m, in \u001b[0;36mHTTPSConnection.connect\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 703\u001b[0m sock: socket\u001b[38;5;241m.\u001b[39msocket \u001b[38;5;241m|\u001b[39m ssl\u001b[38;5;241m.\u001b[39mSSLSocket\n\u001b[0;32m--> 704\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;241m=\u001b[39m sock \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_new_conn\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m server_hostname: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:205\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m socket\u001b[38;5;241m.\u001b[39mgaierror \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m--> 205\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m NameResolutionError(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost, \u001b[38;5;28mself\u001b[39m, e) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[1;32m 206\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m SocketTimeout \u001b[38;5;28;01mas\u001b[39;00m e:\n",
│ │ │ │ │ - "\u001b[0;31mNameResolutionError\u001b[0m: : Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)",
│ │ │ │ │ + "\u001b[0;31mNameResolutionError\u001b[0m: : Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)",
│ │ │ │ │ "\nThe above exception was the direct cause of the following exception:\n",
│ │ │ │ │ "\u001b[0;31mMaxRetryError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/adapters.py:667\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 666\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 667\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 668\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 669\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 670\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 671\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 672\u001b[0m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 673\u001b[0m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 674\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 675\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 676\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 677\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 678\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 679\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 681\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:841\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 839\u001b[0m new_e \u001b[38;5;241m=\u001b[39m ProtocolError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnection aborted.\u001b[39m\u001b[38;5;124m\"\u001b[39m, new_e)\n\u001b[0;32m--> 841\u001b[0m retries \u001b[38;5;241m=\u001b[39m \u001b[43mretries\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mincrement\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 842\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merror\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnew_e\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_stacktrace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msys\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexc_info\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 843\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 844\u001b[0m retries\u001b[38;5;241m.\u001b[39msleep()\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/util/retry.py:519\u001b[0m, in \u001b[0;36mRetry.increment\u001b[0;34m(self, method, url, response, error, _pool, _stacktrace)\u001b[0m\n\u001b[1;32m 518\u001b[0m reason \u001b[38;5;241m=\u001b[39m error \u001b[38;5;129;01mor\u001b[39;00m ResponseError(cause)\n\u001b[0;32m--> 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m MaxRetryError(_pool, url, reason) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mreason\u001b[39;00m \u001b[38;5;66;03m# type: ignore[arg-type]\u001b[39;00m\n\u001b[1;32m 521\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIncremented Retry for (url=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m): \u001b[39m\u001b[38;5;132;01m%r\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, url, new_retry)\n",
│ │ │ │ │ - "\u001b[0;31mMaxRetryError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ + "\u001b[0;31mMaxRetryError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ "\nDuring handling of the above exception, another exception occurred:\n",
│ │ │ │ │ "\u001b[0;31mConnectionError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "Cell \u001b[0;32mIn[2], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m ds \u001b[38;5;241m=\u001b[39m \u001b[43mxr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtutorial\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload_dataset\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mera5-2mt-2019-03-uk.grib\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mengine\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mcfgrib\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/xarray/tutorial.py:215\u001b[0m, in \u001b[0;36mload_dataset\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 178\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mload_dataset\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Dataset:\n\u001b[1;32m 179\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 180\u001b[0m \u001b[38;5;124;03m Open, load into memory, and close a dataset from the online repository\u001b[39;00m\n\u001b[1;32m 181\u001b[0m \u001b[38;5;124;03m (requires internet).\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[38;5;124;03m load_dataset\u001b[39;00m\n\u001b[1;32m 214\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 215\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[43mopen_dataset\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m ds:\n\u001b[1;32m 216\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ds\u001b[38;5;241m.\u001b[39mload()\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/xarray/tutorial.py:167\u001b[0m, in \u001b[0;36mopen_dataset\u001b[0;34m(name, cache, cache_dir, engine, **kws)\u001b[0m\n\u001b[1;32m 164\u001b[0m downloader \u001b[38;5;241m=\u001b[39m pooch\u001b[38;5;241m.\u001b[39mHTTPDownloader(headers\u001b[38;5;241m=\u001b[39mheaders)\n\u001b[1;32m 166\u001b[0m \u001b[38;5;66;03m# retrieve the file\u001b[39;00m\n\u001b[0;32m--> 167\u001b[0m filepath \u001b[38;5;241m=\u001b[39m \u001b[43mpooch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mretrieve\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 168\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mknown_hash\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdownloader\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdownloader\u001b[49m\n\u001b[1;32m 169\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 170\u001b[0m ds \u001b[38;5;241m=\u001b[39m _open_dataset(filepath, engine\u001b[38;5;241m=\u001b[39mengine, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkws)\n\u001b[1;32m 171\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m cache:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/pooch/core.py:239\u001b[0m, in \u001b[0;36mretrieve\u001b[0;34m(url, known_hash, fname, path, processor, downloader, progressbar)\u001b[0m\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m downloader \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 237\u001b[0m downloader \u001b[38;5;241m=\u001b[39m choose_downloader(url, progressbar\u001b[38;5;241m=\u001b[39mprogressbar)\n\u001b[0;32m--> 239\u001b[0m \u001b[43mstream_download\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfull_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mknown_hash\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdownloader\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpooch\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 241\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m known_hash \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 242\u001b[0m get_logger()\u001b[38;5;241m.\u001b[39minfo(\n\u001b[1;32m 243\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSHA256 hash of downloaded file: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 244\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUse this value as the \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mknown_hash\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m argument of \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpooch.retrieve\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 247\u001b[0m file_hash(\u001b[38;5;28mstr\u001b[39m(full_path)),\n\u001b[1;32m 248\u001b[0m )\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/pooch/core.py:807\u001b[0m, in \u001b[0;36mstream_download\u001b[0;34m(url, fname, known_hash, downloader, pooch, retry_if_failed)\u001b[0m\n\u001b[1;32m 803\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 804\u001b[0m \u001b[38;5;66;03m# Stream the file to a temporary so that we can safely check its\u001b[39;00m\n\u001b[1;32m 805\u001b[0m \u001b[38;5;66;03m# hash before overwriting the original.\u001b[39;00m\n\u001b[1;32m 806\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m temporary_file(path\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mstr\u001b[39m(fname\u001b[38;5;241m.\u001b[39mparent)) \u001b[38;5;28;01mas\u001b[39;00m tmp:\n\u001b[0;32m--> 807\u001b[0m \u001b[43mdownloader\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtmp\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpooch\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 808\u001b[0m hash_matches(tmp, known_hash, strict\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, source\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mstr\u001b[39m(fname\u001b[38;5;241m.\u001b[39mname))\n\u001b[1;32m 809\u001b[0m shutil\u001b[38;5;241m.\u001b[39mmove(tmp, \u001b[38;5;28mstr\u001b[39m(fname))\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/pooch/downloaders.py:220\u001b[0m, in \u001b[0;36mHTTPDownloader.__call__\u001b[0;34m(self, url, output_file, pooch, check_only)\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;66;03m# pylint: enable=consider-using-with\u001b[39;00m\n\u001b[1;32m 219\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 220\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mrequests\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 221\u001b[0m response\u001b[38;5;241m.\u001b[39mraise_for_status()\n\u001b[1;32m 222\u001b[0m content \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39miter_content(chunk_size\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchunk_size)\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/api.py:73\u001b[0m, in \u001b[0;36mget\u001b[0;34m(url, params, **kwargs)\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget\u001b[39m(url, params\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 63\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Sends a GET request.\u001b[39;00m\n\u001b[1;32m 64\u001b[0m \n\u001b[1;32m 65\u001b[0m \u001b[38;5;124;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;124;03m :rtype: requests.Response\u001b[39;00m\n\u001b[1;32m 71\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m---> 73\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mget\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/api.py:59\u001b[0m, in \u001b[0;36mrequest\u001b[0;34m(method, url, **kwargs)\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;66;03m# By using the 'with' statement we are sure the session is closed, thus we\u001b[39;00m\n\u001b[1;32m 56\u001b[0m \u001b[38;5;66;03m# avoid leaving sockets open which can trigger a ResourceWarning in some\u001b[39;00m\n\u001b[1;32m 57\u001b[0m \u001b[38;5;66;03m# cases, and look like a memory leak in others.\u001b[39;00m\n\u001b[1;32m 58\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m sessions\u001b[38;5;241m.\u001b[39mSession() \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[0;32m---> 59\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msession\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m 587\u001b[0m }\n\u001b[1;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/adapters.py:700\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 696\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(e\u001b[38;5;241m.\u001b[39mreason, _SSLError):\n\u001b[1;32m 697\u001b[0m \u001b[38;5;66;03m# This branch is for urllib3 v1.22 and later.\u001b[39;00m\n\u001b[1;32m 698\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m SSLError(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[0;32m--> 700\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[1;32m 702\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ClosedPoolError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 703\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(e, request\u001b[38;5;241m=\u001b[39mrequest)\n",
│ │ │ │ │ - "\u001b[0;31mConnectionError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))"
│ │ │ │ │ + "\u001b[0;31mConnectionError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/era5-2mt-2019-03-uk.grib (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))"
│ │ │ │ │ ]
│ │ │ │ │ }
│ │ │ │ │ ],
│ │ │ │ │ "source": [
│ │ │ │ │ "ds = xr.tutorial.load_dataset(\"era5-2mt-2019-03-uk.grib\", engine=\"cfgrib\")"
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ @@ -105,18 +105,18 @@
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "cell_type": "code",
│ │ │ │ │ "execution_count": 3,
│ │ │ │ │ "metadata": {
│ │ │ │ │ "execution": {
│ │ │ │ │ - "iopub.execute_input": "2025-05-05T11:44:27.899913Z",
│ │ │ │ │ - "iopub.status.busy": "2025-05-05T11:44:27.899568Z",
│ │ │ │ │ - "iopub.status.idle": "2025-05-05T11:44:27.920173Z",
│ │ │ │ │ - "shell.execute_reply": "2025-05-05T11:44:27.919192Z"
│ │ │ │ │ + "iopub.execute_input": "2025-07-22T10:01:22.520382Z",
│ │ │ │ │ + "iopub.status.busy": "2025-07-22T10:01:22.520142Z",
│ │ │ │ │ + "iopub.status.idle": "2025-07-22T10:01:22.531657Z",
│ │ │ │ │ + "shell.execute_reply": "2025-07-22T10:01:22.531219Z"
│ │ │ │ │ }
│ │ │ │ │ },
│ │ │ │ │ "outputs": [
│ │ │ │ │ {
│ │ │ │ │ "ename": "NameError",
│ │ │ │ │ "evalue": "name 'ds' is not defined",
│ │ │ │ │ "output_type": "error",
│ │ │ │ │ @@ -141,18 +141,18 @@
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "cell_type": "code",
│ │ │ │ │ "execution_count": 4,
│ │ │ │ │ "metadata": {
│ │ │ │ │ "execution": {
│ │ │ │ │ - "iopub.execute_input": "2025-05-05T11:44:27.923482Z",
│ │ │ │ │ - "iopub.status.busy": "2025-05-05T11:44:27.923167Z",
│ │ │ │ │ - "iopub.status.idle": "2025-05-05T11:44:30.318143Z",
│ │ │ │ │ - "shell.execute_reply": "2025-05-05T11:44:30.316923Z"
│ │ │ │ │ + "iopub.execute_input": "2025-07-22T10:01:22.533202Z",
│ │ │ │ │ + "iopub.status.busy": "2025-07-22T10:01:22.533027Z",
│ │ │ │ │ + "iopub.status.idle": "2025-07-22T10:01:24.445549Z",
│ │ │ │ │ + "shell.execute_reply": "2025-07-22T10:01:24.444800Z"
│ │ │ │ │ }
│ │ │ │ │ },
│ │ │ │ │ "outputs": [
│ │ │ │ │ {
│ │ │ │ │ "ename": "NameError",
│ │ │ │ │ "evalue": "name 'ds' is not defined",
│ │ │ │ │ "output_type": "error",
│ │ │ │ │ @@ -171,15 +171,15 @@
│ │ │ │ │ " warnings.warn(f'Downloading: {url}', DownloadWarning)\n"
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "name": "stdout",
│ │ │ │ │ "output_type": "stream",
│ │ │ │ │ "text": [
│ │ │ │ │ - "Error in callback (for post_execute), with arguments args (),kwargs {}:\n"
│ │ │ │ │ + "Error in callback (for post_execute), with arguments args (),kwargs {}:\n"
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "ename": "URLError",
│ │ │ │ │ "evalue": "",
│ │ │ │ │ "output_type": "error",
│ │ │ │ │ "traceback": [
│ │ │ │ │ @@ -318,18 +318,18 @@
│ │ │ │ │ ]
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "cell_type": "code",
│ │ │ │ │ "execution_count": 5,
│ │ │ │ │ "metadata": {
│ │ │ │ │ "execution": {
│ │ │ │ │ - "iopub.execute_input": "2025-05-05T11:44:30.321423Z",
│ │ │ │ │ - "iopub.status.busy": "2025-05-05T11:44:30.321230Z",
│ │ │ │ │ - "iopub.status.idle": "2025-05-05T11:44:30.335109Z",
│ │ │ │ │ - "shell.execute_reply": "2025-05-05T11:44:30.334154Z"
│ │ │ │ │ + "iopub.execute_input": "2025-07-22T10:01:24.447668Z",
│ │ │ │ │ + "iopub.status.busy": "2025-07-22T10:01:24.447500Z",
│ │ │ │ │ + "iopub.status.idle": "2025-07-22T10:01:24.479473Z",
│ │ │ │ │ + "shell.execute_reply": "2025-07-22T10:01:24.478909Z"
│ │ │ │ │ }
│ │ │ │ │ },
│ │ │ │ │ "outputs": [
│ │ │ │ │ {
│ │ │ │ │ "ename": "NameError",
│ │ │ │ │ "evalue": "name 'ds' is not defined",
│ │ │ │ │ "output_type": "error",
│ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/ROMS_ocean_model.html
│ │ │ @@ -185,15 +185,15 @@
│ │ │ 705 server_hostname: str = self.host
│ │ │
│ │ │ File /usr/lib/python3/dist-packages/urllib3/connection.py:205, in HTTPConnection._new_conn(self)
│ │ │ 204 except socket.gaierror as e:
│ │ │ --> 205 raise NameResolutionError(self.host, self, e) from e
│ │ │ 206 except SocketTimeout as e:
│ │ │
│ │ │ -NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7f06d41d0050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)
│ │ │ +NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7f3a3d0bc050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)
│ │ │
│ │ │ The above exception was the direct cause of the following exception:
│ │ │
│ │ │ MaxRetryError Traceback (most recent call last)
│ │ │ File /usr/lib/python3/dist-packages/requests/adapters.py:667, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
│ │ │ 666 try:
│ │ │ --> 667 resp = conn.urlopen(
│ │ │ @@ -219,15 +219,15 @@
│ │ │ 844 retries.sleep()
│ │ │
│ │ │ File /usr/lib/python3/dist-packages/urllib3/util/retry.py:519, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
│ │ │ 518 reason = error or ResponseError(cause)
│ │ │ --> 519 raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
│ │ │ 521 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
│ │ │
│ │ │ -MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/ROMS_example.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f06d41d0050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/ROMS_example.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f3a3d0bc050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │ During handling of the above exception, another exception occurred:
│ │ │
│ │ │ ConnectionError Traceback (most recent call last)
│ │ │ Cell In[2], line 2
│ │ │ 1 # load in the file
│ │ │ ----> 2 ds = xr.tutorial.open_dataset("ROMS_example.nc", chunks={"ocean_time": 1})
│ │ │ @@ -309,15 +309,15 @@
│ │ │ 696 if isinstance(e.reason, _SSLError):
│ │ │ 697 # This branch is for urllib3 v1.22 and later.
│ │ │ 698 raise SSLError(e, request=request)
│ │ │ --> 700 raise ConnectionError(e, request=request)
│ │ │ 702 except ClosedPoolError as e:
│ │ │ 703 raise ConnectionError(e, request=request)
│ │ │
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/ROMS_example.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f06d41d0050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/ROMS_example.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f3a3d0bc050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
Write equations to calculate the vertical coordinate. These will be only evaluated when data is requested. Information about the ROMS vertical coordinate can be found (here)[https://www.myroms.org/wiki/Vertical_S-coordinate]
│ │ │In short, for Vtransform==2
as used in this example,
The function we will apply is np.interp
which expects 1D numpy arrays. This functionality is already implemented in xarray so we use that capability to make sure we are not making mistakes.
[2]:
│ │ │
Plot the first timestep:
│ │ │[3]:
│ │ │
[ ]:
│ │ │
│ │ │ ├── html2text {}
│ │ │ │ @@ -92,15 +92,15 @@
│ │ │ │ File /usr/lib/python3/dist-packages/urllib3/connection.py:205, in
│ │ │ │ HTTPConnection._new_conn(self)
│ │ │ │ 204 except socket.gaierror as e:
│ │ │ │ --> 205 raise NameResolutionError(self.host, self, e) from e
│ │ │ │ 206 except SocketTimeout as e:
│ │ │ │
│ │ │ │ NameResolutionError: : Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ +0x7ff97bd66660>: Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ in name resolution)
│ │ │ │
│ │ │ │ The above exception was the direct cause of the following exception:
│ │ │ │
│ │ │ │ MaxRetryError Traceback (most recent call last)
│ │ │ │ File /usr/lib/python3/dist-packages/requests/adapters.py:667, in
│ │ │ │ HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
│ │ │ │ @@ -136,15 +136,15 @@
│ │ │ │ --> 519 raise MaxRetryError(_pool, url, reason) from reason # type: ignore
│ │ │ │ [arg-type]
│ │ │ │ 521 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
│ │ │ │
│ │ │ │ MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries
│ │ │ │ exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by
│ │ │ │ NameResolutionError(": Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ +0x7ff97bd66660>: Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ in name resolution)"))
│ │ │ │
│ │ │ │ During handling of the above exception, another exception occurred:
│ │ │ │
│ │ │ │ ConnectionError Traceback (most recent call last)
│ │ │ │ Cell In[1], line 5
│ │ │ │ 2 import numpy as np
│ │ │ │ @@ -256,15 +256,15 @@
│ │ │ │ --> 700 raise ConnectionError(e, request=request)
│ │ │ │ 702 except ClosedPoolError as e:
│ │ │ │ 703 raise ConnectionError(e, request=request)
│ │ │ │
│ │ │ │ ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries
│ │ │ │ exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by
│ │ │ │ NameResolutionError(": Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ +0x7ff97bd66660>: Failed to resolve 'github.com' ([Errno -3] Temporary failure
│ │ │ │ in name resolution)"))
│ │ │ │ [ ]:
│ │ │ │ _[_L_o_g_o_ _o_f_ _x_a_r_r_a_y_]
│ │ │ │ ************ _xx_aa_rr_rr_aa_yy ************
│ │ │ │ ******** NNaavviiggaattiioonn ********
│ │ │ │ For users
│ │ │ │ * _G_e_t_t_i_n_g_ _S_t_a_r_t_e_d
│ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/blank_template.ipynb.gz
│ │ │ ├── blank_template.ipynb
│ │ │ │ ├── Pretty-printed
│ │ │ │ │┄ Similarity: 0.9986293859649122%
│ │ │ │ │┄ Differences: {"'cells'": "{1: {'metadata': {'execution': {'iopub.execute_input': '2025-07-22T10:01:42.380520Z', "
│ │ │ │ │┄ "'iopub.status.busy': '2025-07-22T10:01:42.380352Z', 'iopub.status.idle': "
│ │ │ │ │┄ "'2025-07-22T10:01:43.804564Z', 'shell.execute_reply': "
│ │ │ │ │┄ "'2025-07-22T10:01:43.803820Z'}}, 'outputs': {0: {'evalue': "
│ │ │ │ │┄ "'HTTPSConnectionPool(host=\\'github.com\\', port=443): Max retries exceeded with url: "
│ │ │ │ │┄ '/pydata/xarray-data/raw/master/air_temperature.nc (Caused by '
│ │ │ │ │┄ […]
│ │ │ │ │ @@ -12,24 +12,24 @@
│ │ │ │ │ },
│ │ │ │ │ {
│ │ │ │ │ "cell_type": "code",
│ │ │ │ │ "execution_count": 1,
│ │ │ │ │ "id": "41b90ede",
│ │ │ │ │ "metadata": {
│ │ │ │ │ "execution": {
│ │ │ │ │ - "iopub.execute_input": "2025-05-05T11:44:48.988535Z",
│ │ │ │ │ - "iopub.status.busy": "2025-05-05T11:44:48.987977Z",
│ │ │ │ │ - "iopub.status.idle": "2025-05-05T11:44:50.565935Z",
│ │ │ │ │ - "shell.execute_reply": "2025-05-05T11:44:50.564496Z"
│ │ │ │ │ + "iopub.execute_input": "2025-07-22T10:01:42.380520Z",
│ │ │ │ │ + "iopub.status.busy": "2025-07-22T10:01:42.380352Z",
│ │ │ │ │ + "iopub.status.idle": "2025-07-22T10:01:43.804564Z",
│ │ │ │ │ + "shell.execute_reply": "2025-07-22T10:01:43.803820Z"
│ │ │ │ │ }
│ │ │ │ │ },
│ │ │ │ │ "outputs": [
│ │ │ │ │ {
│ │ │ │ │ "ename": "ConnectionError",
│ │ │ │ │ - "evalue": "HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ + "evalue": "HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ "output_type": "error",
│ │ │ │ │ "traceback": [
│ │ │ │ │ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
│ │ │ │ │ "\u001b[0;31mgaierror\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:198\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 197\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 198\u001b[0m sock \u001b[38;5;241m=\u001b[39m \u001b[43mconnection\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mcreate_connection\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_dns_host\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mport\u001b[49m\u001b[43m)\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[43m \u001b[49m\u001b[43msource_address\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msource_address\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 202\u001b[0m \u001b[43m \u001b[49m\u001b[43msocket_options\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msocket_options\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 203\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m socket\u001b[38;5;241m.\u001b[39mgaierror \u001b[38;5;28;01mas\u001b[39;00m e:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/util/connection.py:60\u001b[0m, in \u001b[0;36mcreate_connection\u001b[0;34m(address, timeout, source_address, socket_options)\u001b[0m\n\u001b[1;32m 58\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m LocationParseError(\u001b[38;5;124mf\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m{\u001b[39;00mhost\u001b[38;5;132;01m}\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m, label empty or too long\u001b[39m\u001b[38;5;124m\"\u001b[39m) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m\n\u001b[0;32m---> 60\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43msocket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSOCK_STREAM\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 61\u001b[0m af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3.13/socket.py:977\u001b[0m, in \u001b[0;36mgetaddrinfo\u001b[0;34m(host, port, family, type, proto, flags)\u001b[0m\n\u001b[1;32m 976\u001b[0m addrlist \u001b[38;5;241m=\u001b[39m []\n\u001b[0;32m--> 977\u001b[0m \u001b[38;5;28;01mfor\u001b[39;00m res \u001b[38;5;129;01min\u001b[39;00m \u001b[43m_socket\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mgetaddrinfo\u001b[49m\u001b[43m(\u001b[49m\u001b[43mhost\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mport\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfamily\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;28;43mtype\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mproto\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mflags\u001b[49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 978\u001b[0m af, socktype, proto, canonname, sa \u001b[38;5;241m=\u001b[39m res\n",
│ │ │ │ │ @@ -38,35 +38,35 @@
│ │ │ │ │ "\u001b[0;31mNameResolutionError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:787\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 786\u001b[0m \u001b[38;5;66;03m# Make the request on the HTTPConnection object\u001b[39;00m\n\u001b[0;32m--> 787\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_make_request\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 788\u001b[0m \u001b[43m \u001b[49m\u001b[43mconn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 789\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 790\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 791\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout_obj\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 792\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 793\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 794\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 795\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mretries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 796\u001b[0m \u001b[43m \u001b[49m\u001b[43mresponse_conn\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mresponse_conn\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 797\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mpreload_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 798\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdecode_content\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 799\u001b[0m \u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mresponse_kw\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 800\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 802\u001b[0m \u001b[38;5;66;03m# Everything went great!\u001b[39;00m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:488\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 487\u001b[0m new_e \u001b[38;5;241m=\u001b[39m _wrap_proxy_error(new_e, conn\u001b[38;5;241m.\u001b[39mproxy\u001b[38;5;241m.\u001b[39mscheme)\n\u001b[0;32m--> 488\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m new_e\n\u001b[1;32m 490\u001b[0m \u001b[38;5;66;03m# conn.request() calls http.client.*.request, not the method in\u001b[39;00m\n\u001b[1;32m 491\u001b[0m \u001b[38;5;66;03m# urllib3.request. It also calls makefile (recv) on the socket.\u001b[39;00m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:464\u001b[0m, in \u001b[0;36mHTTPConnectionPool._make_request\u001b[0;34m(self, conn, method, url, body, headers, retries, timeout, chunked, response_conn, preload_content, decode_content, enforce_content_length)\u001b[0m\n\u001b[1;32m 463\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 464\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_validate_conn\u001b[49m\u001b[43m(\u001b[49m\u001b[43mconn\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 465\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (SocketTimeout, BaseSSLError) \u001b[38;5;28;01mas\u001b[39;00m e:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1093\u001b[0m, in \u001b[0;36mHTTPSConnectionPool._validate_conn\u001b[0;34m(self, conn)\u001b[0m\n\u001b[1;32m 1092\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m conn\u001b[38;5;241m.\u001b[39mis_closed:\n\u001b[0;32m-> 1093\u001b[0m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconnect\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 1095\u001b[0m \u001b[38;5;66;03m# TODO revise this, see https://github.com/urllib3/urllib3/issues/2791\u001b[39;00m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:704\u001b[0m, in \u001b[0;36mHTTPSConnection.connect\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 703\u001b[0m sock: socket\u001b[38;5;241m.\u001b[39msocket \u001b[38;5;241m|\u001b[39m ssl\u001b[38;5;241m.\u001b[39mSSLSocket\n\u001b[0;32m--> 704\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39msock \u001b[38;5;241m=\u001b[39m sock \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_new_conn\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m server_hostname: \u001b[38;5;28mstr\u001b[39m \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connection.py:205\u001b[0m, in \u001b[0;36mHTTPConnection._new_conn\u001b[0;34m(self)\u001b[0m\n\u001b[1;32m 204\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m socket\u001b[38;5;241m.\u001b[39mgaierror \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[0;32m--> 205\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m NameResolutionError(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mhost, \u001b[38;5;28mself\u001b[39m, e) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01me\u001b[39;00m\n\u001b[1;32m 206\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m SocketTimeout \u001b[38;5;28;01mas\u001b[39;00m e:\n",
│ │ │ │ │ - "\u001b[0;31mNameResolutionError\u001b[0m: : Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)",
│ │ │ │ │ + "\u001b[0;31mNameResolutionError\u001b[0m: : Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)",
│ │ │ │ │ "\nThe above exception was the direct cause of the following exception:\n",
│ │ │ │ │ "\u001b[0;31mMaxRetryError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/adapters.py:667\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 666\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 667\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[43mconn\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43murlopen\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 668\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 669\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 670\u001b[0m \u001b[43m \u001b[49m\u001b[43mbody\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mbody\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 671\u001b[0m \u001b[43m \u001b[49m\u001b[43mheaders\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mheaders\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 672\u001b[0m \u001b[43m \u001b[49m\u001b[43mredirect\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 673\u001b[0m \u001b[43m \u001b[49m\u001b[43massert_same_host\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 674\u001b[0m \u001b[43m \u001b[49m\u001b[43mpreload_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 675\u001b[0m \u001b[43m \u001b[49m\u001b[43mdecode_content\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mFalse\u001b[39;49;00m\u001b[43m,\u001b[49m\n\u001b[1;32m 676\u001b[0m \u001b[43m \u001b[49m\u001b[43mretries\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mmax_retries\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 677\u001b[0m \u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 678\u001b[0m \u001b[43m \u001b[49m\u001b[43mchunked\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mchunked\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 679\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 681\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m (ProtocolError, \u001b[38;5;167;01mOSError\u001b[39;00m) \u001b[38;5;28;01mas\u001b[39;00m err:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/connectionpool.py:841\u001b[0m, in \u001b[0;36mHTTPConnectionPool.urlopen\u001b[0;34m(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, body_pos, preload_content, decode_content, **response_kw)\u001b[0m\n\u001b[1;32m 839\u001b[0m new_e \u001b[38;5;241m=\u001b[39m ProtocolError(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mConnection aborted.\u001b[39m\u001b[38;5;124m\"\u001b[39m, new_e)\n\u001b[0;32m--> 841\u001b[0m retries \u001b[38;5;241m=\u001b[39m \u001b[43mretries\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mincrement\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 842\u001b[0m \u001b[43m \u001b[49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43merror\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mnew_e\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_pool\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43m_stacktrace\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msys\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mexc_info\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m[\u001b[49m\u001b[38;5;241;43m2\u001b[39;49m\u001b[43m]\u001b[49m\n\u001b[1;32m 843\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 844\u001b[0m retries\u001b[38;5;241m.\u001b[39msleep()\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/urllib3/util/retry.py:519\u001b[0m, in \u001b[0;36mRetry.increment\u001b[0;34m(self, method, url, response, error, _pool, _stacktrace)\u001b[0m\n\u001b[1;32m 518\u001b[0m reason \u001b[38;5;241m=\u001b[39m error \u001b[38;5;129;01mor\u001b[39;00m ResponseError(cause)\n\u001b[0;32m--> 519\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m MaxRetryError(_pool, url, reason) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mreason\u001b[39;00m \u001b[38;5;66;03m# type: ignore[arg-type]\u001b[39;00m\n\u001b[1;32m 521\u001b[0m log\u001b[38;5;241m.\u001b[39mdebug(\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mIncremented Retry for (url=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m): \u001b[39m\u001b[38;5;132;01m%r\u001b[39;00m\u001b[38;5;124m\"\u001b[39m, url, new_retry)\n",
│ │ │ │ │ - "\u001b[0;31mMaxRetryError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ + "\u001b[0;31mMaxRetryError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))",
│ │ │ │ │ "\nDuring handling of the above exception, another exception occurred:\n",
│ │ │ │ │ "\u001b[0;31mConnectionError\u001b[0m Traceback (most recent call last)",
│ │ │ │ │ "Cell \u001b[0;32mIn[1], line 5\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mnumpy\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mnp\u001b[39;00m\n\u001b[1;32m 3\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpandas\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mpd\u001b[39;00m\n\u001b[0;32m----> 5\u001b[0m ds \u001b[38;5;241m=\u001b[39m \u001b[43mxr\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mtutorial\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mload_dataset\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mair_temperature\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m)\u001b[49m\n\u001b[1;32m 6\u001b[0m da \u001b[38;5;241m=\u001b[39m ds[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mair\u001b[39m\u001b[38;5;124m\"\u001b[39m]\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/xarray/tutorial.py:215\u001b[0m, in \u001b[0;36mload_dataset\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 178\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mload_dataset\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs) \u001b[38;5;241m-\u001b[39m\u001b[38;5;241m>\u001b[39m Dataset:\n\u001b[1;32m 179\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124;03m\"\"\"\u001b[39;00m\n\u001b[1;32m 180\u001b[0m \u001b[38;5;124;03m Open, load into memory, and close a dataset from the online repository\u001b[39;00m\n\u001b[1;32m 181\u001b[0m \u001b[38;5;124;03m (requires internet).\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 213\u001b[0m \u001b[38;5;124;03m load_dataset\u001b[39;00m\n\u001b[1;32m 214\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m--> 215\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m \u001b[43mopen_dataset\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m \u001b[38;5;28;01mas\u001b[39;00m ds:\n\u001b[1;32m 216\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m ds\u001b[38;5;241m.\u001b[39mload()\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/xarray/tutorial.py:167\u001b[0m, in \u001b[0;36mopen_dataset\u001b[0;34m(name, cache, cache_dir, engine, **kws)\u001b[0m\n\u001b[1;32m 164\u001b[0m downloader \u001b[38;5;241m=\u001b[39m pooch\u001b[38;5;241m.\u001b[39mHTTPDownloader(headers\u001b[38;5;241m=\u001b[39mheaders)\n\u001b[1;32m 166\u001b[0m \u001b[38;5;66;03m# retrieve the file\u001b[39;00m\n\u001b[0;32m--> 167\u001b[0m filepath \u001b[38;5;241m=\u001b[39m \u001b[43mpooch\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mretrieve\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 168\u001b[0m \u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mknown_hash\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpath\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcache_dir\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdownloader\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdownloader\u001b[49m\n\u001b[1;32m 169\u001b[0m \u001b[43m\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 170\u001b[0m ds \u001b[38;5;241m=\u001b[39m _open_dataset(filepath, engine\u001b[38;5;241m=\u001b[39mengine, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkws)\n\u001b[1;32m 171\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m cache:\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/pooch/core.py:239\u001b[0m, in \u001b[0;36mretrieve\u001b[0;34m(url, known_hash, fname, path, processor, downloader, progressbar)\u001b[0m\n\u001b[1;32m 236\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m downloader \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 237\u001b[0m downloader \u001b[38;5;241m=\u001b[39m choose_downloader(url, progressbar\u001b[38;5;241m=\u001b[39mprogressbar)\n\u001b[0;32m--> 239\u001b[0m \u001b[43mstream_download\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfull_path\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mknown_hash\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mdownloader\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpooch\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mNone\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 241\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m known_hash \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m:\n\u001b[1;32m 242\u001b[0m get_logger()\u001b[38;5;241m.\u001b[39minfo(\n\u001b[1;32m 243\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSHA256 hash of downloaded file: \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;130;01m\\n\u001b[39;00m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 244\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mUse this value as the \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mknown_hash\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m argument of \u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mpooch.retrieve\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 247\u001b[0m file_hash(\u001b[38;5;28mstr\u001b[39m(full_path)),\n\u001b[1;32m 248\u001b[0m )\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/pooch/core.py:807\u001b[0m, in \u001b[0;36mstream_download\u001b[0;34m(url, fname, known_hash, downloader, pooch, retry_if_failed)\u001b[0m\n\u001b[1;32m 803\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[1;32m 804\u001b[0m \u001b[38;5;66;03m# Stream the file to a temporary so that we can safely check its\u001b[39;00m\n\u001b[1;32m 805\u001b[0m \u001b[38;5;66;03m# hash before overwriting the original.\u001b[39;00m\n\u001b[1;32m 806\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m temporary_file(path\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mstr\u001b[39m(fname\u001b[38;5;241m.\u001b[39mparent)) \u001b[38;5;28;01mas\u001b[39;00m tmp:\n\u001b[0;32m--> 807\u001b[0m \u001b[43mdownloader\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtmp\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpooch\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 808\u001b[0m hash_matches(tmp, known_hash, strict\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m, source\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mstr\u001b[39m(fname\u001b[38;5;241m.\u001b[39mname))\n\u001b[1;32m 809\u001b[0m shutil\u001b[38;5;241m.\u001b[39mmove(tmp, \u001b[38;5;28mstr\u001b[39m(fname))\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/pooch/downloaders.py:220\u001b[0m, in \u001b[0;36mHTTPDownloader.__call__\u001b[0;34m(self, url, output_file, pooch, check_only)\u001b[0m\n\u001b[1;32m 218\u001b[0m \u001b[38;5;66;03m# pylint: enable=consider-using-with\u001b[39;00m\n\u001b[1;32m 219\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 220\u001b[0m response \u001b[38;5;241m=\u001b[39m \u001b[43mrequests\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget\u001b[49m\u001b[43m(\u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mtimeout\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mtimeout\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 221\u001b[0m response\u001b[38;5;241m.\u001b[39mraise_for_status()\n\u001b[1;32m 222\u001b[0m content \u001b[38;5;241m=\u001b[39m response\u001b[38;5;241m.\u001b[39miter_content(chunk_size\u001b[38;5;241m=\u001b[39m\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mchunk_size)\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/api.py:73\u001b[0m, in \u001b[0;36mget\u001b[0;34m(url, params, **kwargs)\u001b[0m\n\u001b[1;32m 62\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mget\u001b[39m(url, params\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 63\u001b[0m \u001b[38;5;250m \u001b[39m\u001b[38;5;124mr\u001b[39m\u001b[38;5;124;03m\"\"\"Sends a GET request.\u001b[39;00m\n\u001b[1;32m 64\u001b[0m \n\u001b[1;32m 65\u001b[0m \u001b[38;5;124;03m :param url: URL for the new :class:`Request` object.\u001b[39;00m\n\u001b[0;32m (...)\u001b[0m\n\u001b[1;32m 70\u001b[0m \u001b[38;5;124;03m :rtype: requests.Response\u001b[39;00m\n\u001b[1;32m 71\u001b[0m \u001b[38;5;124;03m \"\"\"\u001b[39;00m\n\u001b[0;32m---> 73\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[38;5;124;43mget\u001b[39;49m\u001b[38;5;124;43m\"\u001b[39;49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mparams\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparams\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/api.py:59\u001b[0m, in \u001b[0;36mrequest\u001b[0;34m(method, url, **kwargs)\u001b[0m\n\u001b[1;32m 55\u001b[0m \u001b[38;5;66;03m# By using the 'with' statement we are sure the session is closed, thus we\u001b[39;00m\n\u001b[1;32m 56\u001b[0m \u001b[38;5;66;03m# avoid leaving sockets open which can trigger a ResourceWarning in some\u001b[39;00m\n\u001b[1;32m 57\u001b[0m \u001b[38;5;66;03m# cases, and look like a memory leak in others.\u001b[39;00m\n\u001b[1;32m 58\u001b[0m \u001b[38;5;28;01mwith\u001b[39;00m sessions\u001b[38;5;241m.\u001b[39mSession() \u001b[38;5;28;01mas\u001b[39;00m session:\n\u001b[0;32m---> 59\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43msession\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mrequest\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmethod\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mmethod\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43murl\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43murl\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/sessions.py:589\u001b[0m, in \u001b[0;36mSession.request\u001b[0;34m(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)\u001b[0m\n\u001b[1;32m 584\u001b[0m send_kwargs \u001b[38;5;241m=\u001b[39m {\n\u001b[1;32m 585\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtimeout\u001b[39m\u001b[38;5;124m\"\u001b[39m: timeout,\n\u001b[1;32m 586\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mallow_redirects\u001b[39m\u001b[38;5;124m\"\u001b[39m: allow_redirects,\n\u001b[1;32m 587\u001b[0m }\n\u001b[1;32m 588\u001b[0m send_kwargs\u001b[38;5;241m.\u001b[39mupdate(settings)\n\u001b[0;32m--> 589\u001b[0m resp \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mprep\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43msend_kwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 591\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m resp\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/sessions.py:703\u001b[0m, in \u001b[0;36mSession.send\u001b[0;34m(self, request, **kwargs)\u001b[0m\n\u001b[1;32m 700\u001b[0m start \u001b[38;5;241m=\u001b[39m preferred_clock()\n\u001b[1;32m 702\u001b[0m \u001b[38;5;66;03m# Send the request\u001b[39;00m\n\u001b[0;32m--> 703\u001b[0m r \u001b[38;5;241m=\u001b[39m \u001b[43madapter\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msend\u001b[49m\u001b[43m(\u001b[49m\u001b[43mrequest\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 705\u001b[0m \u001b[38;5;66;03m# Total elapsed time of the request (approximately)\u001b[39;00m\n\u001b[1;32m 706\u001b[0m elapsed \u001b[38;5;241m=\u001b[39m preferred_clock() \u001b[38;5;241m-\u001b[39m start\n",
│ │ │ │ │ "File \u001b[0;32m/usr/lib/python3/dist-packages/requests/adapters.py:700\u001b[0m, in \u001b[0;36mHTTPAdapter.send\u001b[0;34m(self, request, stream, timeout, verify, cert, proxies)\u001b[0m\n\u001b[1;32m 696\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(e\u001b[38;5;241m.\u001b[39mreason, _SSLError):\n\u001b[1;32m 697\u001b[0m \u001b[38;5;66;03m# This branch is for urllib3 v1.22 and later.\u001b[39;00m\n\u001b[1;32m 698\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m SSLError(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[0;32m--> 700\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(e, request\u001b[38;5;241m=\u001b[39mrequest)\n\u001b[1;32m 702\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m ClosedPoolError \u001b[38;5;28;01mas\u001b[39;00m e:\n\u001b[1;32m 703\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mConnectionError\u001b[39;00m(e, request\u001b[38;5;241m=\u001b[39mrequest)\n",
│ │ │ │ │ - "\u001b[0;31mConnectionError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))"
│ │ │ │ │ + "\u001b[0;31mConnectionError\u001b[0m: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError(\": Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)\"))"
│ │ │ │ │ ]
│ │ │ │ │ }
│ │ │ │ │ ],
│ │ │ │ │ "source": [
│ │ │ │ │ "import xarray as xr\n",
│ │ │ │ │ "import numpy as np\n",
│ │ │ │ │ "import pandas as pd\n",
│ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/monthly-means.html
│ │ │ @@ -156,15 +156,15 @@
│ │ │ 705 server_hostname: str = self.host
│ │ │
│ │ │ File /usr/lib/python3/dist-packages/urllib3/connection.py:205, in HTTPConnection._new_conn(self)
│ │ │ 204 except socket.gaierror as e:
│ │ │ --> 205 raise NameResolutionError(self.host, self, e) from e
│ │ │ 206 except SocketTimeout as e:
│ │ │
│ │ │ -NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7f3968019be0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)
│ │ │ +NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x7f4129011be0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)
│ │ │
│ │ │ The above exception was the direct cause of the following exception:
│ │ │
│ │ │ MaxRetryError Traceback (most recent call last)
│ │ │ File /usr/lib/python3/dist-packages/requests/adapters.py:667, in HTTPAdapter.send(self, request, stream, timeout, verify, cert, proxies)
│ │ │ 666 try:
│ │ │ --> 667 resp = conn.urlopen(
│ │ │ @@ -190,15 +190,15 @@
│ │ │ 844 retries.sleep()
│ │ │
│ │ │ File /usr/lib/python3/dist-packages/urllib3/util/retry.py:519, in Retry.increment(self, method, url, response, error, _pool, _stacktrace)
│ │ │ 518 reason = error or ResponseError(cause)
│ │ │ --> 519 raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type]
│ │ │ 521 log.debug("Incremented Retry for (url='%s'): %r", url, new_retry)
│ │ │
│ │ │ -MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/rasm.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f3968019be0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +MaxRetryError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/rasm.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f4129011be0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │ During handling of the above exception, another exception occurred:
│ │ │
│ │ │ ConnectionError Traceback (most recent call last)
│ │ │ Cell In[2], line 1
│ │ │ ----> 1 ds = xr.tutorial.open_dataset("rasm").load()
│ │ │ 2 ds
│ │ │ @@ -277,15 +277,15 @@
│ │ │ 696 if isinstance(e.reason, _SSLError):
│ │ │ 697 # This branch is for urllib3 v1.22 and later.
│ │ │ 698 raise SSLError(e, request=request)
│ │ │ --> 700 raise ConnectionError(e, request=request)
│ │ │ 702 except ClosedPoolError as e:
│ │ │ 703 raise ConnectionError(e, request=request)
│ │ │
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/rasm.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f3968019be0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/rasm.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f4129011be0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
We first have to come up with the weights, - calculate the month length for each monthly data record - calculate weights using groupby('time.season')
Finally, we just need to multiply our weights by the Dataset
and sum along the time dimension. Creating a DataArray
for the month length is as easy as using the days_in_month
accessor on the time coordinate. The calendar type, in this case 'noleap'
, is automatically considered in this operation.
In this example, the logical coordinates are x
and y
, while the physical coordinates are xc
and yc
, which represent the longitudes and latitudes of the data.
[3]:
│ │ │
Control the map projection parameters on multiple axes
│ │ │This example illustrates how to plot multiple maps and control their extent and aspect ratio.
│ │ │For more details see this discussion on github.
│ │ │ ├── html2text {} │ │ │ │ @@ -94,15 +94,15 @@ │ │ │ │ File /usr/lib/python3/dist-packages/urllib3/connection.py:205, in │ │ │ │ HTTPConnection._new_conn(self) │ │ │ │ 204 except socket.gaierror as e: │ │ │ │ --> 205 raise NameResolutionError(self.host, self, e) from e │ │ │ │ 206 except SocketTimeout as e: │ │ │ │ │ │ │ │ NameResolutionError:<xarray.Dataset> Size: 41kB │ │ │ Dimensions: (time: 731, location: 3) │ │ │ Coordinates: │ │ │ * time (time) datetime64[ns] 6kB 2000-01-01 2000-01-02 ... 2001-12-31 │ │ │ * location (location) <U2 24B 'IA' 'IN' 'IL' │ │ │ Data variables: │ │ │ tmin (time, location) float64 18kB -8.037 -1.788 ... -1.346 -4.544 │ │ │ - tmax (time, location) float64 18kB 12.98 3.31 6.779 ... 3.343 3.805
PandasIndex(Index(['IA', 'IN', 'IL'], dtype='object', name='location'))
[2]:
│ │ │ @@ -697,15 +697,15 @@
│ │ │
[5]:
│ │ │
│ │ │ -<seaborn.axisgrid.PairGrid at 0x7ff2117aecf0>
│ │ │ +<seaborn.axisgrid.PairGrid at 0x7f47df2eacf0>
│ │ │
array(['IA', 'IN', 'IL'], dtype='<U2')
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
PandasIndex(Index(['IA', 'IN', 'IL'], dtype='object', name='location'))
PandasIndex(Index([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], dtype='int64', name='month'))
[7]:
│ │ │
freeze.to_pandas().plot()
│ │ │
PandasIndex(Index(['IA', 'IN', 'IL'], dtype='object', name='location'))
[12]:
│ │ │
df = both.sel(time="2000").mean("location").reset_coords(drop=True).to_dataframe()
│ │ │ df.head()
│ │ │ ├── html2text {}
│ │ │ │ @@ -142,15 +142,15 @@
│ │ │ │ [4]:
│ │ │ │
│ │ │ │ [../_images/examples_weather-data_7_1.png]
│ │ │ │ ******** VViissuuaalliizzee uussiinngg sseeaabboorrnn_?¶ ********
│ │ │ │ [5]:
│ │ │ │ sns.pairplot(df.reset_index(), vars=ds.data_vars)
│ │ │ │ [5]:
│ │ │ │ -
│ │ │ │ +
│ │ │ │ [../_images/examples_weather-data_9_1.png]
│ │ │ │ ********** PPrroobbaabbiilliittyy ooff ffrreeeezzee bbyy ccaalleennddaarr mmoonntthh_?¶ **********
│ │ │ │ [6]:
│ │ │ │ freeze = (ds["tmin"] <= 0).groupby("time.month").mean("time")
│ │ │ │ freeze
│ │ │ │ [6]:
│ │ │ │ Size: 288B
│ │ ├── ./usr/share/doc/python-xarray-doc/html/examples/weather-data.ipynb.gz
│ │ │ ├── weather-data.ipynb
│ │ │ │ ├── Pretty-printed
│ │ │ │ │┄ Similarity: 0.9992323269378145%
│ │ │ │ │┄ Differences: {"'cells'": "{1: {'metadata': {'execution': {'iopub.execute_input': '2025-07-22T10:02:02.196606Z', "
│ │ │ │ │┄ "'iopub.status.busy': '2025-07-22T10:02:02.196357Z', 'iopub.status.idle': "
│ │ │ │ │┄ "'2025-07-22T10:02:06.415175Z', 'shell.execute_reply': "
│ │ │ │ │┄ "'2025-07-22T10:02:06.414539Z'}}, 'outputs': {0: {'data': {'text/html': {insert: "
│ │ │ │ │┄ '[(377, " tmax (time, location) float64 18kB 12.98 3.31 6.779 ... 3.343 '
│ │ │ │ │┄ "3.805
array(['IA', 'IN', 'IL'], dtype='<U2')
array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12])
PandasIndex(Index(['IA', 'IN', 'IL'], dtype='object', name='location'))
PandasIndex(Index([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], dtype='int64', name='month'))
Visualizing your datasets is quick and convenient:
│ │ │In [37]: data.plot()
│ │ │ -Out[37]: <matplotlib.collections.QuadMesh at 0x7f8342c42900>
│ │ │ +Out[37]: <matplotlib.collections.QuadMesh at 0x7f9b8dbfa900>
│ │ │
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.
│ │ │apply_ufunc
", "Compare weighted and unweighted mean temperature", "Blank template", "Calculating Seasonal Averages from Time Series of Monthly Means", "Working with Multidimensional Coordinates", "Visualization Gallery", "Toy weather data", "Gallery", "Frequently Asked Questions", "Getting Started", "Installation", "Quick overview", "Overview: Why xarray?", "Getting Help", "How do I \u2026", "Xarray documentation", "Alternative chunked array types", "Integrating with duck arrays", "Extending xarray using accessors", "How to add a new backend", "How to create a custom index", "Xarray Internals", "Internal Design", "Interoperability of Xarray", "Time Coding", "Zarr Encoding Specification", "Development roadmap", "Tutorials and Videos", "Combining data", "Computation", "Parallel Computing with Dask", "Data Structures", "Working with numpy-like arrays", "GroupBy: Group and Bin Data", "Hierarchical data", "User Guide", "Indexing and selecting data", "Interpolating data", "Reading and writing files", "Configuration", "Working with pandas", "Plotting", "Reshaping and reorganizing data", "Terminology", "Testing your code", "Time series data", "Weather and climate data", "What\u2019s New"],
│ │ │ │ "titleterms": {
│ │ │ │ "": [13, 16, 55],
│ │ │ │ "0": 55,
│ │ │ │ "01": 55,
│ │ │ │ "02": 55,
│ │ ├── ./usr/share/doc/python-xarray-doc/html/user-guide/computation.html
│ │ │ @@ -934,16 +934,16 @@
│ │ │ <xarray.Dataset> Size: 2kB
│ │ │ Dimensions: (param: 10, cov_i: 10, cov_j: 10)
│ │ │ Coordinates:
│ │ │ * param (param) <U7 280B 'a0' 'xc0' ... 'xalpha1' 'yalpha1'
│ │ │ * cov_i (cov_i) <U7 280B 'a0' 'xc0' ... 'xalpha1' 'yalpha1'
│ │ │ * cov_j (cov_j) <U7 280B 'a0' 'xc0' ... 'xalpha1' 'yalpha1'
│ │ │ Data variables:
│ │ │ - curvefit_coefficients (param) float64 80B 3.0 1.004 1.003 ... 1.007 1.008
│ │ │ - curvefit_covariance (cov_i, cov_j) float64 800B 3.362e-05 ... 2.125e-05
│ │ │ + curvefit_coefficients (param) float64 80B -0.659 4.858 ... 2.066 1.329
│ │ │ + curvefit_covariance (cov_i, cov_j) float64 800B 5.662e+11 ... 6.911e-05
│ │ │
│ │ │
│ │ │ Note
│ │ │This method replicates the behavior of scipy.optimize.curve_fit()
.
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 [64]: plt.plot((2 * ds.temperature.sel(loc=0)).mean("instrument"))
│ │ │ -Out[64]: [<matplotlib.lines.Line2D at 0x7f8310bc7110>]
│ │ │ +Out[64]: [<matplotlib.lines.Line2D at 0x7f9b84a33110>]
│ │ │
│ │ │ In [65]: (ds.temperature.sel(loc=0).pipe(lambda x: 2 * x).mean("instrument").pipe(plt.plot))
│ │ │ -Out[65]: [<matplotlib.lines.Line2D at 0x7f8310bc6e90>]
│ │ │ +Out[65]: [<matplotlib.lines.Line2D at 0x7f9b84a32e90>]
│ │ │
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
│ │ │ ├── html2text {}
│ │ │ │ @@ -585,19 +585,19 @@
│ │ │ │ There is also the pipe() method that allows you to use 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 [64]: plt.plot((2 * ds.temperature.sel(loc=0)).mean("instrument"))
│ │ │ │ -Out[64]: [ If you were a previous user of the prototype xarray-contrib/datatree package, this is different from what you’re used to!
│ │ │ In that package the data model was that the data stored in each node actually was completely unrelated. The data model is now slightly stricter.
│ │ │ This allows us to provide features like Coordinate Inheritance. To demonstrate, let’s first generate some example datasets which are not aligned with one another: To select and assign values to a portion of a You can also assign values to all variables of a Additional keyword arguments can be passed to scipy’s functions. Let’s see how (The suffix To read back a zarr dataset that has been created this way, we use the
│ │ │ It is possible to read and write xarray datasets directly from / to cloud
│ │ │ @@ -724,36 +724,36 @@
│ │ │
│ │ │ In [18]: ds = xr.Dataset({"foo": ("x", dummies)}, coords={"x": np.arange(30)})
│ │ │
│ │ │ In [19]: path = "path/to/directory.zarr"
│ │ │
│ │ │ # Now we write the metadata without computing any array values
│ │ │ In [20]: ds.to_zarr(path, compute=False)
│ │ │ -Out[20]: Delayed('_finalize_store-4a267f96-fb93-42cb-acab-499e6da629cf')
│ │ │ +Out[20]: Delayed('_finalize_store-5c412a59-5e11-40f1-ad08-9a102c466cd9')
│ │ │ Now, a Zarr store with the correct variable shapes and attributes exists that
│ │ │ can be filled out by subsequent calls to Concurrent writes with As a safety check to make it harder to inadvertently override existing values,
│ │ │ if you set Chunk sizes may be specified in one of three ways when writing to a zarr store: For example, let’s say we’re working with a dataset with dimensions
│ │ │ These multi-dimensional coordinates are only two-dimensional and take up very little
│ │ │ space on disk or in memory, yet when writing to disk the default zarr behavior is to
│ │ │ split them into chunks: Ncdata provides more sophisticated means of transferring data, including entire
│ │ │ datasets. It uses the file saving and loading functions in both projects to provide a
│ │ │ more “correct” translation between them, but still with very low overhead and not
│ │ │ using actual disk files. For example: For these examples we’ll use the North American air temperature dataset. Same plot can be displayed using the dataset: Now suppose we want to scatter the The You can force a legend instead of a colorbar by setting The The Faceting is also possible And adding the z-axis For more advanced scatter plots, we recommend converting the relevant data variables
│ │ │ to a pandas DataFrame and using the extensive plotting capabilities of # (drop the attributes just to make the printed representation shorter)
│ │ │ In [89]: ds = xr.tutorial.open_dataset("air_temperature").drop_attrs()
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830f65ad50>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9b77616d50>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ In [90]: ds_daily = ds.resample(time="D").mean("time")
│ │ │ KeyError: "No variable named 'time'. Variables on the dataset include ['foo', 'x', 'letters']"
│ │ │
│ │ │
│ │ │ In [91]: ds_weekly = ds.resample(time="W").mean("time")
│ │ │ ├── html2text {}
│ │ │ │ @@ -871,15 +871,15 @@
│ │ │ │ To demonstrate, let’s first generate some example datasets which are not
│ │ │ │ aligned with one another:
│ │ │ │ # (drop the attributes just to make the printed representation shorter)
│ │ │ │ In [89]: ds = xr.tutorial.open_dataset("air_temperature").drop_attrs()
│ │ │ │ ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries
│ │ │ │ exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by
│ │ │ │ NameResolutionError("
In [52]: ds = xr.tutorial.open_dataset("air_temperature")
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830f65aad0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9b77616ad0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ # Define target latitude and longitude (where weather stations might be)
│ │ │ In [53]: target_lon = xr.DataArray([200, 201, 202, 205], dims="points")
│ │ │
│ │ │ In [54]: target_lat = xr.DataArray([31, 41, 42, 42], dims="points")
│ │ │
│ │ │ @@ -697,15 +697,15 @@
│ │ │
Assigning values with indexing¶
│ │ │ DataArray()
you
│ │ │ can use indexing with .loc
:In [57]: ds = xr.tutorial.open_dataset("air_temperature")
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830f658f50>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9b77614f50>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ # add an empty 2D dataarray
│ │ │ In [58]: ds["empty"] = xr.full_like(ds.air.mean("time"), fill_value=0)
│ │ │ AttributeError: 'Dataset' object has no attribute 'air'
│ │ │
│ │ │
│ │ │ @@ -869,15 +869,15 @@
│ │ │
Dataset
at once:In [83]: ds_org = xr.tutorial.open_dataset("eraint_uvz").isel(
│ │ │ ....: latitude=slice(56, 59), longitude=slice(255, 258), level=0
│ │ │ ....: )
│ │ │ ....:
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/eraint_uvz.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830f6587d0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/eraint_uvz.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9b77614b90>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ # set all values to 0
│ │ │ In [84]: ds = xr.zeros_like(ds_org)
│ │ │ NameError: name 'ds_org' is not defined
│ │ │ ├── html2text {}
│ │ │ │ @@ -476,15 +476,15 @@
│ │ │ │ with a new shared output dimension name. In the example below, the selections
│ │ │ │ of the closest latitude and longitude are renamed to an output dimension named
│ │ │ │ “points”:
│ │ │ │ In [52]: ds = xr.tutorial.open_dataset("air_temperature")
│ │ │ │ ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries
│ │ │ │ exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by
│ │ │ │ NameResolutionError("
│ │ │
│ │ │
# 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})
│ │ │ @@ -439,15 +439,15 @@
│ │ │ see Missing values.
│ │ │
│ │ │
Example¶
│ │ │ interp()
works on real data.# Raw data
│ │ │ In [44]: ds = xr.tutorial.open_dataset("air_temperature").isel(time=0)
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f8321d75bd0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9b8dc11bd0>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ In [45]: fig, axes = plt.subplots(ncols=2, figsize=(10, 4))
│ │ │
│ │ │ In [46]: ds.air.plot(ax=axes[0])
│ │ │ AttributeError: 'Dataset' object has no attribute 'air'
│ │ │ ├── html2text {}
│ │ │ │ @@ -153,26 +153,26 @@
│ │ │ │ ....: 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]: [
.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()
.open_zarr()
method:In [14]: ds_zarr = xr.open_zarr("path/to/directory.zarr")
│ │ │
│ │ │ In [15]: ds_zarr
│ │ │ Out[15]:
│ │ │ <xarray.Dataset> Size: 264B
│ │ │ -Dimensions: (x: 4, y: 5)
│ │ │ +Dimensions: (y: 5, x: 4)
│ │ │ Coordinates:
│ │ │ - * x (x) int64 32B 10 20 30 40
│ │ │ - z (x) object 32B dask.array<chunksize=(4,), meta=np.ndarray>
│ │ │ * y (y) datetime64[ns] 40B 2000-01-01 2000-01-02 ... 2000-01-05
│ │ │ + z (x) object 32B dask.array<chunksize=(4,), meta=np.ndarray>
│ │ │ + * x (x) int64 32B 10 20 30 40
│ │ │ Data variables:
│ │ │ foo (x, y) float64 160B dask.array<chunksize=(4, 5), meta=np.ndarray>
│ │ │
Cloud Storage Buckets¶
│ │ │ to_zarr
.
│ │ │ Setting region="auto"
will open the existing store and determine the
│ │ │ correct alignment of the new data with the existing dimensions, or as an
│ │ │ explicit mapping from dimension names to Python slice
objects indicating
│ │ │ where the data should be written (in index space, not label 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 [21]: ds = xr.Dataset({"foo": ("x", np.arange(30))}, coords={"x": np.arange(30)})
│ │ │
│ │ │ # Any of the following region specifications are valid
│ │ │ In [22]: ds.isel(x=slice(0, 10)).to_zarr(path, region="auto")
│ │ │ -Out[22]: <xarray.backends.zarr.ZarrStore at 0x7f830f9c6ef0>
│ │ │ +Out[22]: <xarray.backends.zarr.ZarrStore at 0x7f9b7796ae60>
│ │ │
│ │ │ In [23]: ds.isel(x=slice(10, 20)).to_zarr(path, region={"x": "auto"})
│ │ │ -Out[23]: <xarray.backends.zarr.ZarrStore at 0x7f830f9c6b00>
│ │ │ +Out[23]: <xarray.backends.zarr.ZarrStore at 0x7f9b7796ab00>
│ │ │
│ │ │ In [24]: ds.isel(x=slice(20, 30)).to_zarr(path, region={"x": slice(20, 30)})
│ │ │ -Out[24]: <xarray.backends.zarr.ZarrStore at 0x7f830fd8ce50>
│ │ │ +Out[24]: <xarray.backends.zarr.ZarrStore at 0x7f9b77b3ce50>
│ │ │
region
are safe as long as they modify distinct
│ │ │ chunks in the underlying Zarr arrays (or use an appropriate lock
).region
then all variables included in a Dataset must have
│ │ │ dimensions included in region
. Other variables (typically coordinates)
│ │ │ @@ -816,28 +816,28 @@
│ │ │ ....: "y": [1, 2, 3, 4, 5],
│ │ │ ....: "t": pd.date_range("2001-01-01", periods=2),
│ │ │ ....: },
│ │ │ ....: )
│ │ │ ....:
│ │ │
│ │ │ In [30]: ds1.to_zarr("path/to/directory.zarr")
│ │ │ -Out[30]: <xarray.backends.zarr.ZarrStore at 0x7f830fa80160>
│ │ │ +Out[30]: <xarray.backends.zarr.ZarrStore at 0x7f9bc7f24160>
│ │ │
│ │ │ In [31]: ds2 = xr.Dataset(
│ │ │ ....: {"foo": (("x", "y", "t"), np.random.rand(4, 5, 2))},
│ │ │ ....: coords={
│ │ │ ....: "x": [10, 20, 30, 40],
│ │ │ ....: "y": [1, 2, 3, 4, 5],
│ │ │ ....: "t": pd.date_range("2001-01-03", periods=2),
│ │ │ ....: },
│ │ │ ....: )
│ │ │ ....:
│ │ │
│ │ │ In [32]: ds2.to_zarr("path/to/directory.zarr", append_dim="t")
│ │ │ -Out[32]: <xarray.backends.zarr.ZarrStore at 0x7f830fa80040>
│ │ │ +Out[32]: <xarray.backends.zarr.ZarrStore at 0x7f9bc7f24040>
│ │ │ Specifying chunks in a zarr store¶
│ │ │
│ │ │ @@ -861,15 +861,15 @@
│ │ │ positional ordering of the dimensions in each array. Watch out for arrays with
│ │ │ differently-ordered dimensions within a single Dataset.
│ │ │
('time', 'x', 'y')
, a variable Tair
which is chunked in x
and y
,
│ │ │ and two multi-dimensional coordinates xc
and yc
:In [33]: ds = xr.tutorial.open_dataset("rasm")
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/rasm.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830fa84050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/rasm.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9bc7f28050>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ In [34]: ds["Tair"] = ds["Tair"].chunk({"x": 100, "y": 100})
│ │ │ KeyError: "No variable named 'Tair'. Variables on the dataset include ['foo', 'x']"
│ │ │
│ │ │
│ │ │ In [35]: ds
│ │ │ @@ -882,15 +882,15 @@
│ │ │ foo (x) int64 240B 0 1 2 3 4 5 6 7 8 9 ... 21 22 23 24 25 26 27 28 29
│ │ │
In [36]: ds.to_zarr("path/to/directory.zarr", mode="w")
│ │ │ -Out[36]: <xarray.backends.zarr.ZarrStore at 0x7f830fa80550>
│ │ │ +Out[36]: <xarray.backends.zarr.ZarrStore at 0x7f9bc7f24550>
│ │ │
│ │ │ In [37]: ! ls -R path/to/directory.zarr
│ │ │ path/to/directory.zarr:
│ │ │ foo x zarr.json
│ │ │
│ │ │ path/to/directory.zarr/foo:
│ │ │ c zarr.json
│ │ │ @@ -1081,15 +1081,15 @@
│ │ │
Ncdata¶
│ │ │ In [48]: ds = xr.tutorial.open_dataset("air_temperature_gradient")
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature_gradient.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830fa85590>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature_gradient.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9bc7f29590>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ In [49]: cubes = ncdata.iris_xarray.cubes_from_xarray(ds)
│ │ │ NameError: name 'ncdata' is not defined
│ │ │
│ │ │
│ │ │ In [50]: print(cubes)
│ │ │ ├── html2text {}
│ │ │ │ @@ -481,15 +481,15 @@
│ │ │ │ ....: "y": pd.date_range("2000-01-01", periods=5),
│ │ │ │ ....: "z": ("x", list("abcd")),
│ │ │ │ ....: },
│ │ │ │ ....: )
│ │ │ │ ....:
│ │ │ │
│ │ │ │ In [13]: ds.to_zarr("path/to/directory.zarr")
│ │ │ │ -Out[13]:
In [5]: airtemps = xr.tutorial.open_dataset("air_temperature")
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830fa84550>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9bc7f28410>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ In [6]: airtemps
│ │ │ NameError: name 'airtemps' is not defined
│ │ │
│ │ │
│ │ │ # Convert to celsius
│ │ │ @@ -445,15 +445,15 @@
│ │ │
│ │ │ # Apply a nonlinear transformation to one of the coords
│ │ │ In [50]: b.coords["lat"] = np.log(b.coords["lat"])
│ │ │ KeyError: 'lat'
│ │ │
│ │ │
│ │ │ In [51]: b.plot()
│ │ │ -Out[51]: [<matplotlib.lines.Line2D at 0x7f830f56b610>]
│ │ │ +Out[51]: [<matplotlib.lines.Line2D at 0x7f9bc780b610>]
│ │ │
│ │ │
│ │ │
│ │ │
Other types of plot¶
│ │ │ @@ -857,117 +857,117 @@
│ │ │ * y (y) float64 88B 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0
│ │ │ * z (z) int64 32B 0 1 2 3
│ │ │ * w (w) <U5 80B 'one' 'two' 'three' 'five'
│ │ │ Attributes:
│ │ │ units: Aunits
│ │ │
│ │ │ In [99]: ds.A.plot.scatter(x="y")
│ │ │ -Out[99]: <matplotlib.collections.PathCollection at 0x7f834ee7b770>
│ │ │ +Out[99]: <matplotlib.collections.PathCollection at 0x7f9bc7c8f770>
│ │ │
│ │ │
In [100]: ds.plot.scatter(x="y", y="A")
│ │ │ -Out[100]: <matplotlib.collections.PathCollection at 0x7f830f473c50>
│ │ │ +Out[100]: <matplotlib.collections.PathCollection at 0x7f9bc771fc50>
│ │ │
│ │ │
A
DataArray against the B
DataArrayIn [101]: ds.plot.scatter(x="A", y="B")
│ │ │ -Out[101]: <matplotlib.collections.PathCollection at 0x7f830f560410>
│ │ │ +Out[101]: <matplotlib.collections.PathCollection at 0x7f9bc77fc410>
│ │ │
│ │ │
hue
kwarg lets you vary the color by variable valueIn [102]: ds.plot.scatter(x="A", y="B", hue="w")
│ │ │ -Out[102]: <matplotlib.collections.PathCollection at 0x7f830f646fd0>
│ │ │ +Out[102]: <matplotlib.collections.PathCollection at 0x7f9bc76eefd0>
│ │ │
│ │ │
add_legend=True, add_colorbar=False
.In [103]: ds.plot.scatter(x="A", y="B", hue="w", add_legend=True, add_colorbar=False)
│ │ │ -Out[103]: <matplotlib.collections.PathCollection at 0x7f8321db7890>
│ │ │ +Out[103]: <matplotlib.collections.PathCollection at 0x7f9b8dc53890>
│ │ │
│ │ │
In [104]: ds.plot.scatter(x="A", y="B", hue="w", add_legend=False, add_colorbar=True)
│ │ │ -Out[104]: <matplotlib.collections.PathCollection at 0x7f8321dbec10>
│ │ │ +Out[104]: <matplotlib.collections.PathCollection at 0x7f9b8dc5ac10>
│ │ │
│ │ │
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 [105]: ds.plot.scatter(x="A", y="B", hue="y", markersize="z")
│ │ │ -Out[105]: <matplotlib.collections.PathCollection at 0x7f83437f20d0>
│ │ │ +Out[105]: <matplotlib.collections.PathCollection at 0x7f9baf6f1810>
│ │ │
│ │ │
z
kwarg lets you plot the data along the z-axis as well.In [106]: ds.plot.scatter(x="A", y="B", z="z", hue="y", markersize="x")
│ │ │ -Out[106]: <mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7f830f352c10>
│ │ │ +Out[106]: <mpl_toolkits.mplot3d.art3d.Path3DCollection at 0x7f9bc75f6c10>
│ │ │
│ │ │
In [107]: ds.plot.scatter(x="A", y="B", hue="y", markersize="x", row="x", col="w")
│ │ │ -Out[107]: <xarray.plot.facetgrid.FacetGrid at 0x7f830fa10c20>
│ │ │ +Out[107]: <xarray.plot.facetgrid.FacetGrid at 0x7f9b779acc20>
│ │ │
│ │ │
In [108]: ds.plot.scatter(x="A", y="B", z="z", hue="y", markersize="x", row="x", col="w")
│ │ │ -Out[108]: <xarray.plot.facetgrid.FacetGrid at 0x7f830ea07390>
│ │ │ +Out[108]: <xarray.plot.facetgrid.FacetGrid at 0x7f9bc747f390>
│ │ │
│ │ │
seaborn
.
Visualizing vector fields is supported with quiver plots:
│ │ │In [109]: ds.isel(w=1, z=1).plot.quiver(x="x", y="y", u="A", v="B")
│ │ │ -Out[109]: <matplotlib.quiver.Quiver at 0x7f830f68eba0>
│ │ │ +Out[109]: <matplotlib.quiver.Quiver at 0x7f9b7764eba0>
│ │ │
where u
and v
denote the x and y direction components of the arrow vectors. Again, faceting is also possible:
In [110]: ds.plot.quiver(x="x", y="y", u="A", v="B", col="w", row="z", scale=4)
│ │ │ -Out[110]: <xarray.plot.facetgrid.FacetGrid at 0x7f830e413d90>
│ │ │ +Out[110]: <xarray.plot.facetgrid.FacetGrid at 0x7f9bc6e8fd90>
│ │ │
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 [111]: ds.isel(w=1, z=1).plot.streamplot(x="x", y="y", u="A", v="B")
│ │ │ -Out[111]: <matplotlib.collections.LineCollection at 0x7f830dd96490>
│ │ │ +Out[111]: <matplotlib.collections.LineCollection at 0x7f9bc6816490>
│ │ │
where u
and v
denote the x and y direction components of the vectors tangent to the streamlines.
│ │ │ Again, faceting is also possible:
In [112]: ds.plot.streamplot(x="x", y="y", u="A", v="B", col="w", row="z")
│ │ │ -Out[112]: <xarray.plot.facetgrid.FacetGrid at 0x7f8310039220>
│ │ │ +Out[112]: <xarray.plot.facetgrid.FacetGrid at 0x7f9b77585220>
│ │ │
To follow this section you’ll need to have Cartopy installed and working.
│ │ │This script will plot the air temperature on a map.
│ │ │In [113]: import cartopy.crs as ccrs
│ │ │
│ │ │ In [114]: air = xr.tutorial.open_dataset("air_temperature").air
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830e37ca50>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9bc6df8a50>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ In [115]: p = air.isel(time=0).plot(
│ │ │ .....: subplot_kws=dict(projection=ccrs.Orthographic(-80, 35), facecolor="gray"),
│ │ │ .....: transform=ccrs.PlateCarree(),
│ │ │ .....: )
│ │ │ .....:
│ │ │ @@ -1024,24 +1024,24 @@
│ │ │ In [121]: import xarray.plot as xplt
│ │ │
│ │ │ In [122]: da = xr.DataArray(range(5))
│ │ │
│ │ │ In [123]: fig, axs = plt.subplots(ncols=2, nrows=2)
│ │ │
│ │ │ In [124]: da.plot(ax=axs[0, 0])
│ │ │ -Out[124]: [<matplotlib.lines.Line2D at 0x7f830da11950>]
│ │ │ +Out[124]: [<matplotlib.lines.Line2D at 0x7f9bc648d950>]
│ │ │
│ │ │ In [125]: da.plot.line(ax=axs[0, 1])
│ │ │ -Out[125]: [<matplotlib.lines.Line2D at 0x7f830da11a90>]
│ │ │ +Out[125]: [<matplotlib.lines.Line2D at 0x7f9bc648da90>]
│ │ │
│ │ │ In [126]: xplt.plot(da, ax=axs[1, 0])
│ │ │ -Out[126]: [<matplotlib.lines.Line2D at 0x7f830da11bd0>]
│ │ │ +Out[126]: [<matplotlib.lines.Line2D at 0x7f9bc648dbd0>]
│ │ │
│ │ │ In [127]: xplt.line(da, ax=axs[1, 1])
│ │ │ -Out[127]: [<matplotlib.lines.Line2D at 0x7f830da11d10>]
│ │ │ +Out[127]: [<matplotlib.lines.Line2D at 0x7f9bc648dd10>]
│ │ │
│ │ │ In [128]: plt.tight_layout()
│ │ │
│ │ │ In [129]: plt.draw()
│ │ │
│ │ │
│ │ │
│ │ │ @@ -1091,15 +1091,15 @@
│ │ │
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 [134]: a.plot()
│ │ │ -Out[134]: <matplotlib.collections.QuadMesh at 0x7f830d883ed0>
│ │ │ +Out[134]: <matplotlib.collections.QuadMesh at 0x7f9bc62fbed0>
│ │ │
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 │ │ │ @@ -1122,57 +1122,57 @@ │ │ │ .....: np.arange(20).reshape(4, 5), │ │ │ .....: dims=["y", "x"], │ │ │ .....: coords={"lat": (("y", "x"), lat), "lon": (("y", "x"), lon)}, │ │ │ .....: ) │ │ │ .....: │ │ │ │ │ │ In [139]: da.plot.pcolormesh(x="lon", y="lat") │ │ │ -Out[139]: <matplotlib.collections.QuadMesh at 0x7f830dade850> │ │ │ +Out[139]: <matplotlib.collections.QuadMesh at 0x7f9bc655a850> │ │ │
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 [140]: import cartopy.crs as ccrs
│ │ │
│ │ │ In [141]: ax = plt.subplot(projection=ccrs.PlateCarree())
│ │ │
│ │ │ In [142]: da.plot.pcolormesh(x="lon", y="lat", ax=ax)
│ │ │ -Out[142]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x7f830d9b7250>
│ │ │ +Out[142]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x7f9bc6433250>
│ │ │
│ │ │ In [143]: ax.scatter(lon, lat, transform=ccrs.PlateCarree())
│ │ │ -Out[143]: <matplotlib.collections.PathCollection at 0x7f830da12c10>
│ │ │ +Out[143]: <matplotlib.collections.PathCollection at 0x7f9bc648ec10>
│ │ │
│ │ │ In [144]: ax.coastlines()
│ │ │ -Out[144]: <cartopy.mpl.feature_artist.FeatureArtist at 0x7f830f68f230>
│ │ │ +Out[144]: <cartopy.mpl.feature_artist.FeatureArtist at 0x7f9b7764f230>
│ │ │
│ │ │ In [145]: ax.gridlines(draw_labels=True)
│ │ │ -Out[145]: <cartopy.mpl.gridliner.Gridliner at 0x7f830f68cad0>
│ │ │ +Out[145]: <cartopy.mpl.gridliner.Gridliner at 0x7f9b7764cad0>
│ │ │
You can however decide to infer the cell boundaries and use the
│ │ │ infer_intervals
keyword:
In [146]: ax = plt.subplot(projection=ccrs.PlateCarree())
│ │ │
│ │ │ In [147]: da.plot.pcolormesh(x="lon", y="lat", ax=ax, infer_intervals=True)
│ │ │ -Out[147]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x7f830e15ec10>
│ │ │ +Out[147]: <cartopy.mpl.geocollection.GeoQuadMesh at 0x7f9bc69dec10>
│ │ │
│ │ │ In [148]: ax.scatter(lon, lat, transform=ccrs.PlateCarree())
│ │ │ -Out[148]: <matplotlib.collections.PathCollection at 0x7f830e1696d0>
│ │ │ +Out[148]: <matplotlib.collections.PathCollection at 0x7f9bc69e96d0>
│ │ │
│ │ │ In [149]: ax.coastlines()
│ │ │ -Out[149]: <cartopy.mpl.feature_artist.FeatureArtist at 0x7f830e169d10>
│ │ │ +Out[149]: <cartopy.mpl.feature_artist.FeatureArtist at 0x7f9bc69e9d10>
│ │ │
│ │ │ In [150]: ax.gridlines(draw_labels=True)
│ │ │ -Out[150]: <cartopy.mpl.gridliner.Gridliner at 0x7f830e169bd0>
│ │ │ +Out[150]: <cartopy.mpl.gridliner.Gridliner at 0x7f9bc69e9bd0>
│ │ │
Note
│ │ │The data model of xarray does not support datasets with cell boundaries │ │ │ @@ -1180,26 +1180,26 @@ │ │ │ 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 [151]: f, ax = plt.subplots(2, 1)
│ │ │
│ │ │ In [152]: da.plot.line(x="lon", hue="y", ax=ax[0])
│ │ │ Out[152]:
│ │ │ -[<matplotlib.lines.Line2D at 0x7f830d876490>,
│ │ │ - <matplotlib.lines.Line2D at 0x7f830d876ad0>,
│ │ │ - <matplotlib.lines.Line2D at 0x7f830d876990>,
│ │ │ - <matplotlib.lines.Line2D at 0x7f830d876850>]
│ │ │ +[<matplotlib.lines.Line2D at 0x7f9bc60fa490>,
│ │ │ + <matplotlib.lines.Line2D at 0x7f9bc60faad0>,
│ │ │ + <matplotlib.lines.Line2D at 0x7f9bc60fa990>,
│ │ │ + <matplotlib.lines.Line2D at 0x7f9bc60fa850>]
│ │ │
│ │ │ In [153]: da.plot.line(x="lon", hue="x", ax=ax[1])
│ │ │ Out[153]:
│ │ │ -[<matplotlib.lines.Line2D at 0x7f830d875590>,
│ │ │ - <matplotlib.lines.Line2D at 0x7f830d875bd0>,
│ │ │ - <matplotlib.lines.Line2D at 0x7f830d875a90>,
│ │ │ - <matplotlib.lines.Line2D at 0x7f830d875950>,
│ │ │ - <matplotlib.lines.Line2D at 0x7f830d875810>]
│ │ │ +[<matplotlib.lines.Line2D at 0x7f9bc60f9590>,
│ │ │ + <matplotlib.lines.Line2D at 0x7f9bc60f9bd0>,
│ │ │ + <matplotlib.lines.Line2D at 0x7f9bc60f9a90>,
│ │ │ + <matplotlib.lines.Line2D at 0x7f9bc60f9950>,
│ │ │ + <matplotlib.lines.Line2D at 0x7f9bc60f9810>]
│ │ │
Whilst coarsen
is normally used for reducing your data’s resolution by applying a reduction function
│ │ │ (see the page on computation),
│ │ │ it can also be used to reorganise your data without applying a computation via construct()
.
Taking our example tutorial air temperature dataset over the Northern US
│ │ │In [56]: air = xr.tutorial.open_dataset("air_temperature")["air"]
│ │ │ -ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f830dfb0550>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │ +ConnectionError: HTTPSConnectionPool(host='github.com', port=443): Max retries exceeded with url: /pydata/xarray-data/raw/master/air_temperature.nc (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7f9bc6a2c550>: Failed to resolve 'github.com' ([Errno -3] Temporary failure in name resolution)"))
│ │ │
│ │ │
│ │ │ In [57]: air.isel(time=0).plot(x="lon", y="lat")
│ │ │ NameError: name 'air' is not defined
│ │ │
To see an example of what each of these strategies might produce, you can call one followed by the .example()
method,
│ │ │ which is a general hypothesis method valid for all strategies.
In [2]: import xarray.testing.strategies as xrst
│ │ │
│ │ │ In [3]: xrst.variables().example()
│ │ │ Out[3]:
│ │ │ -<xarray.Variable (żM5: 4, ſ: 5)> Size: 20B
│ │ │ -array([[-112, 19, -45, 123, 66],
│ │ │ - [-112, -58, -112, -112, -112],
│ │ │ - [ 126, -112, -95, -122, -112],
│ │ │ - [-112, -112, -112, 89, -112]], shape=(4, 5), dtype=int8)
│ │ │ +<xarray.Variable (Ĝ: 2, b: 4, ğűĆľČ: 5)> Size: 160B
│ │ │ +array([[[ 9552, 61616, 37424, 37424, 37424],
│ │ │ + [ 8645, 37424, 37424, 37424, 37424],
│ │ │ + [ 55573, 37424, 37424, 37424, 37424],
│ │ │ + [ 37424, 37424, 7936, 37424, 37424]],
│ │ │ +
│ │ │ + [[ 17757, 37424, 45243, 37424, 1505084421],
│ │ │ + [ 37424, 37424, 37424, 37424, 37424],
│ │ │ + [2817593420, 40100, 37424, 37424, 37424],
│ │ │ + [ 37424, 1853260144, 37424, 40232, 37424]]],
│ │ │ + shape=(2, 4, 5), dtype=uint32)
│ │ │ +Attributes:
│ │ │ + : {'Œ9ĽĚğ': False, 'žŞźŻŐ': 'ţŻēáÆ', '': 'ĕÉŦ', 'Ő': '', '1e100':...
│ │ │ + ųņ2ŋſ: {'lĔġĽ4': None, 'ž': 'ÅÆñĖĕ', 'vµÈżë': True, 'ź': None, 'ľőùI':...
│ │ │
│ │ │ In [4]: xrst.variables().example()
│ │ │ Out[4]:
│ │ │ -<xarray.Variable (đŋ: 2)> Size: 2B
│ │ │ -array([249, 158], dtype=uint8)
│ │ │ +<xarray.Variable (ŭ: 2, wŽŌ: 1, ž: 3)> Size: 96B
│ │ │ +array([[[ 2.739e+303-4.208e+016j, -inf-2.000e+000j, 1.113e-308 -infj]],
│ │ │ +
│ │ │ + [[-2.712e+026 +infj, -3.632e+091+1.576e-302j, -1.000e+007+1.900e+000j]]])
│ │ │ Attributes:
│ │ │ - : {'ŕũ': 'żŴáſ'}
│ │ │ - ŽſŶũĮ: {'': None, 'Dſ': None, 'Źŀž': None, 'NÀ': True, 'Ż': False, 'Ç'...
│ │ │ + ſĸĸÄŻ: ĵTħŽğ
│ │ │
│ │ │ In [5]: xrst.variables().example()
│ │ │ Out[5]:
│ │ │ -<xarray.Variable (0: 1)> Size: 2B
│ │ │ -array([0.], dtype=float16)
│ │ │ +<xarray.Variable (ĉ: 2, p: 3)> Size: 48B
│ │ │ +array([[ 5.960e-08, -1.401e-45, 3.403e+38],
│ │ │ + [ 9.896e+15, -2.000e+00, 1.175e-38]])
│ │ │
You can see that calling .example()
multiple times will generate different examples, giving you an idea of the wide
│ │ │ range of data that the xarray strategies can generate.
In your tests however you should not use .example()
- instead you should parameterize your tests with the
│ │ │ hypothesis.given()
decorator:
In [6]: from hypothesis import given
│ │ │ @@ -127,115 +138,96 @@
│ │ │ Xarray’s strategies can accept other strategies as arguments, allowing you to customise the contents of the generated
│ │ │ examples.
│ │ │ # generate a Variable containing an array with a complex number dtype, but all other details still arbitrary
│ │ │ In [8]: from hypothesis.extra.numpy import complex_number_dtypes
│ │ │
│ │ │ In [9]: xrst.variables(dtype=complex_number_dtypes()).example()
│ │ │ Out[9]:
│ │ │ -<xarray.Variable (ï: 6, ŜĎ: 6)> Size: 576B
│ │ │ -array([[ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j,
│ │ │ - 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j],
│ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j,
│ │ │ - 6.104e-005+3.874e+008j, nan+2.225e-313j, 6.104e-005+3.874e+008j],
│ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, -5.570e+016-9.439e+015j,
│ │ │ - 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j],
│ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j,
│ │ │ - -inf-1.113e-308j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j],
│ │ │ - [-1.000e+000-3.403e+038j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j,
│ │ │ - 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j],
│ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, -1.401e-045+2.225e-309j,
│ │ │ - -1.798e+308 +nanj, 6.104e-005+3.874e+008j, nan +nanj]], shape=(6, 6))
│ │ │ +<xarray.Variable (0: 1)> Size: 8B
│ │ │ +array([0.+0.j], dtype=complex64)
│ │ │
│ │ │
│ │ │ This also works with custom strategies, or strategies defined in other packages.
│ │ │ For example you could imagine creating a chunks
strategy to specify particular chunking patterns for a dask-backed array.
│ │ │
│ │ │
│ │ │ Fixing Arguments¶
│ │ │ If you want to fix one aspect of the data structure, whilst allowing variation in the generated examples
│ │ │ over all other aspects, then use hypothesis.strategies.just()
.
│ │ │ In [10]: import hypothesis.strategies as st
│ │ │
│ │ │ # Generates only variable objects with dimensions ["x", "y"]
│ │ │ In [11]: xrst.variables(dims=st.just(["x", "y"])).example()
│ │ │ Out[11]:
│ │ │ -<xarray.Variable (x: 1, y: 2)> Size: 32B
│ │ │ -array([[-2.712e+16-1.175e-38j, -inf+1.500e+00j]])
│ │ │ -Attributes: (12/15)
│ │ │ - : False
│ │ │ - nil: None
│ │ │ - else: Ïő
│ │ │ - ¼: None
│ │ │ - Ò:
│ │ │ - żʼnû: [b'\xb7\xfa\xb7f']
│ │ │ - ... ...
│ │ │ - ŖũjžŮ: False
│ │ │ - üŚ: None
│ │ │ - Øĉnžż: č0ſ
│ │ │ - ßœžĞż: ʼn
│ │ │ - ûŠ:
│ │ │ - ëÛâÌš: None
│ │ │ +<xarray.Variable (x: 1, y: 4)> Size: 64B
│ │ │ +array([[-6.104e-05+6.104e-05j, -inf +nanj, -5.960e-08-1.175e-38j,
│ │ │ + -inf+0.000e+00j]])
│ │ │ +Attributes:
│ │ │ + Ž: {'': array(['NaT'], dtype='>M8[s]'), 'ý': True}
│ │ │ + ãJ: {'ŶÁŻçſ': None}
│ │ │ + 7v: {'Ŷ': False, 'ſ': None, 'Żſq': None, 'őO': array([inf+0.j]), 'Ï...
│ │ │
│ │ │
│ │ │ (This is technically another example of chaining strategies - hypothesis.strategies.just()
is simply a
│ │ │ special strategy that just contains a single example.)
│ │ │ To fix the length of dimensions you can instead pass dims
as a mapping of dimension names to lengths
│ │ │ (i.e. following xarray objects’ .sizes()
property), e.g.
│ │ │ # Generates only variables with dimensions ["x", "y"], of lengths 2 & 3 respectively
│ │ │ In [12]: xrst.variables(dims=st.just({"x": 2, "y": 3})).example()
│ │ │ Out[12]:
│ │ │ -<xarray.Variable (x: 2, y: 3)> Size: 24B
│ │ │ -array([[ 1.1, 0.5, 1.9],
│ │ │ - [ 1. , -0. , -1. ]], dtype=float32)
│ │ │ +<xarray.Variable (x: 2, y: 3)> Size: 48B
│ │ │ +array([[-2.951e+016, -5.000e-001, -6.320e+206],
│ │ │ + [-2.225e-308, 1.900e+000, inf]])
│ │ │ Attributes:
│ │ │ - tĊŻÙŊ: {'Ų3ŪżT': array([[b'']], dtype='|S6'), '': False, 'Ĉą': True, '...
│ │ │ + 2E: {'óŶſpë': 'true', '': None, 'Ņ': None, 'œŅŻļ': 'C', 'c': None, ...
│ │ │ + láöĄſ: {}
│ │ │
│ │ │
│ │ │ You can also use this to specify that you want examples which are missing some part of the data structure, for instance
│ │ │ # Generates a Variable with no attributes
│ │ │ In [13]: xrst.variables(attrs=st.just({})).example()
│ │ │ Out[13]:
│ │ │ -<xarray.Variable (öãŻ: 6)> Size: 48B
│ │ │ -array([ 184, 4852, 2777752461, 53793, 60094, 24305], dtype=uint64)
│ │ │ +<xarray.Variable (0: 1)> Size: 1B
│ │ │ +array([0], dtype=int8)
│ │ │
│ │ │
│ │ │ Through a combination of chaining strategies and fixing arguments, you can specify quite complicated requirements on the
│ │ │ objects your chained strategy will generate.
│ │ │ In [14]: fixed_x_variable_y_maybe_z = st.fixed_dictionaries(
│ │ │ ....: {"x": st.just(2), "y": st.integers(3, 4)}, optional={"z": st.just(2)}
│ │ │ ....: )
│ │ │ ....:
│ │ │
│ │ │ In [15]: fixed_x_variable_y_maybe_z.example()
│ │ │ -Out[15]: {'x': 2, 'y': 4}
│ │ │ +Out[15]: {'x': 2, 'y': 3}
│ │ │
│ │ │ In [16]: special_variables = xrst.variables(dims=fixed_x_variable_y_maybe_z)
│ │ │
│ │ │ In [17]: special_variables.example()
│ │ │ Out[17]:
│ │ │ -<xarray.Variable (x: 2, y: 4)> Size: 8B
│ │ │ -array([[ 63, -109, 120, 100],
│ │ │ - [ 83, 59, 29, -128]], dtype=int8)
│ │ │ +<xarray.Variable (x: 2, y: 3, z: 2)> Size: 24B
│ │ │ +array([[[ 1.500e+00, -3.333e-01],
│ │ │ + [ -inf, 5.000e-01],
│ │ │ + [ 0.000e+00, -inf]],
│ │ │ +
│ │ │ + [[-1.000e+00, -inf],
│ │ │ + [-0.000e+00, nan],
│ │ │ + [ nan, 1.192e-07]]], shape=(2, 3, 2), dtype=float16)
│ │ │ Attributes:
│ │ │ - g: None
│ │ │ - ijħż: [28826]
│ │ │ - : RĹŽmW
│ │ │ - ũŹöŽŕ: óTĒ
│ │ │ - LÌŷß: ['' '']
│ │ │ + ĥ: {'ÈĜ': 'ŗ'}
│ │ │
│ │ │ In [18]: special_variables.example()
│ │ │ Out[18]:
│ │ │ -<xarray.Variable (x: 2, y: 3, z: 2)> Size: 24B
│ │ │ -array([[[46910, 24414],
│ │ │ - [53871, 23091],
│ │ │ - [53871, 13859]],
│ │ │ -
│ │ │ - [[58777, 53871],
│ │ │ - [31774, 53871],
│ │ │ - [53871, 53871]]], shape=(2, 3, 2), dtype=uint16)
│ │ │ +<xarray.Variable (x: 2, y: 3)> Size: 12B
│ │ │ +array([[19855, 46365, 32281],
│ │ │ + [34621, 5273, 59658]], dtype=uint16)
│ │ │ +Attributes:
│ │ │ + ħ: None
│ │ │ + Āſ: [[b'3' b'\xe4\xb4#>']\n [b'\x90\xbb\xfd\x9c\x9a' b'\xef\xb1']]
│ │ │ + : True
│ │ │
│ │ │
│ │ │ Here we have used one of hypothesis’ built-in strategies hypothesis.strategies.fixed_dictionaries()
to create a
│ │ │ strategy which generates mappings of dimension names to lengths (i.e. the size
of the xarray object we want).
│ │ │ This particular strategy will always generate an x
dimension of length 2, and a y
dimension of
│ │ │ length either 3 or 4, and will sometimes also generate a z
dimension of length 2.
│ │ │ By feeding this strategy for dictionaries into the dims
argument of xarray’s variables()
strategy,
│ │ │ @@ -351,28 +343,28 @@
│ │ │
A common task when testing xarray user code is checking that your function works for all valid input dimensions.
│ │ │ We can chain strategies to achieve this, for which the helper strategy unique_subset_of()
│ │ │ is useful.
│ │ │ It works for lists of dimension names
│ │ │ In [33]: dims = ["x", "y", "z"]
│ │ │
│ │ │ In [34]: xrst.unique_subset_of(dims).example()
│ │ │ -Out[34]: ['z', 'y']
│ │ │ +Out[34]: ['y']
│ │ │
│ │ │ In [35]: xrst.unique_subset_of(dims).example()
│ │ │ Out[35]: ['y', 'x', 'z']
│ │ │
│ │ │
│ │ │ as well as for mappings of dimension names to sizes
│ │ │ In [36]: dim_sizes = {"x": 2, "y": 3, "z": 4}
│ │ │
│ │ │ In [37]: xrst.unique_subset_of(dim_sizes).example()
│ │ │ -Out[37]: {'x': 2, 'y': 3, 'z': 4}
│ │ │ +Out[37]: {'x': 2, 'y': 3}
│ │ │
│ │ │ In [38]: xrst.unique_subset_of(dim_sizes).example()
│ │ │ -Out[38]: {'x': 2, 'y': 3, 'z': 4}
│ │ │ +Out[38]: {'x': 2, 'y': 3}
│ │ │
│ │ │
│ │ │ This is useful because operations like reductions can be performed over any subset of the xarray object’s dimensions.
│ │ │ For example we can write a pytest test that tests that a reduction gives the expected result when applying that reduction
│ │ │ along any possible valid subset of the Variable’s dimensions.
│ │ │ import numpy.testing as npt
│ │ │ ├── html2text {}
│ │ │ │ @@ -28,33 +28,47 @@
│ │ │ │ To see an example of what each of these strategies might produce, you can call
│ │ │ │ one followed by the .example() method, which is a general hypothesis method
│ │ │ │ valid for all strategies.
│ │ │ │ In [2]: import xarray.testing.strategies as xrst
│ │ │ │
│ │ │ │ In [3]: xrst.variables().example()
│ │ │ │ Out[3]:
│ │ │ │ - Size: 20B
│ │ │ │ -array([[-112, 19, -45, 123, 66],
│ │ │ │ - [-112, -58, -112, -112, -112],
│ │ │ │ - [ 126, -112, -95, -122, -112],
│ │ │ │ - [-112, -112, -112, 89, -112]], shape=(4, 5), dtype=int8)
│ │ │ │ + Size: 160B
│ │ │ │ +array([[[ 9552, 61616, 37424, 37424, 37424],
│ │ │ │ + [ 8645, 37424, 37424, 37424, 37424],
│ │ │ │ + [ 55573, 37424, 37424, 37424, 37424],
│ │ │ │ + [ 37424, 37424, 7936, 37424, 37424]],
│ │ │ │ +
│ │ │ │ + [[ 17757, 37424, 45243, 37424, 1505084421],
│ │ │ │ + [ 37424, 37424, 37424, 37424, 37424],
│ │ │ │ + [2817593420, 40100, 37424, 37424, 37424],
│ │ │ │ + [ 37424, 1853260144, 37424, 40232, 37424]]],
│ │ │ │ + shape=(2, 4, 5), dtype=uint32)
│ │ │ │ +Attributes:
│ │ │ │ + : {'Œ9ĽĚğ': False, 'žŞźŻŐ': 'ţŻēáÆ', '': 'ĕÉŦ', 'Ő': '',
│ │ │ │ +'1e100':...
│ │ │ │ + ųņ2ŋſ: {'lĔġĽ4': None, 'ž': 'ÅÆñĖĕ', 'vµÈżë': True, 'ź': None,
│ │ │ │ +'ľőùI':...
│ │ │ │
│ │ │ │ In [4]: xrst.variables().example()
│ │ │ │ Out[4]:
│ │ │ │ - Size: 2B
│ │ │ │ -array([249, 158], dtype=uint8)
│ │ │ │ + Size: 96B
│ │ │ │ +array([[[ 2.739e+303-4.208e+016j, -inf-2.000e+000j, 1.113e-308 -
│ │ │ │ +infj]],
│ │ │ │ +
│ │ │ │ + [[-2.712e+026 +infj, -3.632e+091+1.576e-302j, -
│ │ │ │ +1.000e+007+1.900e+000j]]])
│ │ │ │ Attributes:
│ │ │ │ - : {'ŕũ': 'żŴáſ'}
│ │ │ │ - ŽſŶũĮ: {'': None, 'Dſ': None, 'Źŀž': None, 'NÀ': True, 'Ż': False,
│ │ │ │ -'Ç'...
│ │ │ │ + ſĸĸÄŻ: ĵTħŽğ
│ │ │ │
│ │ │ │ In [5]: xrst.variables().example()
│ │ │ │ Out[5]:
│ │ │ │ - Size: 2B
│ │ │ │ -array([0.], dtype=float16)
│ │ │ │ + Size: 48B
│ │ │ │ +array([[ 5.960e-08, -1.401e-45, 3.403e+38],
│ │ │ │ + [ 9.896e+15, -2.000e+00, 1.175e-38]])
│ │ │ │ You can see that calling .example() multiple times will generate different
│ │ │ │ examples, giving you an idea of the wide range of data that the xarray
│ │ │ │ strategies can generate.
│ │ │ │ In your tests however you should not use .example() - instead you should
│ │ │ │ parameterize your tests with the hypothesis.given() decorator:
│ │ │ │ In [6]: from hypothesis import given
│ │ │ │ In [7]: @given(xrst.variables())
│ │ │ │ @@ -66,127 +80,96 @@
│ │ │ │ customise the contents of the generated examples.
│ │ │ │ # generate a Variable containing an array with a complex number dtype, but all
│ │ │ │ other details still arbitrary
│ │ │ │ In [8]: from hypothesis.extra.numpy import complex_number_dtypes
│ │ │ │
│ │ │ │ In [9]: xrst.variables(dtype=complex_number_dtypes()).example()
│ │ │ │ Out[9]:
│ │ │ │ - Size: 576B
│ │ │ │ -array([[ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j,
│ │ │ │ - 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j],
│ │ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j,
│ │ │ │ - 6.104e-005+3.874e+008j, nan+2.225e-313j, 6.104e-
│ │ │ │ -005+3.874e+008j],
│ │ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, -5.570e+016-
│ │ │ │ -9.439e+015j,
│ │ │ │ - 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j],
│ │ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j,
│ │ │ │ - -inf-1.113e-308j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j],
│ │ │ │ - [-1.000e+000-3.403e+038j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j,
│ │ │ │ - 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, 6.104e-
│ │ │ │ -005+3.874e+008j],
│ │ │ │ - [ 6.104e-005+3.874e+008j, 6.104e-005+3.874e+008j, -1.401e-045+2.225e-
│ │ │ │ -309j,
│ │ │ │ - -1.798e+308 +nanj, 6.104e-005+3.874e+008j, nan
│ │ │ │ -+nanj]], shape=(6, 6))
│ │ │ │ + Size: 8B
│ │ │ │ +array([0.+0.j], dtype=complex64)
│ │ │ │ This also works with custom strategies, or strategies defined in other
│ │ │ │ packages. For example you could imagine creating a chunks strategy to specify
│ │ │ │ particular chunking patterns for a dask-backed array.
│ │ │ │ ******** FFiixxiinngg AArrgguummeennttss_?¶ ********
│ │ │ │ If you want to fix one aspect of the data structure, whilst allowing variation
│ │ │ │ in the generated examples over all other aspects, then use
│ │ │ │ hypothesis.strategies.just().
│ │ │ │ In [10]: import hypothesis.strategies as st
│ │ │ │
│ │ │ │ # Generates only variable objects with dimensions ["x", "y"]
│ │ │ │ In [11]: xrst.variables(dims=st.just(["x", "y"])).example()
│ │ │ │ Out[11]:
│ │ │ │ - Size: 32B
│ │ │ │ -array([[-2.712e+16-1.175e-38j, -inf+1.500e+00j]])
│ │ │ │ -Attributes: (12/15)
│ │ │ │ - : False
│ │ │ │ - nil: None
│ │ │ │ - else: Ïő
│ │ │ │ - ¼: None
│ │ │ │ - Ò:
│ │ │ │ - żʼnû: [b'\xb7\xfa\xb7f']
│ │ │ │ - ... ...
│ │ │ │ - ŖũjžŮ: False
│ │ │ │ - üŚ: None
│ │ │ │ - Øĉnžż: č0ſ
│ │ │ │ - ßœžĞż: ʼn
│ │ │ │ - ûŠ:
│ │ │ │ - ëÛâÌš: None
│ │ │ │ + Size: 64B
│ │ │ │ +array([[-6.104e-05+6.104e-05j, -inf +nanj, -5.960e-08-1.175e-38j,
│ │ │ │ + -inf+0.000e+00j]])
│ │ │ │ +Attributes:
│ │ │ │ + Ž: {'': array(['NaT'], dtype='>M8[s]'), 'ý': True}
│ │ │ │ + ãJ: {'ŶÁŻçſ': None}
│ │ │ │ + 7v: {'Ŷ': False, 'ſ': None, 'Żſq': None, 'őO': array([inf+0.j]),
│ │ │ │ +'Ï...
│ │ │ │ (This is technically another example of chaining strategies -
│ │ │ │ hypothesis.strategies.just() is simply a special strategy that just contains a
│ │ │ │ single example.)
│ │ │ │ To fix the length of dimensions you can instead pass dims as a mapping of
│ │ │ │ dimension names to lengths (i.e. following xarray objects’ .sizes() property),
│ │ │ │ e.g.
│ │ │ │ # Generates only variables with dimensions ["x", "y"], of lengths 2 & 3
│ │ │ │ respectively
│ │ │ │ In [12]: xrst.variables(dims=st.just({"x": 2, "y": 3})).example()
│ │ │ │ Out[12]:
│ │ │ │ - Size: 24B
│ │ │ │ -array([[ 1.1, 0.5, 1.9],
│ │ │ │ - [ 1. , -0. , -1. ]], dtype=float32)
│ │ │ │ + Size: 48B
│ │ │ │ +array([[-2.951e+016, -5.000e-001, -6.320e+206],
│ │ │ │ + [-2.225e-308, 1.900e+000, inf]])
│ │ │ │ Attributes:
│ │ │ │ - tĊŻÙŊ: {'Ų3ŪżT': array([[b'']], dtype='|S6'), '': False, 'Ĉą': True,
│ │ │ │ -'...
│ │ │ │ + 2E: {'óŶſpë': 'true', '': None, 'Ņ': None, 'œŅŻļ': 'C', 'c': None,
│ │ │ │ +...
│ │ │ │ + láöĄſ: {}
│ │ │ │ You can also use this to specify that you want examples which are missing some
│ │ │ │ part of the data structure, for instance
│ │ │ │ # Generates a Variable with no attributes
│ │ │ │ In [13]: xrst.variables(attrs=st.just({})).example()
│ │ │ │ Out[13]:
│ │ │ │ - Size: 48B
│ │ │ │ -array([ 184, 4852, 2777752461, 53793, 60094, 24305],
│ │ │ │ -dtype=uint64)
│ │ │ │ + Size: 1B
│ │ │ │ +array([0], dtype=int8)
│ │ │ │ Through a combination of chaining strategies and fixing arguments, you can
│ │ │ │ specify quite complicated requirements on the objects your chained strategy
│ │ │ │ will generate.
│ │ │ │ In [14]: fixed_x_variable_y_maybe_z = st.fixed_dictionaries(
│ │ │ │ ....: {"x": st.just(2), "y": st.integers(3, 4)}, optional={"z": st.just
│ │ │ │ (2)}
│ │ │ │ ....: )
│ │ │ │ ....:
│ │ │ │
│ │ │ │ In [15]: fixed_x_variable_y_maybe_z.example()
│ │ │ │ -Out[15]: {'x': 2, 'y': 4}
│ │ │ │ +Out[15]: {'x': 2, 'y': 3}
│ │ │ │
│ │ │ │ In [16]: special_variables = xrst.variables(dims=fixed_x_variable_y_maybe_z)
│ │ │ │
│ │ │ │ In [17]: special_variables.example()
│ │ │ │ Out[17]:
│ │ │ │ - Size: 8B
│ │ │ │ -array([[ 63, -109, 120, 100],
│ │ │ │ - [ 83, 59, 29, -128]], dtype=int8)
│ │ │ │ + Size: 24B
│ │ │ │ +array([[[ 1.500e+00, -3.333e-01],
│ │ │ │ + [ -inf, 5.000e-01],
│ │ │ │ + [ 0.000e+00, -inf]],
│ │ │ │ +
│ │ │ │ + [[-1.000e+00, -inf],
│ │ │ │ + [-0.000e+00, nan],
│ │ │ │ + [ nan, 1.192e-07]]], shape=(2, 3, 2), dtype=float16)
│ │ │ │ Attributes:
│ │ │ │ - g: None
│ │ │ │ - ijħż: [28826]
│ │ │ │ - : RĹŽmW
│ │ │ │ - ũŹöŽŕ: óTĒ
│ │ │ │ - LÌŷß: ['' '']
│ │ │ │ + ĥ: {'ÈĜ': 'ŗ'}
│ │ │ │
│ │ │ │ In [18]: special_variables.example()
│ │ │ │ Out[18]:
│ │ │ │ - Size: 24B
│ │ │ │ -array([[[46910, 24414],
│ │ │ │ - [53871, 23091],
│ │ │ │ - [53871, 13859]],
│ │ │ │ -
│ │ │ │ - [[58777, 53871],
│ │ │ │ - [31774, 53871],
│ │ │ │ - [53871, 53871]]], shape=(2, 3, 2), dtype=uint16)
│ │ │ │ + Size: 12B
│ │ │ │ +array([[19855, 46365, 32281],
│ │ │ │ + [34621, 5273, 59658]], dtype=uint16)
│ │ │ │ +Attributes:
│ │ │ │ + ħ: None
│ │ │ │ + Āſ: [[b'3' b'\xe4\xb4#>']\n [b'\x90\xbb\xfd\x9c\x9a' b'\xef\xb1']]
│ │ │ │ + : True
│ │ │ │ Here we have used one of hypothesis’ built-in strategies
│ │ │ │ hypothesis.strategies.fixed_dictionaries() to create a strategy which generates
│ │ │ │ mappings of dimension names to lengths (i.e. the size of the xarray object we
│ │ │ │ want). This particular strategy will always generate an x dimension of length
│ │ │ │ 2, and a y dimension of length either 3 or 4, and will sometimes also generate
│ │ │ │ a z dimension of length 2. By feeding this strategy for dictionaries into the
│ │ │ │ dims argument of xarray’s variables() strategy, we can generate arbitrary
│ │ │ │ @@ -292,26 +275,26 @@
│ │ │ │ A common task when testing xarray user code is checking that your function
│ │ │ │ works for all valid input dimensions. We can chain strategies to achieve this,
│ │ │ │ for which the helper strategy unique_subset_of() is useful.
│ │ │ │ It works for lists of dimension names
│ │ │ │ In [33]: dims = ["x", "y", "z"]
│ │ │ │
│ │ │ │ In [34]: xrst.unique_subset_of(dims).example()
│ │ │ │ -Out[34]: ['z', 'y']
│ │ │ │ +Out[34]: ['y']
│ │ │ │
│ │ │ │ In [35]: xrst.unique_subset_of(dims).example()
│ │ │ │ Out[35]: ['y', 'x', 'z']
│ │ │ │ as well as for mappings of dimension names to sizes
│ │ │ │ In [36]: dim_sizes = {"x": 2, "y": 3, "z": 4}
│ │ │ │
│ │ │ │ In [37]: xrst.unique_subset_of(dim_sizes).example()
│ │ │ │ -Out[37]: {'x': 2, 'y': 3, 'z': 4}
│ │ │ │ +Out[37]: {'x': 2, 'y': 3}
│ │ │ │
│ │ │ │ In [38]: xrst.unique_subset_of(dim_sizes).example()
│ │ │ │ -Out[38]: {'x': 2, 'y': 3, 'z': 4}
│ │ │ │ +Out[38]: {'x': 2, 'y': 3}
│ │ │ │ This is useful because operations like reductions can be performed over any
│ │ │ │ subset of the xarray object’s dimensions. For example we can write a pytest
│ │ │ │ test that tests that a reduction gives the expected result when applying that
│ │ │ │ reduction along any possible valid subset of the Variable’s dimensions.
│ │ │ │ import numpy.testing as npt
│ │ ├── ./usr/share/doc/python-xarray-doc/html/whats-new.html
│ │ │ @@ -8191,15 +8191,15 @@
│ │ │ New xray.Dataset.where
method for masking xray objects according
│ │ │ to some criteria. This works particularly well with multi-dimensional data:
│ │ │ In [45]: ds = xray.Dataset(coords={"x": range(100), "y": range(100)})
│ │ │
│ │ │ In [46]: ds["distance"] = np.sqrt(ds.x**2 + ds.y**2)
│ │ │
│ │ │ In [47]: ds.distance.where(ds.distance < 100).plot()
│ │ │ -Out[47]: <matplotlib.collections.QuadMesh at 0x7f8310c21a90>
│ │ │ +Out[47]: <matplotlib.collections.QuadMesh at 0x7f9bc7c9e210>
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │
│ │ │ Added new methods xray.DataArray.diff
and xray.Dataset.diff
│ │ │ for finite difference calculations along a given axis.
│ │ │ ├── html2text {}
│ │ │ │ @@ -5286,15 +5286,15 @@
│ │ │ │ * New xray.Dataset.where method for masking xray objects according to some
│ │ │ │ criteria. This works particularly well with multi-dimensional data:
│ │ │ │ In [45]: ds = xray.Dataset(coords={"x": range(100), "y": range(100)})
│ │ │ │
│ │ │ │ In [46]: ds["distance"] = np.sqrt(ds.x**2 + ds.y**2)
│ │ │ │
│ │ │ │ In [47]: ds.distance.where(ds.distance < 100).plot()
│ │ │ │ - Out[47]:
│ │ │ │ + Out[47]:
│ │ │ │ _[___i_m_a_g_e_s_/_w_h_e_r_e___e_x_a_m_p_l_e_._p_n_g_]
│ │ │ │ * 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 returning a
│ │ │ │ numpy.ma.MaskedArray.
│ │ │ │ In [48]: da = xray.DataArray(np.random.random_sample(size=(5, 4)))