Create Batch Reset Hyperparameter tutorial notebook
[notebooks.git] / fmda / data / synopticpy_tutorial.ipynb
blob6efa65438ff79fa1b46856d5f2ecfb135cacc95c
2  "cells": [
3   {
4    "cell_type": "markdown",
5    "id": "f1f4cc18-d23f-48ea-84dc-b0328a65e8e5",
6    "metadata": {},
7    "source": [
8     "# Collect RAWS Data with SynopticPy"
9    ]
10   },
11   {
12    "cell_type": "markdown",
13    "id": "84ed774d-7bef-48e7-b9a6-8f4ba4e17d81",
14    "metadata": {},
15    "source": [
16     "## Setup"
17    ]
18   },
19   {
20    "cell_type": "code",
21    "execution_count": null,
22    "id": "509b32fd-9d6b-4582-b724-4d2a094a6832",
23    "metadata": {},
24    "outputs": [],
25    "source": [
26     "import matplotlib.pyplot as plt\n",
27     "from datetime import datetime\n",
28     "\n",
29     "from synoptic.services import stations_timeseries"
30    ]
31   },
32   {
33    "cell_type": "markdown",
34    "id": "4fbefa25-ac25-4164-adbc-187f9740b6b8",
35    "metadata": {},
36    "source": [
37     "## Station Time Series"
38    ]
39   },
40   {
41    "cell_type": "code",
42    "execution_count": null,
43    "id": "8f05be2b-0120-4637-b5d2-a258211b2650",
44    "metadata": {},
45    "outputs": [],
46    "source": [
47     "params = dict(\n",
48     "    stid=[\"KNRPN\"],\n",
49     "    vars=[\"air_temp\", \"relative_humidity\", \"precip_accum\", \"fuel_moisture\", \"wind_speed\", \"solar_radiation\", \"soil_moisture\"],\n",
50     "    start=datetime(2024, 1, 1),\n",
51     "    end=datetime(2024, 1, 8),\n",
52     ")\n",
53     "\n",
54     "a = stations_timeseries(verbose=\"HIDE\", **params)\n",
55     "\n",
56     "a"
57    ]
58   },
59   {
60    "cell_type": "code",
61    "execution_count": null,
62    "id": "8ce7b02c-4149-443e-b29d-da8cdf12583e",
63    "metadata": {},
64    "outputs": [],
65    "source": [
66     "type(a)"
67    ]
68   },
69   {
70    "cell_type": "code",
71    "execution_count": null,
72    "id": "e711774a-f8be-4f60-ac8c-8908f5c192ec",
73    "metadata": {},
74    "outputs": [],
75    "source": [
76     "print(f'Station Elevation: {a.attrs[\"ELEVATION\"]}')\n",
77     "print(f'Lat: {a.attrs[\"latitude\"]}')\n",
78     "print(f'Lon: {a.attrs[\"longitude\"]}')\n",
79     "print(f'Temp Units: {a.attrs[\"UNITS\"][\"air_temp\"]}')\n",
80     "print(f'Wind Units: {a.attrs[\"UNITS\"][\"wind_speed\"]}')\n",
81     "# print(f'Solar Rad. Units: {a.attrs[\"UNITS\"][\"solar_radiation\"]}')"
82    ]
83   },
84   {
85    "cell_type": "code",
86    "execution_count": null,
87    "id": "2058d705-a2d3-48d9-9151-a4536512057e",
88    "metadata": {},
89    "outputs": [],
90    "source": [
91     "a.attrs"
92    ]
93   },
94   {
95    "cell_type": "code",
96    "execution_count": null,
97    "id": "6901c78a-8f6f-4af7-8fbe-e0e15dea0b6c",
98    "metadata": {},
99    "outputs": [],
100    "source": []
101   }
102  ],
103  "metadata": {
104   "kernelspec": {
105    "display_name": "Python 3 (ipykernel)",
106    "language": "python",
107    "name": "python3"
108   },
109   "language_info": {
110    "codemirror_mode": {
111     "name": "ipython",
112     "version": 3
113    },
114    "file_extension": ".py",
115    "mimetype": "text/x-python",
116    "name": "python",
117    "nbconvert_exporter": "python",
118    "pygments_lexer": "ipython3",
119    "version": "3.12.5"
120   }
121  },
122  "nbformat": 4,
123  "nbformat_minor": 5