Temperatures ============ We have a number of temperatures measured on different dates for a set of automatic weather stations from *Meteocat* (Meteorological Service of Catalonia - meteocat.cat). For example: .. literalinclude:: tpt_sumup-test.txt :language: python3 :start-after: --input-ini :end-before: --input-fi where we have two lists: - ``estL`` which is a list with the names of the station populations (:class:`str`) - ``tempL`` which is a list of lists where each sublist contains two components: - a :class:`str` with the date - a :class:`list` that contains a :class:`tuple` for each of the stations of ``estL`` and in the same order. This tuple contains three :class:`float` corresponding to the average, minimum and maximum temperatures measured on that date in that station. Implement the following function in the :mod:`tpt.py` module (file :file:`tpt.py`): .. py:function:: tpt_sumup(estL, tempL) such that **given** ``estL``, ``tempL`` which are :class:`list` as described above, **returns** a :class:`list` where, for each date of ``tempL`` contains a list with the following 4 data: - the date (:class:`str`) - the average temperature (:class:`float`) of the average temperatures of all stations, rounded to 2 decimal places - :class:`tuple`, with the minimum temperature of all minimums (:class:`float`) and the station the :class:`str` comes from. In the event that the minimum of the minimums has been given with more than one station, the first one that appears in the list must be returned. - the same for the maximum temperature. For example, given the input lists in the example above, the correct list to return would be: .. literalinclude:: tpt_sumup-test.txt :language: python3 :start-after: --output-ini :end-before: --output-fi The doctests are available in :download:`tpt_sumup-test.txt `. .. note:: We recommend to implement and call an axiliar function such that, given a list of temperatures like the second component of ``tempL`` returns the following five data: - the average of all the temperature averages - the minimim of all the temperature minimums - the index of that minimum - the maximum of all the temperature maximums - the index of that maximum