<commit_before>import React from 'react'
import PropTypes from 'prop-types'

import Temperature from './Temperature.js'
import WeatherSymbol from './WeatherSymbol.js'
import Display from './Display.js'
import ClockCoordinates from './ClockCoordinates.js'

/**
 * This is what the clock shows after forecasts have been downloaded,
 * up to and including the hour and minute hands.
 */
class Weather extends React.Component {
  renderTemperatures = renderUs => {
    return renderUs
      .filter(forecast => forecast.celsius !== undefined)
      .map(forecast => {
        const coords = new ClockCoordinates(forecast.timestamp)
        return (
          <Temperature
            key={`hour-${coords.decimalHour}`}
            coordinates={coords}
            degreesCelsius={forecast.celsius}
          />
        )
      })
  }

  renderWeathers = renderUs => {
    return renderUs
      .filter(forecast => forecast.symbol !== undefined)
      .map(forecast => {
        const coords = new ClockCoordinates(forecast.timestamp)

        return (
          <WeatherSymbol
            key={`weather-${coords.decimalHour}`}
            coordinates={coords}
            symbol={forecast.symbol}
          />
        )
      })
  }

  renderWindAndPrecipitation = renderUs => {
    let precipitation_mm = 0
    let minWind = null
    let maxWind = null

    renderUs.forEach(weather => {
      if (minWind == null || minWind > weather.wind_m_s) {
        minWind = weather.wind_m_s
      }
      if (maxWind == null || maxWind < weather.wind_m_s) {
        maxWind = weather.wind_m_s
      }
      if (weather.precipitation_mm !== undefined) {
        precipitation_mm += weather.precipitation_mm
      }
    })

    minWind = Math.round(minWind)
    maxWind = Math.round(maxWind)
    const windString = minWind === maxWind ? `${minWind} m/s` : `${minWind}-${maxWind} m/s`
    console.debug(`Wind: ${windString}`)

    const locale = navigator.language || navigator.userLanguage
    const precipitationNumberString = new Intl.NumberFormat(locale, {
      minimumSignificantDigits: 2
    }).format(precipitation_mm)

    const precipitationString = `${precipitationNumberString}mm`
    console.debug(`Precipitation: ${precipitationString}`)<commit_msg>Show precipitation with one decimal<commit_after>import React from 'react'
import PropTypes from 'prop-types'

import Temperature from './Temperature.js'
import WeatherSymbol from './WeatherSymbol.js'
import Display from './Display.js'
import ClockCoordinates from './ClockCoordinates.js'

/**
 * This is what the clock shows after forecasts have been downloaded,
 * up to and including the hour and minute hands.
 */
class Weather extends React.Component {
  renderTemperatures = renderUs => {
    return renderUs
      .filter(forecast => forecast.celsius !== undefined)
      .map(forecast => {
        const coords = new ClockCoordinates(forecast.timestamp)
        return (
          <Temperature
            key={`hour-${coords.decimalHour}`}
            coordinates={coords}
            degreesCelsius={forecast.celsius}
          />
        )
      })
  }

  renderWeathers = renderUs => {
    return renderUs
      .filter(forecast => forecast.symbol !== undefined)
      .map(forecast => {
        const coords = new ClockCoordinates(forecast.timestamp)

        return (
          <WeatherSymbol
            key={`weather-${coords.decimalHour}`}
            coordinates={coords}
            symbol={forecast.symbol}
          />
        )
      })
  }

  renderWindAndPrecipitation = renderUs => {
    let precipitation_mm = 0
    let minWind = null
    let maxWind = null

    renderUs.forEach(weather => {
      if (minWind == null || minWind > weather.wind_m_s) {
        minWind = weather.wind_m_s
      }
      if (maxWind == null || maxWind < weather.wind_m_s) {
        maxWind = weather.wind_m_s
      }
      if (weather.precipitation_mm !== undefined) {
        precipitation_mm += weather.precipitation_mm
      }
    })

    minWind = Math.round(minWind)
    maxWind = Math.round(maxWind)
    const windString = minWind === maxWind ? `${minWind} m/s` : `${minWind}-${maxWind} m/s`
    console.debug(`Wind: ${windString}`)

    const locale = navigator.language || navigator.userLanguage
    const precipitationNumberString = new Intl.NumberFormat(locale, {
      minimumFractionDigits: 1,
      maximumFractionDigits: 1
    }).format(precipitation_mm)

    const precipitationString = `${precipitationNumberString}mm`
    console.debug(`Precipitation: ${precipitationString}`)
{'fraction_non_alphanumeric': 0.11128216406421816, 'fraction_numerical': 0.0010996261271167802, 'mean_word_length': 2.7005695687550855, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1014784', 'n_tokens_mistral': 1384, 'n_tokens_neox': 1308, 'n_words': 291}