{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Precipitation\n", "\n", "An introduction to Synoptic's Precipitation service using SynopticPy." ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "from datetime import datetime, timedelta\n", "\n", "import matplotlib.dates as mdates\n", "import matplotlib.pyplot as plt\n", "import polars as pl\n", "\n", "from synoptic.services import Precipitation" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Daily Precipitation\n", "\n", "Let's get the daily precipitation at a single station for August 2024 and plot the daily accumulation with a running total for the month." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "🚚💨 Speedy delivery from Synoptic's \u001b[32mprecipitation\u001b[0m service.\n", "📦 Received data from 1 stations.\n" ] }, { "data": { "text/html": [ "
| total | first_report | last_report | count | interval | report_type | units | id | stid | name | elevation | latitude | longitude | mnet_id | state | timezone | elev_dem | period_of_record | is_restricted | is_active | cum_sum |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| f64 | datetime[μs, UTC] | datetime[μs, UTC] | i64 | i64 | str | str | u32 | str | str | f64 | f64 | f64 | u32 | str | str | f64 | struct[2] | bool | bool | f64 |
| 0.0 | 2024-08-01 00:00:00 UTC | 2024-08-02 00:00:00 UTC | 1440 | 1 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 0.0 |
| 0.0 | 2024-08-02 00:00:00 UTC | 2024-08-03 00:00:00 UTC | 1440 | 2 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 0.0 |
| 0.0 | 2024-08-03 00:00:00 UTC | 2024-08-04 00:00:00 UTC | 1440 | 3 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 0.0 |
| 0.0 | 2024-08-04 00:00:00 UTC | 2024-08-05 00:00:00 UTC | 1440 | 4 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 0.0 |
| 0.0 | 2024-08-05 00:00:00 UTC | 2024-08-06 00:00:00 UTC | 1440 | 5 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 0.0 |
| … | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … | … |
| 0.0 | 2024-08-27 00:00:00 UTC | 2024-08-28 00:00:00 UTC | 1440 | 27 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 1.15 |
| 0.0 | 2024-08-28 00:00:00 UTC | 2024-08-29 00:00:00 UTC | 1406 | 28 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 1.15 |
| 0.0 | 2024-08-29 00:00:00 UTC | 2024-08-30 00:00:00 UTC | 1440 | 29 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 1.15 |
| 0.0 | 2024-08-30 00:00:00 UTC | 2024-08-31 00:00:00 UTC | 1440 | 30 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 1.15 |
| 0.0 | 2024-08-31 00:00:00 UTC | 2024-09-01 00:00:00 UTC | 1440 | 31 | "precip_accum_one_minute" | "Inches" | 1 | "WBB" | "U of U William Browning Buildi… | 4806.0 | 40.76623 | -111.84755 | 153 | "UT" | "America/Denver" | 4727.7 | {"1997-01-01T00:00:00Z","2024-11-11T22:55:00Z"} | false | true | 1.15 |
| total | first_report | last_report | count | report_type | units | id | stid | name | elevation | latitude | longitude | mnet_id | state | timezone | elev_dem | period_of_record | is_restricted | is_active |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| f64 | datetime[μs, UTC] | datetime[μs, UTC] | i64 | str | str | u32 | str | str | f64 | f64 | f64 | u32 | str | str | f64 | struct[2] | bool | bool |
| 1.1 | 2024-06-01 00:00:00 UTC | 2024-06-07 00:00:00 UTC | 144 | "precip_accum" | "Inches" | 1490 | "MCRU1" | "MONTE CRISTO" | 8931.0 | 41.46547 | -111.49688 | 25 | "UT" | "America/Denver" | 8950.1 | {"2000-01-20T00:00:00Z","2024-11-11T20:00:00Z"} | false | true |
| 1.43 | 2024-06-01 00:00:00 UTC | 2024-06-07 00:00:00 UTC | 576 | "precip_accum_fifteen_minute" | "Inches" | 72189 | "UCC42" | "Centerfield" | 5164.0 | 39.09943 | -111.8077 | 194 | "UT" | "America/Denver" | 5164.0 | {"2018-09-18T18:04:00Z","2024-11-11T22:00:00Z"} | false | true |
| 3.62 | 2024-06-01 00:00:00 UTC | 2024-06-07 00:00:00 UTC | 556 | "precip_accum" | "Inches" | 2957 | "BLKU1" | "BLACKS FORK COMMISSARY NEAR CO… | 8845.0 | 40.96083 | -110.57944 | 106 | "UT" | "America/Denver" | 8848.4 | {"2001-06-06T00:00:00Z","2024-11-11T22:00:00Z"} | false | true |