8000 Remove unused/misleading utcdelta by JamJomJim · Pull Request #191 · python-metar/python-metar · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
.tox/
htmlcov/
.coverage
/.venv/
/build/
/dist/
/python_metar.egg-info/
/metar.egg-info/
7 changes: 3 additions & 4 deletions metar/Datatypes.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
# Copyright (c) 2004,2018 Python-Metar Developers.
# Distributed under the terms of the BSD 2-Clause License.
# SPDX-License-Identifier: BSD-2-Clause
"""Python classes to represent dimensioned quantities used in weather reports.
"""
"""Python classes to represent dimensioned quantities used in weather reports."""
import re
from math import sin, cos, atan2, sqrt
from math import pi, sin, cos, atan2

# exceptions

Expand Down Expand Up @@ -481,7 +480,7 @@ def getdirection(self, position2):
long2 = position2.longitude
s = -sin(long1 - long2) * cos(lat2)
c = cos(lat1) * sin(lat2) - sin(lat1) * cos(lat2) * cos(long1 - long2)
d = atan2(s, c) * 180.0 / math.pi
d = atan2(s, c) * 180.0 / pi
if d < 0.0:
d += 360.0
return direction(d)
8 changes: 1 addition & 7 deletions metar/Metar.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ def _unparsedGroup(self, d):
class Metar(object):
"""METAR (aviation meteorology report)"""

def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True):
def __init__(self, metarcode, month=None, year=None, strict=True):
"""
Parse raw METAR code.

Expand All @@ -362,8 +362,6 @@ def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True)
month, year : int, optional
Date values to be used when parsing a non-current METAR code. If not
provided, then the month and year are guessed from the current date.
utcdelta : int or datetime.timedelta, optional
An int of hours or a timedelta object used to specify the timezone.
strict : bool (default is True)
This option determines if a ``ParserError`` is raised when
unparsable groups are found or an unexpected exception is encountered.
Expand Down Expand Up @@ -419,10 +417,6 @@ def __init__(self, metarcode, month=None, year=None, utcdelta=None, strict=True)
self._unparsed_remarks = []

self._now = datetime.datetime.now(datetime.timezone.utc).replace(tzinfo=None)
if utcdelta:
self._utcdelta = utcdelta
else:
self._utcdelta = datetime.datetime.now() - self._now

self._month = month
self._year = year
Expand Down
1 change: 0 additions & 1 deletion metar/Metar.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class Metar:
metarcode: str,
month: Optional[int] = ...,
year: Optional[int] = ...,
utcdelta: Union[int, timedelta, None] = ...,
strict: bool = ...,
): ...
@property
Expand Down
0