Skip to content

Commit 99f1043

Browse files
committed
improve strike key
1 parent db0e2fc commit 99f1043

3 files changed

Lines changed: 11 additions & 11 deletions

File tree

blitzortung/cli/imprt2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def create_strike_key(strike):
126126
strike.timestamp.value,
127127
round(strike.x, 4), # Round to 6 decimal places for location
128128
round(strike.y, 4),
129-
strike.amplitude
129+
strike.lateral_error
130130
)
131131

132132

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = 'blitzortung'
3-
version = '1.11.21'
3+
version = '1.11.22'
44
description = 'blitzortung.org python modules'
55
authors = [
66
{name = "Andreas Würl",email = "andi@tryb.de"}

tests/cli/test_imprt2.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,11 @@ def test_create_strike_key_with_timestamp_value(self):
139139
strike.timestamp.value = 1234567890123456789
140140
strike.x = 12.345678
141141
strike.y = 45.678901
142-
strike.amplitude = 100
142+
strike.lateral_error = 100
143143

144144
key = imprt2.create_strike_key(strike)
145145

146-
assert_that(key).is_equal_to((1234567890123456789, 12.345678, 45.678901, 100))
146+
assert_that(key).is_equal_to((1234567890123456789, 12.3457, 45.6789, 100))
147147

148148
def test_create_strike_key_rounds_location(self):
149149
"""Test that location is rounded to 6 decimal places."""
@@ -152,13 +152,13 @@ def test_create_strike_key_rounds_location(self):
152152
strike.timestamp.value = 1000000000000000000
153153
strike.x = 12.34567890123 # More than 6 decimals
154154
strike.y = 45.67890123456
155-
strike.amplitude = 50
155+
strike.lateral_error = 50
156156

157157
key = imprt2.create_strike_key(strike)
158158

159159
# Should be rounded to 6 decimals
160-
assert_that(key[1]).is_equal_to(12.345679)
161-
assert_that(key[2]).is_equal_to(45.678901)
160+
assert_that(key[1]).is_equal_to(12.3457)
161+
assert_that(key[2]).is_equal_to(45.6789)
162162

163163

164164
class TestGetExistingStrikeKeys:
@@ -185,14 +185,14 @@ def test_get_existing_strikes_with_results(self, mock_strike_db):
185185
strike1.timestamp.value = 1000000000000000001
186186
strike1.x = 10.5
187187
strike1.y = 20.5
188-
strike1.amplitude = 100
188+
strike1.lateral_error = 100
189189

190190
strike2 = Mock(spec=Strike)
191191
strike2.timestamp = Mock()
192192
strike2.timestamp.value = 1000000000000000002
193193
strike2.x = 11.5
194194
strike2.y = 21.5
195-
strike2.amplitude = 200
195+
strike2.lateral_error = 200
196196

197197
mock_strike_db.select.return_value = [strike1, strike2]
198198

@@ -275,7 +275,7 @@ def test_update_strikes_skips_duplicates(self, mock_config, mock_fetch, mock_db_
275275
existing_strike.timestamp.value = timestamp_value
276276
existing_strike.x = 10.5
277277
existing_strike.y = 20.5
278-
existing_strike.amplitude = 100
278+
existing_strike.lateral_error = 100
279279

280280
mock_strike_db.select.return_value = [existing_strike]
281281
mock_strike_db.insert = Mock()
@@ -291,7 +291,7 @@ def test_update_strikes_skips_duplicates(self, mock_config, mock_fetch, mock_db_
291291
strike_from_url.timestamp.__ge__ = Mock(return_value=True)
292292
strike_from_url.x = 10.5
293293
strike_from_url.y = 20.5
294-
strike_from_url.amplitude = 100
294+
strike_from_url.lateral_error = 100
295295

296296
mock_fetch.return_value = [strike_from_url]
297297

0 commit comments

Comments
 (0)