<commit_before>package main

import (
	"encoding/json"
	"fmt"
	"github.com/bwolf/metricsystem"
	"math"
	"strings"
)

type Measurement struct {
	Name  string
	Value float64
}

type Weather struct {
	stationId    int
	measurements []Measurement
}

func (weather *Weather) StationId() int {
	return weather.stationId
}

func (weather *Weather) Measurements() []Measurement {
	return weather.measurements
}

func calcDewPoint(humid, temp float64) float64 {
	m := 17.62
	tn := 243.12

	if temp <= 0 {
		m = 22.46
		tn = 272.62
	}
	k := (math.Log10(humid)-2)/0.4343 + (m*temp)/(tn+temp)
	return tn * k / (m - k)
}

func normalizeMeasurement(m *Measurement) *Measurement {
	index := strings.LastIndex(m.Name, "_")
	if index == -1 {
		// fmt.Println("Nothing to normalize for key", m.Name)
		newName := strings.Replace(m.Name, "-", "_", -1)<commit_msg>Comment dew point calculation.<commit_after>package main

import (
	"encoding/json"
	"fmt"
	"github.com/bwolf/metricsystem"
	"math"
	"strings"
)

type Measurement struct {
	Name  string
	Value float64
}

type Weather struct {
	stationId    int
	measurements []Measurement
}

func (weather *Weather) StationId() int {
	return weather.stationId
}

func (weather *Weather) Measurements() []Measurement {
	return weather.measurements
}

// Based on Sensiron data sheet for SHT7x (http://is.gd/i8rS20).
func calcDewPoint(humid, temp float64) float64 {
	m := 17.62
	tn := 243.12

	if temp <= 0 {
		m = 22.46
		tn = 272.62
	}
	k := (math.Log10(humid)-2)/0.4343 + (m*temp)/(tn+temp)
	return tn * k / (m - k)
}

func normalizeMeasurement(m *Measurement) *Measurement {
	index := strings.LastIndex(m.Name, "_")
	if index == -1 {
		// fmt.Println("Nothing to normalize for key", m.Name)
		newName := strings.Replace(m.Name, "-", "_", -1)
{'fraction_non_alphanumeric': 0.1497175141242938, 'fraction_numerical': 0.04180790960451977, 'mean_word_length': 3.7226666666666666, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '7328280', 'n_tokens_mistral': 733, 'n_tokens_neox': 658, 'n_words': 166}