modifications_in_location #42

Merged
g_gutierrez merged 3 commits from modifications_in_location into main 2023-08-11 12:01:36 -04:00
3 changed files with 28 additions and 12 deletions
Showing only changes of commit 19d05940fa - Show all commits

View File

@ -101,7 +101,7 @@ class City:
Get city location Get city location
:return: Location :return: Location
""" """
return self._get_location().city return self._get_location()
@property @property
def name(self): def name(self):
@ -113,6 +113,15 @@ class City:
return self._get_location().city return self._get_location().city
return self._name 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 @property
def climate_reference_city(self) -> Union[None, str]: def climate_reference_city(self) -> Union[None, str]:
""" """
@ -275,15 +284,6 @@ class City:
""" """
return self._srs_name 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 @staticmethod
def load(city_filename) -> City: def load(city_filename) -> City:
""" """

View File

@ -312,7 +312,7 @@ class GeometryHelper:
country = file_country_code country = file_country_code
city = file_city_name city = file_city_name
region_code = f'{file_country_code}.{admin1_code}.{admin2_code}' 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 @staticmethod
def distance_between_points(vertex1, vertex2): def distance_between_points(vertex1, vertex2):

View File

@ -11,10 +11,12 @@ class Location:
""" """
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._country = country
self._city = city self._city = city
self._region_code = region_code self._region_code = region_code
self._climate_reference_city_latitude = climate_reference_city_latitude
self._climate_reference_city_longitude = climate_reference_city_longitude
@property @property
def city(self): def city(self):
@ -36,3 +38,17 @@ class Location:
Get region Get region
""" """
return self._region_code 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