5 "execution_count": null,
6 "id": "dd71eb39-f938-440e-99a8-3dc02ee55102",
10 "from utils import read_pkl\n",
11 "from data_funcs import combine_nested\n",
12 "import pandas as pd\n",
13 "import matplotlib.pyplot as plt\n",
14 "import plotly.express as px\n",
15 "import plotly.graph_objects as go\n",
16 "import numpy as np\n",
17 "from mpl_toolkits.basemap import Basemap\n",
18 "from matplotlib.patches import Polygon"
23 "execution_count": null,
24 "id": "4197b2ae-d8e3-4878-b87b-795f7622c753",
28 "dat = read_pkl(\"train.pkl\")"
33 "execution_count": null,
34 "id": "524d7d5f-7b07-4e9f-87e6-a1853bf4ef27",
38 "list([*dat.keys()]).index('CHRO3_202401')"
43 "execution_count": null,
44 "id": "df0ef300-c4d8-4120-889a-7765da096d9a",
48 "d = combine_nested(dat)"
53 "execution_count": null,
54 "id": "14b96f79-b8bd-403d-9a4a-8a3b9ae87ee6",
63 "execution_count": null,
64 "id": "116d180c-324a-4804-b5d4-28707aac7bc9",
74 "execution_count": null,
75 "id": "d28d3760-92ad-4e14-90fd-69020c2c4b56",
80 "bbox = [42, -124.6, 49, -116.4]"
85 "execution_count": null,
86 "id": "eb6ad122-815b-4f83-8049-c3e28fb62c12",
90 "df = pd.DataFrame({key: locs[key] for key in ['STID', 'lat', 'lon']})\n",
96 "execution_count": null,
97 "id": "4c04a46d-7096-4fad-8c20-807e409f8f80",
101 "def make_st_map_interactive(df):\n",
102 " fig = go.Figure(go.Scattermapbox(\n",
105 " mode='markers',\n",
106 " marker=go.scattermapbox.Marker(\n",
110 " text=df['STID'],\n",
112 " showlegend=False # Turn off legend\n",
116 " center_lon=df['lon'].median()\n",
117 " center_lat=df['lat'].median()\n",
118 " fig.update_layout(\n",
119 " mapbox_style=\"open-street-map\",\n",
120 " mapbox_center=dict(lat=center_lat, lon=center_lon)\n",
122 " # Add Lines for Bounding Box\n",
124 " fig.add_trace(go.Scattermapbox(\n",
125 " mode=\"lines\",\n",
126 " lon=[df['lon'].min(), df['lon'].min(), df['lon'].max(), df['lon'].max(), df['lon'].min()],\n",
127 " lat=[df['lat'].min(), df['lat'].max(), df['lat'].max(), df['lat'].min(), df['lat'].min()],\n",
128 " marker=dict(size=5, color=\"black\"),\n",
129 " line=dict(width=1.5, color=\"black\"),\n",
130 " showlegend=False\n",
133 " fig.update_layout(\n",
134 " margin={\"r\":0,\"t\":0,\"l\":0,\"b\":0},\n",
135 " mapbox_zoom =5,\n",
136 " mapbox_center={\"lat\": np.median(df.lat), \"lon\": np.median(df.lon)}, # Center the map on desired location\n",
145 "execution_count": null,
146 "id": "1fd6cfd9-8ce5-44a8-a618-fc06ba898666",
150 "make_st_map_interactive(df)"
155 "execution_count": null,
156 "id": "39374ba7-e4fb-4a7d-a9b0-7bca76e2f950",
161 "ind = d['loc']['STID'].index(st)"
166 "execution_count": null,
167 "id": "62053cfb-d882-4044-90c5-38165572596e",
171 "fig, ax = plt.subplots()\n",
172 "plt.title(f\"RAWS Station {st}\")\n",
173 "ax.plot(d['y'][ind][3000:3500], linestyle='-',c='#468a29',label='FMC Observed')\n",
174 "plt.legend(loc='upper right')\n",
175 "ax.set_ylabel(\"Fuel Moisture Content (%)\")\n",
176 "ax.set_xlabel(\"Hour\")\n",
177 "plt.savefig(\"outputs/fmc_plot2.png\")\n",
178 "# Increase the thickness of the axis borders\n",
179 "ax.spines['top'].set_linewidth(1.5)\n",
180 "ax.spines['bottom'].set_linewidth(1.5)\n",
181 "ax.spines['left'].set_linewidth(1.5)\n",
182 "ax.spines['right'].set_linewidth(1.5)\n",
184 "plt.savefig(\"outputs/fmc_plot2.png\")"
189 "execution_count": null,
190 "id": "58961640-8836-4920-8a08-e891f5b17c34",
197 "execution_count": null,
198 "id": "0dcdc7ca-da86-430f-a38b-ad5abe4abfe6",
205 "execution_count": null,
206 "id": "86d94b91-fbb4-47fb-bba0-e41551f361b5",
214 "display_name": "Python 3 (ipykernel)",
215 "language": "python",
223 "file_extension": ".py",
224 "mimetype": "text/x-python",
226 "nbconvert_exporter": "python",
227 "pygments_lexer": "ipython3",