Update moisture_rnn.py
[notebooks.git] / fmda / OLD / test-pkl.ipynb
blobf548ebe869556efd30afff56c392bde96dc80224
2  "cells": [
3   {
4    "cell_type": "code",
5    "execution_count": null,
6    "id": "83cc1dc4-3dcb-4325-9263-58101a3dc378",
7    "metadata": {},
8    "outputs": [],
9    "source": [
10     "from utils import print_dict_summary, print_first, str2time\n",
11     "import pickle\n",
12     "import os.path as osp"
13    ]
14   },
15   {
16    "cell_type": "code",
17    "execution_count": null,
18    "id": "89e3ab9c-dfe0-4327-9ef6-0cd6f7afe1d4",
19    "metadata": {},
20    "outputs": [],
21    "source": [
22     "file_name='test_NW_202401.pkl'\n",
23     "file_dir='data'"
24    ]
25   },
26   {
27    "cell_type": "code",
28    "execution_count": null,
29    "id": "e0eea49b-bc80-4be0-9977-af5851d3256f",
30    "metadata": {},
31    "outputs": [],
32    "source": [
33     "file_name='test_CA_202401.pkl'\n",
34     "file_dir='data'"
35    ]
36   },
37   {
38    "cell_type": "code",
39    "execution_count": null,
40    "id": "70e99786-05b3-47a8-b305-31571babd46b",
41    "metadata": {},
42    "outputs": [],
43    "source": [
44     "file_path = osp.join(file_dir,file_name)"
45    ]
46   },
47   {
48    "cell_type": "code",
49    "execution_count": null,
50    "id": "0ea76be6-0a45-49ea-b14c-903304890a81",
51    "metadata": {},
52    "outputs": [],
53    "source": [
54     "with open(file_path, 'rb') as file:\n",
55     "    dict = pickle.load(file)"
56    ]
57   },
58   {
59    "cell_type": "code",
60    "execution_count": null,
61    "id": "3c92d66b-6ab9-43b4-865a-7a8584e19179",
62    "metadata": {},
63    "outputs": [],
64    "source": [
65     "i=list(dict.keys())\n",
66     "print_first(i)"
67    ]
68   },
69   {
70    "cell_type": "code",
71    "execution_count": null,
72    "id": "c65dca54-72f5-4121-9f37-89b8fa1f8351",
73    "metadata": {},
74    "outputs": [],
75    "source": [
76     "first_key = next(iter(dict))\n",
77     "print(first_key)\n",
78     "times=dict[first_key]['RAWS']['time']\n",
79     "print_first(times)\n",
80     "times=list(times)"
81    ]
82   },
83   {
84    "cell_type": "code",
85    "execution_count": null,
86    "id": "3fcc24dd-364a-45c1-ae41-16b0c048a9a5",
87    "metadata": {},
88    "outputs": [],
89    "source": [
90     "dict[first_key]['HRRR']['f01']['descr']"
91    ]
92   },
93   {
94    "cell_type": "code",
95    "execution_count": null,
96    "id": "286d472f-0805-4166-880c-5ac9fa8a61b4",
97    "metadata": {},
98    "outputs": [],
99    "source": [
100     "timed=str2time(times)\n",
101     "print_first(timed)"
102    ]
103   },
104   {
105    "cell_type": "code",
106    "execution_count": null,
107    "id": "b5a6b407-5872-46f9-8823-25c7a9803b9b",
108    "metadata": {},
109    "outputs": [],
110    "source": [
111     "print_dict_summary(dict,first=['time','time_raws'],first_num=5)"
112    ]
113   },
114   {
115    "cell_type": "code",
116    "execution_count": null,
117    "id": "c2d62d94-f906-4a7d-950a-b616f3b6cb55",
118    "metadata": {},
119    "outputs": [],
120    "source": []
121   },
122   {
123    "cell_type": "code",
124    "execution_count": null,
125    "id": "490e700d-30e9-4b38-993f-edd59edf6f54",
126    "metadata": {},
127    "outputs": [],
128    "source": []
129   },
130   {
131    "cell_type": "code",
132    "execution_count": null,
133    "id": "2e876b3e-3839-4912-bf63-d56b8ea66b14",
134    "metadata": {},
135    "outputs": [],
136    "source": []
137   }
138  ],
139  "metadata": {
140   "kernelspec": {
141    "display_name": "Python 3 (ipykernel)",
142    "language": "python",
143    "name": "python3"
144   },
145   "language_info": {
146    "codemirror_mode": {
147     "name": "ipython",
148     "version": 3
149    },
150    "file_extension": ".py",
151    "mimetype": "text/x-python",
152    "name": "python",
153    "nbconvert_exporter": "python",
154    "pygments_lexer": "ipython3",
155    "version": "3.9.12"
156   }
157  },
158  "nbformat": 4,
159  "nbformat_minor": 5