From 19d05940fa9a74589bf541adaa631db7d47a4b3c Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Fri, 11 Aug 2023 10:10:41 -0400 Subject: [PATCH 1/3] added reference-city latitude and longitude --- hub/city_model_structure/city.py | 20 ++++++++++---------- hub/helpers/geometry_helper.py | 2 +- hub/helpers/location.py | 18 +++++++++++++++++- 3 files changed, 28 insertions(+), 12 deletions(-) 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 -- 2.39.5 From e08080c601c9efbac64f5a1239ae073ee1842016 Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Fri, 11 Aug 2023 10:21:08 -0400 Subject: [PATCH 2/3] added .gitignore to always ignore .idea --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..723ef36f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea \ No newline at end of file -- 2.39.5 From e0037e788f8804adba98c788043664dfe8da9437 Mon Sep 17 00:00:00 2001 From: p_monsalvete Date: Fri, 11 Aug 2023 10:25:59 -0400 Subject: [PATCH 3/3] moved gitignore from ./hub/hub to ./hub --- .gitignore | 13 ++++++++++++- hub/.gitignore | 12 ------------ 2 files changed, 12 insertions(+), 13 deletions(-) delete mode 100644 hub/.gitignore diff --git a/.gitignore b/.gitignore index 723ef36f..e23b0042 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,12 @@ -.idea \ No newline at end of file +!.gitignore +**/venv/ +.idea/ +/development_tests/ +/data/energy_systems/heat_pumps/*.csv +/data/energy_systems/heat_pumps/*.insel +.DS_Store +**/.env +**/hub/logs/ +**/__pycache__/ +**/.idea/ + diff --git a/hub/.gitignore b/hub/.gitignore deleted file mode 100644 index e23b0042..00000000 --- a/hub/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -!.gitignore -**/venv/ -.idea/ -/development_tests/ -/data/energy_systems/heat_pumps/*.csv -/data/energy_systems/heat_pumps/*.insel -.DS_Store -**/.env -**/hub/logs/ -**/__pycache__/ -**/.idea/ - -- 2.39.5