===================================== Analysis of daily maximum temperature ===================================== This page provides how to **calculate daily maximum temperature** and plot using Python. Calculated daily maximum/minimum data ------------------------------------- The first step is to read `the CSV data `__. .. literalinclude:: programs/read_files.py :language: python :lines: 95-99 The 'indir' is the data's directory, and the 'filename' is the file name. We decline the missing value as 'NAN' in the read module. Compute the daily maximum ~~~~~~~~~~~~~~~~~~~~~~~~~ The daily maximum can be calculated from hourly or 5-minutes data using the resample.max() function. .. literalinclude:: programs/cal_plot.tmax.py :language: python :lines: 106-109 :emphasize-lines: 3 Here, tlabel is 'TIMESTAMP', and resample('1D',on=tlabel) is resampling with 1-day time-series data. An effective plot of time-series data for several years ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Reshape the one-dimensional dataset, dat(time), to the two-dimensional data, dat(year,days). .. literalinclude:: programs/cal_plot.tmax.py :language: python :lines: 121-128 :emphasize-lines: 8 .. literalinclude:: programs/cal_plot.tmax.py :language: python :lines: 25-35 Let's plot the data every year with different marker colors. .. literalinclude:: programs/cal_plot.tmax.py :language: python :lines: 130-153 :emphasize-lines: 18 .. image:: ../../images/TAIR1.beaver.png :width: 300 Source file: :download:`cal_plot.tmax.py <../../programs/cal_plot.tmax.py>`