Skip to content

Commit 6745130

Browse files
authored
Merge pull request #191 from JamJomJim/main
Remove unused/misleading utcdelta
2 parents 8fd43c3 + 458e159 commit 6745130

File tree

4 files changed

+6
-12
lines changed

4 files changed

+6
-12
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
.tox/
44
htmlcov/
55
.coverage
6+
/.venv/
67
/build/
78
/dist/
9+
/python_metar.egg-info/
810
/metar.egg-info/

metar/Datatypes.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# Copyright (c) 2004,2018 Python-Metar Developers.
22
# Distributed under the terms of the BSD 2-Clause License.
33
# SPDX-License-Identifier: BSD-2-Clause
4-
"""Python classes to represent dimensioned quantities used in weather reports.
5-
"""
4+
"""Python classes to represent dimensioned quantities used in weather reports."""
65
import re
7-
from math import sin, cos, atan2, sqrt
6+
from math import pi, sin, cos, atan2
87

98
# exceptions
109

@@ -481,7 +480,7 @@ def getdirection(self, position2):
481480
long2 = position2.longitude
482481
s = -sin(long1 - long2) * cos(lat2)
483482
c = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(long1 - long2)
484-
d = atan2(s, c) * 180.0 / math.pi
483+
d = atan2(s, c) * 180.0 / pi
485484
if d < 0.0:
486485
d += 360.0
487486
return direction(d)

metar/Metar.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ def _unparsedGroup(self, d):
352352
class Metar(object):
353353
"""METAR (aviation meteorology report)"""
354354

355-
def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True):
355+
def __init__(self, metarcode, month=None, year=None, strict=True):
356356
"""
357357
Parse raw METAR code.
358358
@@ -362,8 +362,6 @@ def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True)
362362
month, year : int, optional
363363
Date values to be used when parsing a non-current METAR code. If not
364364
provided, then the month and year are guessed from the current date.
365-
utcdelta : int or datetime.timedelta, optional
366-
An int of hours or a timedelta object used to specify the timezone.
367365
strict : bool (default is True)
368366
This option determines if a ``ParserError`` is raised when
369367
unparsable groups are found or an unexpected exception is encountered.
@@ -419,10 +417,6 @@ def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True)
419417
self._unparsed_remarks = []
420418

421419
self._now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
422-
if utcdelta:
423-
self._utcdelta = utcdelta
424-
else:
425-
self._utcdelta = datetime.datetime.now() - self._now
426420

427421
self._month = month
428422
self._year = year

metar/Metar.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ class Metar:
7474
metarcode: str,
7575
month: Optional[int] = ...,
7676
year: Optional[int] = ...,
77-
utcdelta: Union[int, timedelta, None] = ...,
7877
strict: bool = ...,
7978
): ...
8079
@property

0 commit comments

Comments
 (0)