<commit_before>#!/usr/bin/env python2

import sys
sys.path.append("../imposm-parser")

import time
import sys
import yaml
import pyproj
import premap_pb2 as pb
import types_pb2 as pbtypes
from utils import nodeWays, deleteAloneNodes 
from Map import Map
from imposm.parser import OSMParser

scale = 10

class classifier():
	def __init__(self,waysConf,areasConf,bridgesConf,tunnelsConf,srtm):
		self.proj = pyproj.Proj(proj='utm', zone=33, ellps='WGS84')
		self.Map = Map()
		self.waysConf = waysConf
		self.areasConf = areasConf
		self.bridgesConf = bridgesConf
		self.tunnelsConf = tunnelsConf
		self.srtm = srtm

	def calcHeight(self,lon, lat):
		lon -= self.srtm.minlon
		lat -= self.srtm.minlat
		lon *= 1200
		lat *= 1200
		intlon = int(lon)
		intlat = int(lat)
		ll = self.srtm.raster[intlat][intlon]
		lr = self.srtm.raster[intlat][intlat+1]
		ul = self.srtm.raster[intlat+1][intlon]
		ur = self.srtm.raster[intlat+1][intlon+1]
		left = (lat-intlat)*ll+(1-lat+intlat)*ul
		right = (lat-intlat)*lr+(1-lat+intlat)*ur
		height = (lon-intlon)*left+(1-lon+intlon)*right
		return int(height)

	def ways_cb(self,ways):
		for osmid,tags,refs in ways:
			pbway = pb.Way()
			pbway.id = int(osmid)
			pbway.refs.extend(map(int,refs))
			if "boundary" in tags:
				continue<commit_msg>Bugfix.<commit_after>#!/usr/bin/env python2

import sys
sys.path.append("../imposm-parser")

import time
import sys
import yaml
import pyproj
import premap_pb2 as pb
import types_pb2 as pbtypes
from utils import nodeWays, deleteAloneNodes 
from Map import Map
from imposm.parser import OSMParser

scale = 10

class classifier():
	def __init__(self,waysConf,areasConf,bridgesConf,tunnelsConf,srtm):
		self.proj = pyproj.Proj(proj='utm', zone=33, ellps='WGS84')
		self.Map = Map()
		self.waysConf = waysConf
		self.areasConf = areasConf
		self.bridgesConf = bridgesConf
		self.tunnelsConf = tunnelsConf
		self.srtm = srtm

	def calcHeight(self,lon, lat):
		lon -= self.srtm.minlon
		lat -= self.srtm.minlat
		lon *= 1200
		lat *= 1200
		intlon = int(lon)
		intlat = int(lat)
		
		ll = self.srtm.raster[intlat][intlon]
		lr = self.srtm.raster[intlat][intlon+1]
		ul = self.srtm.raster[intlat+1][intlon]
		ur = self.srtm.raster[intlat+1][intlon+1]

		left = (lat-intlat)*ll+(1-lat+intlat)*ul
		right = (lat-intlat)*lr+(1-lat+intlat)*ur
		height = (lon-intlon)*left+(1-lon+intlon)*right
		return int(height)

	def ways_cb(self,ways):
		for osmid,tags,refs in ways:
			pbway = pb.Way()
			pbway.id = int(osmid)
			pbway.refs.extend(map(int,refs))
			if "boundary" in tags:
				continue
{'fraction_non_alphanumeric': 0.137109375, 'fraction_numerical': 0.01875, 'mean_word_length': 4.335416666666666, 'pattern_counts': {'":': 0, '<': 3, '<?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': '6476223', 'n_tokens_mistral': 1147, 'n_tokens_neox': 1021, 'n_words': 205}