From f6977ca8d2056668fe40cdc3bd9c23324303cb4a Mon Sep 17 00:00:00 2001 From: Kira <117554978+kiraware@users.noreply.github.com> Date: Tue, 31 Dec 2024 10:27:26 +0700 Subject: [PATCH 1/5] rename key 'kotkab' to 'kota' in location json schema --- src/bmkg/parsers/parse_location_data.py | 2 +- src/bmkg/types.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bmkg/parsers/parse_location_data.py b/src/bmkg/parsers/parse_location_data.py index 75e8fdf..f8a5373 100644 --- a/src/bmkg/parsers/parse_location_data.py +++ b/src/bmkg/parsers/parse_location_data.py @@ -21,7 +21,7 @@ def parse_location_data(location_data: LocationData) -> Location: location_data["adm3"], location_data["adm4"], location_data["provinsi"], - location_data["kotkab"], + location_data["kota"], location_data["kecamatan"], location_data["desa"], float(location_data["lon"]), diff --git a/src/bmkg/types.py b/src/bmkg/types.py index 4e9aec8..8120516 100644 --- a/src/bmkg/types.py +++ b/src/bmkg/types.py @@ -71,7 +71,7 @@ class LocationData(TypedDict): adm3: str adm4: str provinsi: str - kotkab: str + kota: str kecamatan: str desa: str lon: float From fc41c9ec4cc63b494e521af06275310a06c00176 Mon Sep 17 00:00:00 2001 From: Kira <117554978+kiraware@users.noreply.github.com> Date: Tue, 31 Dec 2024 10:32:41 +0700 Subject: [PATCH 2/5] fix skipped weather forecast data in parsing --- src/bmkg/parsers/parse_weather_forecast_data.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bmkg/parsers/parse_weather_forecast_data.py b/src/bmkg/parsers/parse_weather_forecast_data.py index 27e637c..2ca4d3e 100644 --- a/src/bmkg/parsers/parse_weather_forecast_data.py +++ b/src/bmkg/parsers/parse_weather_forecast_data.py @@ -21,7 +21,8 @@ def parse_weather_forecast_data( location = parse_location_data(weather_forecast_data["lokasi"]) weathers = [ parse_weather_data(weather) - for weather in weather_forecast_data["data"][0]["cuaca"][0] + for weathers in weather_forecast_data["data"][0]["cuaca"] + for weather in weathers ] return WeatherForecast(location, weathers) From 2673fd8faf5c34cea9ac49ab19b8b00da5817241 Mon Sep 17 00:00:00 2001 From: Kira <117554978+kiraware@users.noreply.github.com> Date: Tue, 31 Dec 2024 10:33:22 +0700 Subject: [PATCH 3/5] bump version to v3.0.1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e47846f..c819210 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "PyBMKG" -version = "3.0.0" +version = "3.0.1" description = "Python BMKG API Wrapper" authors = ["Kira "] maintainers = ["Kira ", "vexra "] From e735773a3ac64812b8a7cc36a1054ac2e0be3267 Mon Sep 17 00:00:00 2001 From: Kira <117554978+kiraware@users.noreply.github.com> Date: Tue, 31 Dec 2024 14:16:26 +0700 Subject: [PATCH 4/5] update weather enums --- src/bmkg/enums/weather.py | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/src/bmkg/enums/weather.py b/src/bmkg/enums/weather.py index 4bcd56e..ffb0907 100644 --- a/src/bmkg/enums/weather.py +++ b/src/bmkg/enums/weather.py @@ -13,19 +13,19 @@ class Weather(IntEnum): Attributes: CLEAR_SKIES: `0` - PARTLY_CLOUDY: `1` - PARTLY_CLOUDY2: `2` + SUNNY: `1` + PARTLY_CLOUDY: `2` MOSTLY_CLOUDY: `3` OVERCAST: `4` HAZE: `5` SMOKE: `10` + THUNDER: `17` FOG: `45` - LIGHT_RAIN: `60` - RAIN: `61` - HEAVY_RAIN: `63` + LIGHT_RAIN: `61` + MODERATE_RAIN: `63` ISOLATED_SHOWER: `80` - SEVERE_THUNDERSTORM: `95` - SEVERE_THUNDERSTORM2: `97` + THUNDERSTORM: `95` + SEVERE_THUNDERSTORM: `97` Examples: >>> Weather(0) @@ -38,24 +38,19 @@ class Weather(IntEnum): True >>> print(Weather.CLEAR_SKIES) 0 - - Note: - There is `PARTLY_CLOUDY` and `PARTLY_CLOUDY2`, the weather - condition is equal only the number representation is different. This is - also hold true for `SEVERE_THUNDERSTORM` and `SEVERE_THUNDERSTORM2`. """ CLEAR_SKIES: int = 0 - PARTLY_CLOUDY: int = 1 - PARTLY_CLOUDY2: int = 2 + SUNNY: int = 1 + PARTLY_CLOUDY: int = 2 MOSTLY_CLOUDY: int = 3 OVERCAST: int = 4 HAZE: int = 5 SMOKE: int = 10 + THUNDER: int = 17 FOG: int = 45 - LIGHT_RAIN: int = 60 - RAIN: int = 61 - HEAVY_RAIN: int = 63 + LIGHT_RAIN: int = 61 + MODERATE_RAIN: int = 63 ISOLATED_SHOWER: int = 80 - SEVERE_THUNDERSTORM: int = 95 - SEVERE_THUNDERSTORM2: int = 97 + THUNDERSTORM: int = 95 + SEVERE_THUNDERSTORM: int = 97 From dabfcf40a914d15f5a2e475e024545c4b24c7d77 Mon Sep 17 00:00:00 2001 From: Kira <117554978+kiraware@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:02:06 +0700 Subject: [PATCH 5/5] revert change key --- src/bmkg/parsers/parse_location_data.py | 2 +- src/bmkg/types.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bmkg/parsers/parse_location_data.py b/src/bmkg/parsers/parse_location_data.py index f8a5373..75e8fdf 100644 --- a/src/bmkg/parsers/parse_location_data.py +++ b/src/bmkg/parsers/parse_location_data.py @@ -21,7 +21,7 @@ def parse_location_data(location_data: LocationData) -> Location: location_data["adm3"], location_data["adm4"], location_data["provinsi"], - location_data["kota"], + location_data["kotkab"], location_data["kecamatan"], location_data["desa"], float(location_data["lon"]), diff --git a/src/bmkg/types.py b/src/bmkg/types.py index 8120516..4e9aec8 100644 --- a/src/bmkg/types.py +++ b/src/bmkg/types.py @@ -71,7 +71,7 @@ class LocationData(TypedDict): adm3: str adm4: str provinsi: str - kota: str + kotkab: str kecamatan: str desa: str lon: float