|
478 | 478 | "df"
|
479 | 479 | ]
|
480 | 480 | },
|
| 481 | + { |
| 482 | + "cell_type": "markdown", |
| 483 | + "metadata": {}, |
| 484 | + "source": [ |
| 485 | + "### Xarray Datasets\n", |
| 486 | + "\n", |
| 487 | + "[Xarray datasets](https://docs.xarray.dev/en/stable/generated/xarray.Dataset.html)\n", |
| 488 | + "should also be shown in their beautiful HTML representation.\n", |
| 489 | + "LaTeX/PDF output will fall back to the plain text representation." |
| 490 | + ] |
| 491 | + }, |
| 492 | + { |
| 493 | + "cell_type": "code", |
| 494 | + "execution_count": null, |
| 495 | + "metadata": {}, |
| 496 | + "outputs": [], |
| 497 | + "source": [ |
| 498 | + "import xarray as xr" |
| 499 | + ] |
| 500 | + }, |
| 501 | + { |
| 502 | + "cell_type": "code", |
| 503 | + "execution_count": null, |
| 504 | + "metadata": {}, |
| 505 | + "outputs": [], |
| 506 | + "source": [ |
| 507 | + "a = {}\n", |
| 508 | + "for name in [\"t\", \"q\"]: \n", |
| 509 | + " da = xr.DataArray(\n", |
| 510 | + " [\n", |
| 511 | + " [[11, 12, 13], [21, 22, 23], [31, 32, 33]],\n", |
| 512 | + " [[14, 15, 16], [24, 25, 26], [34, 35, 36]],\n", |
| 513 | + " ],\n", |
| 514 | + " coords={\"level\": [\"500\", \"700\"], \"x\": [1, 2, 3], \"y\": [4, 5, 6]},\n", |
| 515 | + " name=name,\n", |
| 516 | + " attrs={\"param\": name}\n", |
| 517 | + " )\n", |
| 518 | + " a[name] = da\n", |
| 519 | + "\n", |
| 520 | + "ds = xr.Dataset(a, attrs={\"title\": \"Demo dataset\", \"year\": 2024})\n", |
| 521 | + "ds" |
| 522 | + ] |
| 523 | + }, |
481 | 524 | {
|
482 | 525 | "cell_type": "markdown",
|
483 | 526 | "metadata": {},
|
|
0 commit comments