|
2256 | 2256 | "source": [
|
2257 | 2257 | "# calculate median value by time of day for the historic data\n",
|
2258 | 2258 | "# this takes a while because it needs to process ~30GB\n",
|
2259 |
| - "hourly_da = (\n", |
2260 |
| - " historic_da\n", |
2261 |
| - " .groupby(\"time.hour\")\n", |
2262 |
| - " .median()\n", |
2263 |
| - " .compute()\n", |
2264 |
| - ")" |
| 2259 | + "hourly_da = historic_da.groupby(\"time.hour\").median().compute()" |
2265 | 2260 | ]
|
2266 | 2261 | },
|
2267 | 2262 | {
|
|
2634 | 2629 | "execution_count": 28,
|
2635 | 2630 | "id": "da3af858-e212-4d26-b25c-1bccf8458d61",
|
2636 | 2631 | "metadata": {
|
2637 |
| - "jupyter": { |
2638 |
| - "source_hidden": true |
2639 |
| - }, |
2640 | 2632 | "tags": []
|
2641 | 2633 | },
|
2642 | 2634 | "outputs": [
|
|
2660 | 2652 | "fig, ax = plt.subplots(figsize=(7, 5))\n",
|
2661 | 2653 | "im_data = wildfire_danger_48hours.where(wildfire_danger_48hours > 0)\n",
|
2662 | 2654 | "ax.imshow(\n",
|
2663 |
| - " im_data,\n", |
2664 |
| - " extent=image_plot_extent,\n", |
2665 |
| - " origin=\"upper\",\n", |
2666 |
| - " cmap=\"inferno\", \n", |
2667 |
| - " vmin=0,\n", |
2668 |
| - " vmax=0.7\n", |
| 2655 | + " im_data, extent=image_plot_extent, origin=\"upper\", cmap=\"inferno\", vmin=0, vmax=0.7\n", |
2669 | 2656 | ")\n",
|
2670 | 2657 | "\n",
|
2671 |
| - "north_america_boundary.plot(\n", |
2672 |
| - " ax=ax, facecolor=\"none\", edgecolor=\"black\", linewidth=1.2\n", |
2673 |
| - ")\n", |
2674 |
| - "us_states_boundaries.plot(\n", |
2675 |
| - " ax=ax, facecolor=\"none\", edgecolor=\"black\", linewidth=0.7\n", |
2676 |
| - ")\n", |
| 2658 | + "north_america_boundary.plot(ax=ax, facecolor=\"none\", edgecolor=\"black\", linewidth=1.2)\n", |
| 2659 | + "us_states_boundaries.plot(ax=ax, facecolor=\"none\", edgecolor=\"black\", linewidth=0.7)\n", |
2677 | 2660 | "\n",
|
2678 | 2661 | "ax.axis(\"off\")\n",
|
2679 | 2662 | "plt.subplots_adjust(left=0.1, right=0.9, top=0.85, bottom=0.15)\n",
|
2680 | 2663 | "fig.suptitle(\"Cumulative wildfire risk in 48 hour forecast\", fontsize=12, y=0.92)\n",
|
2681 |
| - "fig.text(0.1, 0.05, f\"reference time: {now.strftime(\"%Y-%m-%dT%H\")}\", ha=\"left\", fontsize=10)\n", |
| 2664 | + "fig.text(\n", |
| 2665 | + " 0.1, 0.05, f\"reference time: {now.strftime('%Y-%m-%dT%H')}\", ha=\"left\", fontsize=10\n", |
| 2666 | + ")\n", |
2682 | 2667 | "\n",
|
2683 | 2668 | "plt.show()"
|
2684 | 2669 | ]
|
|
2905 | 2890 | ],
|
2906 | 2891 | "metadata": {
|
2907 | 2892 | "kernelspec": {
|
2908 |
| - "display_name": "Python 3.12 (geo)", |
| 2893 | + "display_name": "Python 3 (ipykernel)", |
2909 | 2894 | "language": "python",
|
2910 |
| - "name": "envname" |
| 2895 | + "name": "python3" |
2911 | 2896 | },
|
2912 | 2897 | "language_info": {
|
2913 | 2898 | "codemirror_mode": {
|
|
2919 | 2904 | "name": "python",
|
2920 | 2905 | "nbconvert_exporter": "python",
|
2921 | 2906 | "pygments_lexer": "ipython3",
|
2922 |
| - "version": "3.12.10" |
| 2907 | + "version": "3.13.0" |
2923 | 2908 | }
|
2924 | 2909 | },
|
2925 | 2910 | "nbformat": 4,
|
|
0 commit comments