Update rnn_workshop.ipynb
[notebooks.git] / fmda / read_and_clean_tutorial.ipynb
blob5390d394be34a4b03e3a17d479853dd8358db695
2  "cells": [
3   {
4    "cell_type": "code",
5    "execution_count": null,
6    "id": "9ddd1d89-abdb-4627-a0ca-23db006b62f4",
7    "metadata": {},
8    "outputs": [],
9    "source": [
10     "import yaml\n",
11     "import pickle\n",
12     "import os.path as osp\n",
13     "import subprocess\n",
14     "from datetime import timedelta\n",
15     "from urllib.parse import urlparse\n",
16     "import numpy as np\n",
17     "import matplotlib.pyplot as plt\n",
18     "from moisture_rnn_pkl import pkl2train\n",
19     "import time\n",
20     "from utils import time_intp, str2time, filter_nan_values, read_pkl, read_yml, retrieve_url"
21    ]
22   },
23   {
24    "cell_type": "markdown",
25    "id": "609ea544-ed92-40a6-892b-1943e9f6f620",
26    "metadata": {},
27    "source": [
28     "## Setup"
29    ]
30   },
31   {
32    "cell_type": "code",
33    "execution_count": null,
34    "id": "41b0d403-7d6b-44f4-963f-8dc492ae0126",
35    "metadata": {},
36    "outputs": [],
37    "source": [
38     "retrieve_url(\"https://demo.openwfm.org/web/data/fmda/dicts/fmda_nw_202401-05_f05.pkl\", \"data/fmda_nw_202401-05_f05.pkl\")"
39    ]
40   },
41   {
42    "cell_type": "code",
43    "execution_count": null,
44    "id": "e69e37b9-73ef-45a1-9738-844f26dc3323",
45    "metadata": {},
46    "outputs": [],
47    "source": [
48     "data_params = read_yml(\"params_data.yaml\")\n",
49     "data_params"
50    ]
51   },
52   {
53    "cell_type": "code",
54    "execution_count": null,
55    "id": "6b5c3c82-84ba-426c-b8d9-f540b5026158",
56    "metadata": {},
57    "outputs": [],
58    "source": [
59     "# dat = read_pkl(\"data/test_CA_202401.pkl\")\n",
60     "dat = read_pkl(\"data/fmda_nw_202401-05_f05.pkl\")"
61    ]
62   },
63   {
64    "cell_type": "markdown",
65    "id": "8afeae74-217e-41e5-a140-fd4df30e8148",
66    "metadata": {},
67    "source": [
68     "## Format and Filter"
69    ]
70   },
71   {
72    "cell_type": "code",
73    "execution_count": null,
74    "id": "4003ced7-f08c-4cd3-a785-458c3588b235",
75    "metadata": {},
76    "outputs": [],
77    "source": [
78     "train_h = process_train_dict(\"data/test_CA_202401.pkl\", atm_dict=\"HRRR\", data_params=data_params)"
79    ]
80   },
81   {
82    "cell_type": "code",
83    "execution_count": null,
84    "id": "cf33ee50-1b05-4f11-90fb-9cccf355fdd6",
85    "metadata": {},
86    "outputs": [],
87    "source": [
88     "train_r = process_train_dict(\"data/test_CA_202401.pkl\", atm_dict=\"RAWS\", data_params=data_params)"
89    ]
90   },
91   {
92    "cell_type": "code",
93    "execution_count": null,
94    "id": "aa0eb65f-a680-4630-beff-c01dabca32aa",
95    "metadata": {},
96    "outputs": [],
97    "source": []
98   },
99   {
100    "cell_type": "code",
101    "execution_count": null,
102    "id": "c2f20f9c-9d9a-488e-81ae-9aef54253541",
103    "metadata": {},
104    "outputs": [],
105    "source": []
106   }
107  ],
108  "metadata": {
109   "kernelspec": {
110    "display_name": "Python 3 (ipykernel)",
111    "language": "python",
112    "name": "python3"
113   },
114   "language_info": {
115    "codemirror_mode": {
116     "name": "ipython",
117     "version": 3
118    },
119    "file_extension": ".py",
120    "mimetype": "text/x-python",
121    "name": "python",
122    "nbconvert_exporter": "python",
123    "pygments_lexer": "ipython3",
124    "version": "3.12.5"
125   }
126  },
127  "nbformat": 4,
128  "nbformat_minor": 5