4 "cell_type": "markdown",
9 "### Python exercise - accessing weather station data by API, plus using dictionaries and jsons ###\n",
10 "See the [wrfxpy](https://github.com/openwfm/wrfxpy/blob/e5fa3fd5d67b4c3db493033f4940eda650ddc867/src/fmda/fuel_moisture_da.py#L124) code for a full version"
14 "cell_type": "markdown",
19 "First, make the API available"
31 "output_type": "stream",
33 "Collecting MesoPy\n",
34 " Using cached MesoPy-2.0.3.tar.gz (7.2 kB)\n",
35 "Building wheels for collected packages: MesoPy\n",
36 " Building wheel for MesoPy (setup.py) ... \u001b[?25ldone\n",
37 "\u001b[?25h Created wheel for MesoPy: filename=MesoPy-2.0.3-py3-none-any.whl size=7793 sha256=9bfc494f18d1ac50e9a6c2eccbd4ac5b0ebd4f9178898e77988b3883e25feed4\n",
38 " Stored in directory: /Users/jmandel/Library/Caches/pip/wheels/7f/80/61/2ee3a120b67e51c9355a931f83649887ae5fb349a4a996f1a1\n",
39 "Successfully built MesoPy\n",
40 "Installing collected packages: MesoPy\n",
41 "Successfully installed MesoPy-2.0.3\n"
46 "!pip install MesoPy\n",
47 "from MesoPy import Meso"
51 "cell_type": "markdown",
56 "Specify the time interval and the bounding box to get the data from: "
67 "time_start = \"202006010800\" # June 1 2020 08:00 in format yyyymmddHHMM \n",
68 "time_end = \"202006010900\" # June 1 2020 09:00 in format yyyymmddHHMM \n",
69 "bounding_box = \"-115, 38, -110, 40\" # min longtitude, latitude\n"
73 "cell_type": "markdown",
89 "meso_token=\"b40cb52cbdef43ef81329b84e8fd874f\" # you should get your own if you do more of this\n",
90 "m = Meso(meso_token) # create a Meso object\n",
91 "meso_obss = m.timeseries(time_start, time_end, bbox=bounding_box, showemptystations = '0', vars='fuel_moisture') # ask the object for data"
95 "cell_type": "markdown",
105 "execution_count": 4,
112 "output_type": "stream",
114 "{'UNITS': {'position': 'ft', 'fuel_moisture': 'gm', 'elevation': 'ft'}, 'QC_SUMMARY': {'QC_CHECKS_APPLIED': ['sl_range_check'], 'TOTAL_OBSERVATIONS_FLAGGED': 0.0, 'PERCENT_OF_TOTAL_OBSERVATIONS_FLAGGED': 0.0}, 'STATION': [{'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '1997-01-01T00:00:00Z', 'end': '2021-10-23T19:27:00Z'}, 'ELEVATION': '6493', 'NAME': 'BLACK CEDAR', 'STID': 'BKCU1', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '6499.3', 'LONGITUDE': '-112.238864', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:27:00Z'], 'fuel_moisture_set_1': [4.5]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '38.979242', 'TIMEZONE': 'America/Denver', 'ID': '2328'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '1998-07-30T00:00:00Z', 'end': '2021-10-23T19:12:00Z'}, 'ELEVATION': '8530', 'NAME': 'HORSE RIDGE', 'STID': 'HSRU1', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8517.1', 'LONGITUDE': '-110.861944', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:12:00Z'], 'fuel_moisture_set_1': [8.7]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.933889', 'TIMEZONE': 'America/Denver', 'ID': '2341'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '1997-01-01T00:00:00Z', 'end': '2021-10-23T19:16:00Z'}, 'ELEVATION': '8700', 'NAME': 'JOES VALLEY', 'STID': 'JVAU1', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8710.6', 'LONGITUDE': '-111.322778', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:16:00Z'], 'fuel_moisture_set_1': [7.4]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.309444', 'TIMEZONE': 'America/Denver', 'ID': '2343'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '2002-03-27T00:00:00Z', 'end': '2021-10-12T23:12:00Z'}, 'ELEVATION': '8625', 'NAME': 'H-T PORTABLE #3', 'STID': 'TR421', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8638.5', 'LONGITUDE': '-114.669417', 'STATE': 'NV', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:12:00Z'], 'fuel_moisture_set_1': [5.0]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.603583', 'TIMEZONE': 'America/Los_Angeles', 'ID': '3747'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '2004-09-10T00:00:00Z', 'end': '2021-10-23T19:45:00Z'}, 'ELEVATION': '8112', 'NAME': 'ROCKY QD', 'STID': 'TS305', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8123.4', 'LONGITUDE': '-110.950000', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:45:00Z'], 'fuel_moisture_set_1': [10.4]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.851083', 'TIMEZONE': 'America/Denver', 'ID': '11224'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '2013-02-20T00:00:00Z', 'end': '2021-10-23T19:22:00Z'}, 'ELEVATION': '5790', 'NAME': 'FISHLAKE D1 PT #1', 'STID': 'TT156', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '5872.7', 'LONGITUDE': '-112.271383', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:22:00Z'], 'fuel_moisture_set_1': [4.3]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '38.941717', 'TIMEZONE': 'America/Denver', 'ID': '34260'}], 'SUMMARY': {'DATA_QUERY_TIME': '315.973997116 ms', 'RESPONSE_CODE': 1, 'RESPONSE_MESSAGE': 'OK', 'METADATA_RESPONSE_TIME': '105.997085571 ms', 'DATA_PARSING_TIME': '2.4139881134 ms', 'TOTAL_DATA_TIME': '318.388938904 ms', 'NUMBER_OF_OBJECTS': 6, 'FUNCTION_USED': 'time_data_parser'}}\n"
123 "cell_type": "markdown",
128 "This long line does not look very good! But we see the structure: { key: value, key: value,...}. It is a **dictionary**. The value can be a dictionary itself, or a list, or some other kind of object. \n",
129 "First let's see if we can pretty print the dictionary in a more human friendly form: "
134 "execution_count": 5,
141 "output_type": "stream",
145 " \"position\": \"ft\",\n",
146 " \"fuel_moisture\": \"gm\",\n",
147 " \"elevation\": \"ft\"\n",
149 " \"QC_SUMMARY\": {\n",
150 " \"QC_CHECKS_APPLIED\": [\n",
151 " \"sl_range_check\"\n",
153 " \"TOTAL_OBSERVATIONS_FLAGGED\": 0.0,\n",
154 " \"PERCENT_OF_TOTAL_OBSERVATIONS_FLAGGED\": 0.0\n",
158 " \"STATUS\": \"ACTIVE\",\n",
159 " \"MNET_ID\": \"2\",\n",
160 " \"PERIOD_OF_RECORD\": {\n",
161 " \"start\": \"1997-01-01T00:00:00Z\",\n",
162 " \"end\": \"2021-10-23T19:27:00Z\"\n",
164 " \"ELEVATION\": \"6493\",\n",
165 " \"NAME\": \"BLACK CEDAR\",\n",
166 " \"STID\": \"BKCU1\",\n",
167 " \"SENSOR_VARIABLES\": {\n",
168 " \"date_time\": {\n",
169 " \"date_time\": {}\n",
171 " \"fuel_moisture\": {\n",
172 " \"fuel_moisture_set_1\": {\n",
173 " \"position\": \"0.98\"\n",
177 " \"ELEV_DEM\": \"6499.3\",\n",
178 " \"LONGITUDE\": \"-112.238864\",\n",
179 " \"STATE\": \"UT\",\n",
180 " \"OBSERVATIONS\": {\n",
181 " \"date_time\": [\n",
182 " \"2020-06-01T08:27:00Z\"\n",
184 " \"fuel_moisture_set_1\": [\n",
188 " \"RESTRICTED\": false,\n",
189 " \"QC_FLAGGED\": false,\n",
190 " \"LATITUDE\": \"38.979242\",\n",
191 " \"TIMEZONE\": \"America/Denver\",\n",
192 " \"ID\": \"2328\"\n",
195 " \"STATUS\": \"ACTIVE\",\n",
196 " \"MNET_ID\": \"2\",\n",
197 " \"PERIOD_OF_RECORD\": {\n",
198 " \"start\": \"1998-07-30T00:00:00Z\",\n",
199 " \"end\": \"2021-10-23T19:12:00Z\"\n",
201 " \"ELEVATION\": \"8530\",\n",
202 " \"NAME\": \"HORSE RIDGE\",\n",
203 " \"STID\": \"HSRU1\",\n",
204 " \"SENSOR_VARIABLES\": {\n",
205 " \"date_time\": {\n",
206 " \"date_time\": {}\n",
208 " \"fuel_moisture\": {\n",
209 " \"fuel_moisture_set_1\": {\n",
210 " \"position\": \"0.98\"\n",
214 " \"ELEV_DEM\": \"8517.1\",\n",
215 " \"LONGITUDE\": \"-110.861944\",\n",
216 " \"STATE\": \"UT\",\n",
217 " \"OBSERVATIONS\": {\n",
218 " \"date_time\": [\n",
219 " \"2020-06-01T08:12:00Z\"\n",
221 " \"fuel_moisture_set_1\": [\n",
225 " \"RESTRICTED\": false,\n",
226 " \"QC_FLAGGED\": false,\n",
227 " \"LATITUDE\": \"39.933889\",\n",
228 " \"TIMEZONE\": \"America/Denver\",\n",
229 " \"ID\": \"2341\"\n",
232 " \"STATUS\": \"ACTIVE\",\n",
233 " \"MNET_ID\": \"2\",\n",
234 " \"PERIOD_OF_RECORD\": {\n",
235 " \"start\": \"1997-01-01T00:00:00Z\",\n",
236 " \"end\": \"2021-10-23T19:16:00Z\"\n",
238 " \"ELEVATION\": \"8700\",\n",
239 " \"NAME\": \"JOES VALLEY\",\n",
240 " \"STID\": \"JVAU1\",\n",
241 " \"SENSOR_VARIABLES\": {\n",
242 " \"date_time\": {\n",
243 " \"date_time\": {}\n",
245 " \"fuel_moisture\": {\n",
246 " \"fuel_moisture_set_1\": {\n",
247 " \"position\": \"0.98\"\n",
251 " \"ELEV_DEM\": \"8710.6\",\n",
252 " \"LONGITUDE\": \"-111.322778\",\n",
253 " \"STATE\": \"UT\",\n",
254 " \"OBSERVATIONS\": {\n",
255 " \"date_time\": [\n",
256 " \"2020-06-01T08:16:00Z\"\n",
258 " \"fuel_moisture_set_1\": [\n",
262 " \"RESTRICTED\": false,\n",
263 " \"QC_FLAGGED\": false,\n",
264 " \"LATITUDE\": \"39.309444\",\n",
265 " \"TIMEZONE\": \"America/Denver\",\n",
266 " \"ID\": \"2343\"\n",
269 " \"STATUS\": \"ACTIVE\",\n",
270 " \"MNET_ID\": \"2\",\n",
271 " \"PERIOD_OF_RECORD\": {\n",
272 " \"start\": \"2002-03-27T00:00:00Z\",\n",
273 " \"end\": \"2021-10-12T23:12:00Z\"\n",
275 " \"ELEVATION\": \"8625\",\n",
276 " \"NAME\": \"H-T PORTABLE #3\",\n",
277 " \"STID\": \"TR421\",\n",
278 " \"SENSOR_VARIABLES\": {\n",
279 " \"date_time\": {\n",
280 " \"date_time\": {}\n",
282 " \"fuel_moisture\": {\n",
283 " \"fuel_moisture_set_1\": {\n",
284 " \"position\": \"0.98\"\n",
288 " \"ELEV_DEM\": \"8638.5\",\n",
289 " \"LONGITUDE\": \"-114.669417\",\n",
290 " \"STATE\": \"NV\",\n",
291 " \"OBSERVATIONS\": {\n",
292 " \"date_time\": [\n",
293 " \"2020-06-01T08:12:00Z\"\n",
295 " \"fuel_moisture_set_1\": [\n",
299 " \"RESTRICTED\": false,\n",
300 " \"QC_FLAGGED\": false,\n",
301 " \"LATITUDE\": \"39.603583\",\n",
302 " \"TIMEZONE\": \"America/Los_Angeles\",\n",
303 " \"ID\": \"3747\"\n",
306 " \"STATUS\": \"ACTIVE\",\n",
307 " \"MNET_ID\": \"2\",\n",
308 " \"PERIOD_OF_RECORD\": {\n",
309 " \"start\": \"2004-09-10T00:00:00Z\",\n",
310 " \"end\": \"2021-10-23T19:45:00Z\"\n",
312 " \"ELEVATION\": \"8112\",\n",
313 " \"NAME\": \"ROCKY QD\",\n",
314 " \"STID\": \"TS305\",\n",
315 " \"SENSOR_VARIABLES\": {\n",
316 " \"date_time\": {\n",
317 " \"date_time\": {}\n",
319 " \"fuel_moisture\": {\n",
320 " \"fuel_moisture_set_1\": {\n",
321 " \"position\": \"0.98\"\n",
325 " \"ELEV_DEM\": \"8123.4\",\n",
326 " \"LONGITUDE\": \"-110.950000\",\n",
327 " \"STATE\": \"UT\",\n",
328 " \"OBSERVATIONS\": {\n",
329 " \"date_time\": [\n",
330 " \"2020-06-01T08:45:00Z\"\n",
332 " \"fuel_moisture_set_1\": [\n",
336 " \"RESTRICTED\": false,\n",
337 " \"QC_FLAGGED\": false,\n",
338 " \"LATITUDE\": \"39.851083\",\n",
339 " \"TIMEZONE\": \"America/Denver\",\n",
340 " \"ID\": \"11224\"\n",
343 " \"STATUS\": \"ACTIVE\",\n",
344 " \"MNET_ID\": \"2\",\n",
345 " \"PERIOD_OF_RECORD\": {\n",
346 " \"start\": \"2013-02-20T00:00:00Z\",\n",
347 " \"end\": \"2021-10-23T19:22:00Z\"\n",
349 " \"ELEVATION\": \"5790\",\n",
350 " \"NAME\": \"FISHLAKE D1 PT #1\",\n",
351 " \"STID\": \"TT156\",\n",
352 " \"SENSOR_VARIABLES\": {\n",
353 " \"date_time\": {\n",
354 " \"date_time\": {}\n",
356 " \"fuel_moisture\": {\n",
357 " \"fuel_moisture_set_1\": {\n",
358 " \"position\": \"0.98\"\n",
362 " \"ELEV_DEM\": \"5872.7\",\n",
363 " \"LONGITUDE\": \"-112.271383\",\n",
364 " \"STATE\": \"UT\",\n",
365 " \"OBSERVATIONS\": {\n",
366 " \"date_time\": [\n",
367 " \"2020-06-01T08:22:00Z\"\n",
369 " \"fuel_moisture_set_1\": [\n",
373 " \"RESTRICTED\": false,\n",
374 " \"QC_FLAGGED\": false,\n",
375 " \"LATITUDE\": \"38.941717\",\n",
376 " \"TIMEZONE\": \"America/Denver\",\n",
377 " \"ID\": \"34260\"\n",
381 " \"DATA_QUERY_TIME\": \"315.973997116 ms\",\n",
382 " \"RESPONSE_CODE\": 1,\n",
383 " \"RESPONSE_MESSAGE\": \"OK\",\n",
384 " \"METADATA_RESPONSE_TIME\": \"105.997085571 ms\",\n",
385 " \"DATA_PARSING_TIME\": \"2.4139881134 ms\",\n",
386 " \"TOTAL_DATA_TIME\": \"318.388938904 ms\",\n",
387 " \"NUMBER_OF_OBJECTS\": 6,\n",
388 " \"FUNCTION_USED\": \"time_data_parser\"\n",
396 "print(json.dumps(meso_obss, indent=4))\n"
400 "cell_type": "markdown",
405 "Scrolling to the top, we see key \"STATION\". Try to retrieve its value:"
410 "execution_count": 6,
417 "output_type": "stream",
419 "[{'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '1997-01-01T00:00:00Z', 'end': '2021-10-23T19:27:00Z'}, 'ELEVATION': '6493', 'NAME': 'BLACK CEDAR', 'STID': 'BKCU1', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '6499.3', 'LONGITUDE': '-112.238864', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:27:00Z'], 'fuel_moisture_set_1': [4.5]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '38.979242', 'TIMEZONE': 'America/Denver', 'ID': '2328'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '1998-07-30T00:00:00Z', 'end': '2021-10-23T19:12:00Z'}, 'ELEVATION': '8530', 'NAME': 'HORSE RIDGE', 'STID': 'HSRU1', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8517.1', 'LONGITUDE': '-110.861944', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:12:00Z'], 'fuel_moisture_set_1': [8.7]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.933889', 'TIMEZONE': 'America/Denver', 'ID': '2341'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '1997-01-01T00:00:00Z', 'end': '2021-10-23T19:16:00Z'}, 'ELEVATION': '8700', 'NAME': 'JOES VALLEY', 'STID': 'JVAU1', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8710.6', 'LONGITUDE': '-111.322778', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:16:00Z'], 'fuel_moisture_set_1': [7.4]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.309444', 'TIMEZONE': 'America/Denver', 'ID': '2343'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '2002-03-27T00:00:00Z', 'end': '2021-10-12T23:12:00Z'}, 'ELEVATION': '8625', 'NAME': 'H-T PORTABLE #3', 'STID': 'TR421', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8638.5', 'LONGITUDE': '-114.669417', 'STATE': 'NV', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:12:00Z'], 'fuel_moisture_set_1': [5.0]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.603583', 'TIMEZONE': 'America/Los_Angeles', 'ID': '3747'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '2004-09-10T00:00:00Z', 'end': '2021-10-23T19:45:00Z'}, 'ELEVATION': '8112', 'NAME': 'ROCKY QD', 'STID': 'TS305', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '8123.4', 'LONGITUDE': '-110.950000', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:45:00Z'], 'fuel_moisture_set_1': [10.4]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '39.851083', 'TIMEZONE': 'America/Denver', 'ID': '11224'}, {'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '2013-02-20T00:00:00Z', 'end': '2021-10-23T19:22:00Z'}, 'ELEVATION': '5790', 'NAME': 'FISHLAKE D1 PT #1', 'STID': 'TT156', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '5872.7', 'LONGITUDE': '-112.271383', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:22:00Z'], 'fuel_moisture_set_1': [4.3]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '38.941717', 'TIMEZONE': 'America/Denver', 'ID': '34260'}]\n"
424 "stations=meso_obss['STATION']\n",
429 "cell_type": "markdown",
434 "This is a list. Its first item is:"
439 "execution_count": 9,
446 "output_type": "stream",
448 "{'STATUS': 'ACTIVE', 'MNET_ID': '2', 'PERIOD_OF_RECORD': {'start': '1997-01-01T00:00:00Z', 'end': '2021-10-23T19:27:00Z'}, 'ELEVATION': '6493', 'NAME': 'BLACK CEDAR', 'STID': 'BKCU1', 'SENSOR_VARIABLES': {'date_time': {'date_time': {}}, 'fuel_moisture': {'fuel_moisture_set_1': {'position': '0.98'}}}, 'ELEV_DEM': '6499.3', 'LONGITUDE': '-112.238864', 'STATE': 'UT', 'OBSERVATIONS': {'date_time': ['2020-06-01T08:27:00Z'], 'fuel_moisture_set_1': [4.5]}, 'RESTRICTED': False, 'QC_FLAGGED': False, 'LATITUDE': '38.979242', 'TIMEZONE': 'America/Denver', 'ID': '2328'}\n"
457 "cell_type": "markdown",
462 "Looks like a dictionary.\n",
463 "**Exercise: pretty print this dictionary using json.dumps like above** "
468 "execution_count": 10,
475 "output_type": "stream",
478 " \"STATUS\": \"ACTIVE\",\n",
479 " \"MNET_ID\": \"2\",\n",
480 " \"PERIOD_OF_RECORD\": {\n",
481 " \"start\": \"1997-01-01T00:00:00Z\",\n",
482 " \"end\": \"2021-10-23T19:27:00Z\"\n",
484 " \"ELEVATION\": \"6493\",\n",
485 " \"NAME\": \"BLACK CEDAR\",\n",
486 " \"STID\": \"BKCU1\",\n",
487 " \"SENSOR_VARIABLES\": {\n",
488 " \"date_time\": {\n",
489 " \"date_time\": {}\n",
491 " \"fuel_moisture\": {\n",
492 " \"fuel_moisture_set_1\": {\n",
493 " \"position\": \"0.98\"\n",
497 " \"ELEV_DEM\": \"6499.3\",\n",
498 " \"LONGITUDE\": \"-112.238864\",\n",
499 " \"STATE\": \"UT\",\n",
500 " \"OBSERVATIONS\": {\n",
501 " \"date_time\": [\n",
502 " \"2020-06-01T08:27:00Z\"\n",
504 " \"fuel_moisture_set_1\": [\n",
508 " \"RESTRICTED\": false,\n",
509 " \"QC_FLAGGED\": false,\n",
510 " \"LATITUDE\": \"38.979242\",\n",
511 " \"TIMEZONE\": \"America/Denver\",\n",
512 " \"ID\": \"2328\"\n",
518 "print(json.dumps(stations[0], indent=4))"
523 "execution_count": null,
531 "collapsed_sections": [],
532 "name": "04-mesowest_demo.ipynb",
536 "display_name": "Python 3",
537 "language": "python",
545 "file_extension": ".py",
546 "mimetype": "text/x-python",
548 "nbconvert_exporter": "python",
549 "pygments_lexer": "ipython3",