From 90b560bae785941f55347e498b551e86c6f1778c Mon Sep 17 00:00:00 2001 From: david-i-berry Date: Tue, 6 Feb 2024 12:05:00 +0100 Subject: [PATCH] Fix for bug where displacmentts accumulated for longitude. (#28) --- bufr2geojson/__init__.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bufr2geojson/__init__.py b/bufr2geojson/__init__.py index cd5ede3..39c63e6 100644 --- a/bufr2geojson/__init__.py +++ b/bufr2geojson/__init__.py @@ -280,7 +280,7 @@ def get_location(self) -> Union[dict, None]: LOGGER.warning("longitude set to None") longitude = None else: - longitude = self.qualifiers["06"]["longitude"] + longitude = deepcopy(self.qualifiers["06"]["longitude"]) if longitude is not None: # check if we need to add a displacement @@ -292,7 +292,7 @@ def get_location(self) -> Union[dict, None]: # now station elevation if "height_of_station_ground_above_mean_sea_level" in self.qualifiers["07"]: # noqa - elevation = self.qualifiers["07"]["height_of_station_ground_above_mean_sea_level"] # noqa + elevation = deepcopy(self.qualifiers["07"]["height_of_station_ground_above_mean_sea_level"]) # noqa elevation = round(elevation["value"], elevation["attributes"]["scale"]) # noqa else: elevation = None @@ -313,7 +313,6 @@ def get_location(self) -> Union[dict, None]: if None in location: LOGGER.debug('geometry contains null values; setting to None') return None - return { "type": "Point", "coordinates": location