Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,16 @@ namely get_weather_forecast.

### get_weather_forecast

get_weather_forecast provides weather forecast information for all districts and cities across Indonesia, covering a three-day period. The data is organized by region, identified using a unique "Region IV" code, which follows the format W.X.Y.Z (e.g., "11.01.01.2001"). A comprehensive list of available region codes can be found at [kodewilayah.id](https://kodewilayah.id).

The forecast includes detailed weather information for each region, with updates every three hours for the next three days. The weather data is refreshed every two days. To access the forecast, use the API endpoint `https://api.bmkg.go.id/publik/prakiraan-cuaca?adm4={region_code}`. Read
get_weather_forecast provides weather forecast information for all districts
and cities across Indonesia, covering a three-day period. The data is organized
by region, identified using a unique "Region IV" code, which follows the format
W.X.Y.Z (e.g., "11.01.01.2001"). A comprehensive list of available region codes
can be found at [kodewilayah.id](https://kodewilayah.id).

The forecast includes detailed weather information for each region, with
updates every three hours for the next three days. The weather data is
refreshed every two days. To access the forecast, use the API endpoint
`https://api.bmkg.go.id/publik/prakiraan-cuaca?adm4={region_code}`. Read
[get_weather_forecast reference](reference/api.md/#bmkg.api.WeatherForecast.get_weather_forecast)
for more details.

Expand Down
5 changes: 1 addition & 4 deletions src/bmkg/api/weather_forecast.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ async def get_weather_forecast(self, region_code: str) -> WeatherForecastData:
Request weather forecast from weather forecast API.

Args:
region_code: The administrative region code (level IV) for a
subdistrict or village in Indonesia. The code is formatted as `W.X.Y.Z`
(e.g., `"11.01.01.2001"`). You can find the list of available region codes
at https://kodewilayah.id.
region_code: The administrative region code (level IV) for a subdistrict or village in Indonesia. The code is formatted as `W.X.Y.Z` (e.g., `"11.01.01.2001"`). You can find the list of available region codes at https://kodewilayah.id.

Returns:
A `WeatherForecastData` schema.
Expand Down
14 changes: 5 additions & 9 deletions src/bmkg/schemas/weather.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,18 @@ class Weather:
t: Temperature in degrees Celsius.
tcc: Total cloud cover percentage (0-100%).
tp: Precipitation amount in millimeters.
weather: Weather condition code, corresponds to a predefined set of
weather conditions.
weather: Weather condition code, corresponds to a predefined set of weather conditions.
wd_deg: Wind direction in degrees (0-360), where 0° is North.
wd: Wind direction from which the wind blows.
wd_to: Wind direction the wind is blowing towards.
ws: Wind speed in kilometers per hour (km/h).
hu: Humidity percentage (0-100%).
vs: Visibility in meters.
time_index: Time index in the format `"x-y"`, where `x` is the hour
start of the forecast, and `y` is the hour end of the forecast.
analysis_date: The date when the weather data was generated (in UTC
format).
image: URL to an image representing the weather condition (e.g., an
icon).
time_index: Time index in the format `"x-y"`, where `x` is the hour start of the forecast, and `y` is the hour end of the forecast.
analysis_date: The date when the weather data was generated (in UTC format).
image: URL to an image representing the weather condition (e.g., an icon).
utc_datetime: The UTC datetime when the weather data was recorded.
local_datetime: The local datetime when the weather data was recorded in this format "%Y-%m-%d %H:%M:%S"(adjusted for time zone).
local_datetime: The local datetime when the weather data was recorded.
"""

datetime: dt.datetime
Expand Down
Loading