Create Batch Reset Hyperparameter tutorial notebook
[notebooks.git] / fmda / data_test.ipynb
blob6ccb260b0c0a9afd85a81cd71937ce55ad81ddc2
2  "cells": [
3   {
4    "cell_type": "code",
5    "execution_count": null,
6    "id": "761f5ca8-5ec1-4eda-a5ce-03207275819a",
7    "metadata": {},
8    "outputs": [],
9    "source": [
10     "import data_funcs as datf\n",
11     "from data_funcs import format_raws, retrieve_raws, format_precip, fixnan, load_and_fix_data\n",
12     "from data_funcs import raws_data, synthetic_data, plot_data, check_data, rmse_data, to_json, from_json\n",
13     "from utils import print_dict_summary"
14    ]
15   },
16   {
17    "cell_type": "code",
18    "execution_count": null,
19    "id": "3184b2a0-0049-4964-9b1c-d88b9634f55c",
20    "metadata": {},
21    "outputs": [],
22    "source": [
23     "dict_file='data/testing_dict.pickle' # input path of FMDA dictionaries\n",
24     "dict_dir='fmda_data_dicts' # input path of FMDA dictionaries"
25    ]
26   },
27   {
28    "cell_type": "code",
29    "execution_count": null,
30    "id": "760e93a5-e347-4ca2-8072-a2ef830e15a3",
31    "metadata": {},
32    "outputs": [],
33    "source": [
34     "d=load_and_fix_data(dict_file)"
35    ]
36   },
37   {
38    "cell_type": "code",
39    "execution_count": null,
40    "id": "b6581fab-1cf4-4a8e-96f1-605f13b45e80",
41    "metadata": {},
42    "outputs": [],
43    "source": [
44     "import os\n",
45     "for file in [path for path in os.listdir(dict_dir) if path.endswith('pickle')]:\n",
46     "    filename = os.path.join(dict_dir,os.fsdecode(file))\n",
47     "    print(filename)\n",
48     "    d=load_and_fix_data(dict_file)\n",
49     "    print_dict_summary(d)"
50    ]
51   },
52   {
53    "cell_type": "code",
54    "execution_count": null,
55    "id": "2f446888-2344-4db6-907f-aa258d6561eb",
56    "metadata": {},
57    "outputs": [],
58    "source": [
59     "## misc tests"
60    ]
61   },
62   {
63    "cell_type": "code",
64    "execution_count": null,
65    "id": "c679ac3d-b9de-4398-9312-94bcd27b3592",
66    "metadata": {},
67    "outputs": [],
68    "source": [
69     "long = -100\n",
70     "lat = 40\n",
71     "query = ('https://api.open-elevation.com/api/v1/lookup'  f'?locations={lat},{long}')"
72    ]
73   },
74   {
75    "cell_type": "code",
76    "execution_count": null,
77    "id": "4287e2a5-debf-4b50-bf62-9f9ffcfea544",
78    "metadata": {},
79    "outputs": [],
80    "source": [
81     "query"
82    ]
83   },
84   {
85    "cell_type": "code",
86    "execution_count": null,
87    "id": "38eab8f1-aab5-429b-986d-0b86e7e8045b",
88    "metadata": {},
89    "outputs": [],
90    "source": [
91     "import requests\n",
92     "r = requests.get(query).json() "
93    ]
94   },
95   {
96    "cell_type": "code",
97    "execution_count": null,
98    "id": "db90180f-e229-4d2e-82bc-bef7743f1ff4",
99    "metadata": {},
100    "outputs": [],
101    "source": [
102     "r"
103    ]
104   },
105   {
106    "cell_type": "code",
107    "execution_count": null,
108    "id": "81bb5466-e2e7-4541-9b4a-0166d6411e68",
109    "metadata": {},
110    "outputs": [],
111    "source": [
112     "e=r['results'][0]['elevation']"
113    ]
114   },
115   {
116    "cell_type": "code",
117    "execution_count": null,
118    "id": "a2d1bc08-649f-4e65-9d9b-dcd04d3dd440",
119    "metadata": {},
120    "outputs": [],
121    "source": [
122     "type(e)"
123    ]
124   },
125   {
126    "cell_type": "code",
127    "execution_count": null,
128    "id": "32687b73-a1c7-42d1-8806-c292512af36c",
129    "metadata": {},
130    "outputs": [],
131    "source": []
132   }
133  ],
134  "metadata": {
135   "kernelspec": {
136    "display_name": "Python 3 (ipykernel)",
137    "language": "python",
138    "name": "python3"
139   },
140   "language_info": {
141    "codemirror_mode": {
142     "name": "ipython",
143     "version": 3
144    },
145    "file_extension": ".py",
146    "mimetype": "text/x-python",
147    "name": "python",
148    "nbconvert_exporter": "python",
149    "pygments_lexer": "ipython3",
150    "version": "3.10.9"
151   }
152  },
153  "nbformat": 4,
154  "nbformat_minor": 5