diff --git a/hub/.gitignore b/.gitignore similarity index 100% rename from hub/.gitignore rename to .gitignore diff --git a/hub/city_model_structure/city.py b/hub/city_model_structure/city.py index a723b56c..567b1937 100644 --- a/hub/city_model_structure/city.py +++ b/hub/city_model_structure/city.py @@ -101,7 +101,7 @@ class City: Get city location :return: Location """ - return self._get_location().city + return self._get_location() @property def name(self): @@ -113,6 +113,15 @@ class City: return self._get_location().city return self._name + @name.setter + def name(self, value): + """ + Set city name + :param value:str + """ + if value is not None: + self._name = str(value) + @property def climate_reference_city(self) -> Union[None, str]: """ @@ -275,15 +284,6 @@ class City: """ return self._srs_name - @name.setter - def name(self, value): - """ - Set city name - :param value:str - """ - if value is not None: - self._name = str(value) - @staticmethod def load(city_filename) -> City: """ diff --git a/hub/helpers/geometry_helper.py b/hub/helpers/geometry_helper.py index eeb6edfc..e6361afd 100644 --- a/hub/helpers/geometry_helper.py +++ b/hub/helpers/geometry_helper.py @@ -312,7 +312,7 @@ class GeometryHelper: country = file_country_code city = file_city_name region_code = f'{file_country_code}.{admin1_code}.{admin2_code}' - return Location(country, city, region_code) + return Location(country, city, region_code, latitude, longitude) @staticmethod def distance_between_points(vertex1, vertex2): diff --git a/hub/helpers/location.py b/hub/helpers/location.py index 5af996fb..b3a3c256 100644 --- a/hub/helpers/location.py +++ b/hub/helpers/location.py @@ -11,10 +11,12 @@ class Location: """ Location """ - def __init__(self, country, city, region_code): + def __init__(self, country, city, region_code, climate_reference_city_latitude, climate_reference_city_longitude): self._country = country self._city = city self._region_code = region_code + self._climate_reference_city_latitude = climate_reference_city_latitude + self._climate_reference_city_longitude = climate_reference_city_longitude @property def city(self): @@ -36,3 +38,17 @@ class Location: Get region """ return self._region_code + + @property + def climate_reference_city_latitude(self): + """ + Get climate-reference-city latitude + """ + return self._climate_reference_city_latitude + + @property + def climate_reference_city_longitude(self): + """ + Get climate-reference-city longitude + """ + return self._climate_reference_city_longitude