fmda_rnn_rain.ipynb check 5 ok
[notebooks.git] / fmda / test-plk2train.ipynb
blob83b3e9c09fe6a45d178e024f92d83934cdbedb61
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, logging_setup\n",
11     "import pickle\n",
12     "import logging\n",
13     "import os.path as osp\n",
14     "from moisture_rnn_pkl import pkl2train, run_rnn_pkl\n",
15     "from moisture_rnn import create_rnn_data_2 "
16    ]
17   },
18   {
19    "cell_type": "code",
20    "execution_count": null,
21    "id": "17db9b90-a931-4674-a447-5b8ffbcdc86a",
22    "metadata": {},
23    "outputs": [],
24    "source": [
25     "logging_setup()"
26    ]
27   },
28   {
29    "cell_type": "code",
30    "execution_count": null,
31    "id": "89e3ab9c-dfe0-4327-9ef6-0cd6f7afe1d4",
32    "metadata": {},
33    "outputs": [],
34    "source": [
35     "file_names=['test_NW_202401.pkl','test_CA_202401.pkl']\n",
36     "file_dir='data'"
37    ]
38   },
39   {
40    "cell_type": "code",
41    "execution_count": null,
42    "id": "70e99786-05b3-47a8-b305-31571babd46b",
43    "metadata": {},
44    "outputs": [],
45    "source": [
46     "# osp.join works on windows too, joins paths using \\ or /\n",
47     "file_paths = [osp.join(file_dir,file_name) for file_name in file_names]  "
48    ]
49   },
50   {
51    "cell_type": "code",
52    "execution_count": null,
53    "id": "4924a95d-e735-4f2a-9102-54dd3f9b5520",
54    "metadata": {},
55    "outputs": [],
56    "source": [
57     "# train = pkl2train(file_paths)"
58    ]
59   },
60   {
61    "cell_type": "code",
62    "execution_count": null,
63    "id": "57c9dbea-d033-4eb1-b38e-2bbba6980b92",
64    "metadata": {},
65    "outputs": [],
66    "source": [
67     "with open('train.pkl','rb') as file:\n",
68     "    train=pickle.load(file)"
69    ]
70   },
71   {
72    "cell_type": "code",
73    "execution_count": null,
74    "id": "62e31f16-d887-4552-bc2b-6024992c0a0b",
75    "metadata": {},
76    "outputs": [],
77    "source": [
78     "# print_dict_summary(train)"
79    ]
80   },
81   {
82    "cell_type": "code",
83    "execution_count": null,
84    "id": "698df86b-8550-4135-81df-45dbf503dd4e",
85    "metadata": {},
86    "outputs": [],
87    "source": [
88     "from module_param_sets import param_sets"
89    ]
90   },
91   {
92    "cell_type": "code",
93    "execution_count": null,
94    "id": "4b0c9a9b-dd02-4251-aa4a-2acc1101e153",
95    "metadata": {},
96    "outputs": [],
97    "source": [
98     "param_sets_keys=['1']"
99    ]
100   },
101   {
102    "cell_type": "code",
103    "execution_count": null,
104    "id": "6b7ce5c3-4b6b-4fd4-9eb1-858318415270",
105    "metadata": {},
106    "outputs": [],
107    "source": [
108     "cases=[list(train.keys())[0]]"
109    ]
110   },
111   {
112    "cell_type": "code",
113    "execution_count": null,
114    "id": "dd22baf2-59d2-460e-8c47-b20116dd5982",
115    "metadata": {},
116    "outputs": [],
117    "source": [
118     "logging.info('Running over parameter sets %s',param_sets_keys)\n",
119     "logging.info('Running over cases %s',cases)"
120    ]
121   },
122   {
123    "cell_type": "code",
124    "execution_count": null,
125    "id": "dc5b47bd-4fbc-44b8-b2dd-d118e068b450",
126    "metadata": {},
127    "outputs": [],
128    "source": [
129     "for i in param_sets_keys:\n",
130     "    for case in cases:\n",
131     "        run_rnn_pkl(train[case],param_sets[i])"
132    ]
133   },
134   {
135    "cell_type": "code",
136    "execution_count": null,
137    "id": "15384e4d-b8ec-4700-bdc2-83b0433d11c9",
138    "metadata": {},
139    "outputs": [],
140    "source": [
141     "logging.info('test-plk2train.ipynb done')"
142    ]
143   }
144  ],
145  "metadata": {
146   "kernelspec": {
147    "display_name": "Python 3 (ipykernel)",
148    "language": "python",
149    "name": "python3"
150   },
151   "language_info": {
152    "codemirror_mode": {
153     "name": "ipython",
154     "version": 3
155    },
156    "file_extension": ".py",
157    "mimetype": "text/x-python",
158    "name": "python",
159    "nbconvert_exporter": "python",
160    "pygments_lexer": "ipython3",
161    "version": "3.10.9"
162   }
163  },
164  "nbformat": 4,
165  "nbformat_minor": 5