<commit_before>'use strict';

let debug = require('debug')('fuzzy-weather:temp'),
    debugOut = require('debug')('fuzzy-weather:temp:output'),
    moment = require('moment-timezone'),
    lsq = require('least-squares');
require('../array-util');

module.exports = {
    headline: function() { return 'There\'s gonna be some temperatures.'; },
    dailyText: getDailyText,
    hourlyText: getHourlyText
};


/**
 * Get text for temperature on a given day
 * @param  {Object} condition The condition info: topic: { snow, probability, level }
 * @param  {Object} data      The weather data from the API
 * @param  {String} timezone  The timezone for weather data
 * @return {String}           The text to use for temp information given the data provided
 */
function getDailyText(condition, data, timezone) {
    debug('getting daily temps...');

    if (data.precipProbability < 0.1) {
        return '';
    }

    let peak = moment.tz(data.temperatureMaxTime * 1000, 'GMT').tz(timezone);

    let output =
`The low {day} is ${Math.round(data.temperatureMin)} degrees. You should expect a
high of ${Math.round(data.temperatureMax)} degrees peaking around ${peak.format('ha')}.`;
    debugOut(output);
    return output;
}

function getHourlyText(data, timezone, dailyData) {
    let text = [];

    let xValues = [];
    let yValues = [];
    let maxTemp = -100;
    let maxHour = 0;
    let minTemp = 200;
    let minHour = 23;

    let dailyMaxTime = moment.tz(dailyData.temperatureMaxTime * 1000, 'GMT').tz(timezone);
    let dailyMinTime = moment.tz(dailyData.temperatureMinTime * 1000, 'GMT').tz(timezone);

    console.log(dailyData.temperatureMinTime, dailyData.temperatureMaxTime);
    debug('max/min', dailyMinTime.format('h'), dailyMaxTime.format('h'));

    data.forEach(function determineInstances(hourData, i) {
        let hour = moment.tz(hourData.time * 1000, 'GMT').tz(timezone);
        xValues.push(hour.hours());
        yValues.push(hourData.temperature);

        if (hourData.temperature > maxTemp) {
            maxHour = i;
            maxTemp = hourData.temperature;<commit_msg>remove leftover console log in temp module<commit_after>'use strict';

let debug = require('debug')('fuzzy-weather:temp'),
    debugOut = require('debug')('fuzzy-weather:temp:output'),
    moment = require('moment-timezone'),
    lsq = require('least-squares');
require('../array-util');

module.exports = {
    headline: function() { return 'There\'s gonna be some temperatures.'; },
    dailyText: getDailyText,
    hourlyText: getHourlyText
};


/**
 * Get text for temperature on a given day
 * @param  {Object} condition The condition info: topic: { snow, probability, level }
 * @param  {Object} data      The weather data from the API
 * @param  {String} timezone  The timezone for weather data
 * @return {String}           The text to use for temp information given the data provided
 */
function getDailyText(condition, data, timezone) {
    debug('getting daily temps...');

    if (data.precipProbability < 0.1) {
        return '';
    }

    let peak = moment.tz(data.temperatureMaxTime * 1000, 'GMT').tz(timezone);

    let output =
`The low {day} is ${Math.round(data.temperatureMin)} degrees. You should expect a
high of ${Math.round(data.temperatureMax)} degrees peaking around ${peak.format('ha')}.`;
    debugOut(output);
    return output;
}

function getHourlyText(data, timezone, dailyData) {
    let text = [];

    let xValues = [];
    let yValues = [];
    let maxTemp = -100;
    let maxHour = 0;
    let minTemp = 200;
    let minHour = 23;

    let dailyMaxTime = moment.tz(dailyData.temperatureMaxTime * 1000, 'GMT').tz(timezone);
    let dailyMinTime = moment.tz(dailyData.temperatureMinTime * 1000, 'GMT').tz(timezone);

    debug('max/min', dailyMinTime.format('h'), dailyMaxTime.format('h'));

    data.forEach(function determineInstances(hourData, i) {
        let hour = moment.tz(hourData.time * 1000, 'GMT').tz(timezone);
        xValues.push(hour.hours());
        yValues.push(hourData.temperature);

        if (hourData.temperature > maxTemp) {
            maxHour = i;
            maxTemp = hourData.temperature;
{'fraction_non_alphanumeric': 0.13822115384615385, 'fraction_numerical': 0.012980769230769231, 'mean_word_length': 3.4741935483870967, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7112962', 'n_tokens_mistral': 1363, 'n_tokens_neox': 1246, 'n_words': 335}