<jupyter_start><jupyter_text>Multi-scale dataTo illustrate using Matplotlib to explore multi-scale data we will work with temperature time series.From NOAA we can look at the INTEGRATED SURFACE DATA data set (https://www.ncdc.noaa.gov/isd) which contains historical weather data from weather stations across the world.  Look at just the temperature aspect of this record we have a data set that has cyclic variations at 24 hours (day/night), random variation on the day-to-day, cyclic variaton at the year scale, and we can get time series on the decade scale. Some importsThe code to do the data processing required for this demo and the implementation are store in a .py file in this directory.<jupyter_code>%matplotlib widget
import matplotlib.pyplot as plt

from temperature_utils import *<jupyter_output><empty_output><jupyter_text>Load the dataWe have some pre-downloaded data for Ithaca and Central park in this repo.  Data from additional weather stations can be downlodad using the code in `99-get_data.py`.<jupyter_code>d = load_data('ithaca')
d<jupyter_output><empty_output><jupyter_text>Looking at the repr of the data frame we can can see we have just over 15 years worth of data.We can of course plot this directly from pandas via<jupyter_code>d.plot(y='T')
plt.figure(1).gca().get_xlim()
# snap shot for static version
plt.gcf()<jupyter_output><empty_output><jupyter_text>which clearly shows the yearly cycle.  On the other hand if we zoom in we can see the daily-cycle<jupyter_code>plt.gca().set_ylim(5, 35)
plt.gca().set_xlim(15123.66216414762, 15148.87407928016)
plt.gcf()<jupyter_output><empty_output><jupyter_text>However, this makes it difficult to look at compare between different months.  Either we are zoomed in closely enough to see the details but unable to see the broad trends, or be zoomed out enough to see the large variation but have the details all blur into a solid band.To explore this dataset a more effectively we can build a multi-scale viewer that will allow us to dig into finer grained data<jupyter_code>fig, (ax_by_month, ax_by_day, ax_by_hour) = setup_temperature_figure(figsize=(14, 6))
temperature_at = AggregatedTimeTrace(
    d, "ithaca", ax_by_month, ax_by_day, ax_by_hour
)
plt.show()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06669611307420495, 'fraction_numerical': 0.01987632508833922, 'mean_word_length': 5.642228739002933, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '448526', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 723, 'n_tokens_neox': 675, 'n_words': 286, 'path': 'code/temperture/temperature-explorer.ipynb', 'repo_name': 'tacaswell/2021-03_APS', 'size': '2264'}