From 05b3efd7253da5ec2eae76d941a2327d8b6194c3 Mon Sep 17 00:00:00 2001 From: Vamshi Kiran alugulla Date: Thu, 26 Mar 2026 11:15:09 +0530 Subject: [PATCH] Fix inconsistent coordinate ordering and rename reserved keyword in Map class MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This update fixes two issues in the Map class: Inconsistent coordinate ordering The constructor initializes coordinates in the order (lat1, lon1, lat2, lon2), but get_var_tuple() returned them as (lat1, lat2, lon1, lon2). This inconsistency could lead to incorrect usage of map bounds. The tuple order has been corrected to match the constructor. Use of reserved keyword (type) The parameter type in the extend_variable method shadows Python’s built-in type. It has been renamed to mode to improve code clarity and avoid potential issues. These changes improve code consistency, readability, and maintainability without altering the core functionality. --- WeatherRoutingTool/utils/maps.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/WeatherRoutingTool/utils/maps.py b/WeatherRoutingTool/utils/maps.py index f1e92c18..c2feeb03 100644 --- a/WeatherRoutingTool/utils/maps.py +++ b/WeatherRoutingTool/utils/maps.py @@ -10,14 +10,13 @@ def __init__(self, lat1, lon1, lat2, lon2): self.lat2 = float(lat2) self.lon2 = float(lon2) - def extend_variable(self, var, type, width): - if type == 'min': - var = var - width - elif type == 'max': - var = var + width + def extend_variable(self, var, mode, width): + if mode == 'min': + return var - width + elif mode == 'max': + return var + width else: raise ValueError('Only min and max are accepted!') - return var def get_widened_map(self, width): lat1 = self.extend_variable(self.lat1, 'min', width) @@ -27,4 +26,4 @@ def get_widened_map(self, width): return Map(lat1, lon1, lat2, lon2) def get_var_tuple(self): - return (self.lat1, self.lat2, self.lon1, self.lon2) + return (self.lat1, self.lon1, self.lat2, self.lon2)