diff --git a/.gitignore b/.gitignore index 2ffdc7be..15b35152 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ .tox/ htmlcov/ .coverage +/.venv/ /build/ /dist/ +/python_metar.egg-info/ /metar.egg-info/ \ No newline at end of file diff --git a/metar/Datatypes.py b/metar/Datatypes.py index adb36737..fd698f9e 100644 --- a/metar/Datatypes.py +++ b/metar/Datatypes.py @@ -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 @@ -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) diff --git a/metar/Metar.py b/metar/Metar.py index 3859417b..9c8e8eb5 100644 --- a/metar/Metar.py +++ b/metar/Metar.py @@ -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. @@ -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. @@ -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 diff --git a/metar/Metar.pyi b/metar/Metar.pyi index 24e763bb..cf1ba1de 100644 --- a/metar/Metar.pyi +++ b/metar/Metar.pyi @@ -74,7 +74,6 @@ class Metar: metarcode: str, month: Optional[int] = ..., year: Optional[int] = ..., - utcdelta: Union[int, timedelta, None] = ..., strict: bool = ..., ): ... @property