forecast_client
KMA Weather Forecast API client.
This module provides a client for accessing the Korea Meteorological Administration's Weather Forecast (예보) API for weather predictions.
Weather forecasts provide predicted meteorological conditions for planning and decision-making.
ForecastClient
¶
Client for KMA Weather Forecast API.
The Weather Forecast system provides predicted meteorological conditions including temperature, precipitation probability, sky conditions, and wind for various time ranges.
This client implements short-term forecast endpoints from the official KMA API Hub documentation.
Source code in python/src/kma_mcp/forecast/forecast_client.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 | |
close()
¶
convert_coords_to_grid(lon, lat, *, help=1)
¶
Convert latitude/longitude coordinates to village forecast grid numbers.
Documented endpoint: nph-dfs_xy_lonlat (CGI)
Converts geographic coordinates (latitude, longitude) to the nearest village forecast grid coordinates (x, y).
Parameters:
-
lon(float) –Longitude. Range: 123.310165 ~ 132.774963
-
lat(float) –Latitude. Range: 31.651814 ~ 43.393490
-
help(int, default:1) –Show help information. 0=no help, 1=show help (default: 1)
Returns:
Example
client = ForecastClient(auth_key='your_key') grid = client.convert_coords_to_grid(lon=127.5, lat=36.5)
Reference: API_ENDPOINT_Forecast.md - Category 2: Village Forecast Grid Data
Source code in python/src/kma_mcp/forecast/forecast_client.py
convert_grid_to_coords(x, y, *, help=1)
¶
Convert village forecast grid numbers to latitude/longitude coordinates.
Documented endpoint: nph-dfs_xy_lonlat (CGI)
Converts village forecast grid coordinates (x, y) to geographic coordinates (latitude, longitude).
Parameters:
-
x(int) –Grid number (east-west direction). Range: 1 ~ 149
-
y(int) –Grid number (north-south direction). Range: 1 ~ 253
-
help(int, default:1) –Show help information. 0=no help, 1=show help (default: 1)
Returns:
Example
client = ForecastClient(auth_key='your_key') coords = client.convert_grid_to_coords(x=60, y=127)
Reference: API_ENDPOINT_Forecast.md - Category 2: Village Forecast Grid Data
Source code in python/src/kma_mcp/forecast/forecast_client.py
download_grid_latlon_netcdf(fct)
¶
Download village forecast grid lat/lon NetCDF file (documented endpoint).
Documented endpoint: nph-dfs_latlon_api (CGI)
Downloads a NetCDF file containing latitude and longitude coordinates for all grid points in the village forecast system.
Parameters:
-
fct(str) –Forecast type - 'SHRT' (short-term), 'VSRT' (very short-term/observation)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.download_grid_latlon_netcdf(fct='SHRT')
Reference: API_ENDPOINT_Forecast.md line 353-362
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_aws_warning_zone_code(tm=None, disp=1)
¶
Get AWS station warning zone codes (documented endpoint).
Documented endpoint: wrn_reg_aws2.php
Retrieves warning zone codes for AWS (Automated Weather Station) locations, including warning zone names.
Parameters:
-
tm(str | None, default:None) –Reference time. None for current.
-
disp(int, default:1) –Display format (default: 1)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_aws_warning_zone_code()
Reference: API_ENDPOINT_Forecast.md line 744-749
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_current_warning_status(fe='f', tm=None, disp=0)
¶
Get current warning status (documented endpoint).
Documented endpoint: wrn_now_data.php
Retrieves current active warning status.
Parameters:
-
fe(str, default:'f') –Time basis. 'f'=issue time basis (default), 'e'=effective time basis
-
tm(str | None, default:None) –Reference time in YYYYMMDDHHmm format. None for current.
-
disp(int, default:0) –Display format
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_current_warning_status(fe='f')
Reference: API_ENDPOINT_Forecast.md line 588-598
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_current_warning_status_new(fe='f', tm=None, disp=0)
¶
Get current warning status (new version) (documented endpoint).
Documented endpoint: wrn_now_data_new.php
Retrieves current active warning status using new API version.
Parameters:
-
fe(str, default:'f') –Time basis. 'f'=issue time basis (default), 'e'=effective time basis
-
tm(str | None, default:None) –Reference time in YYYYMMDDHHmm format. None for current.
-
disp(int, default:0) –Display format
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_current_warning_status_new(fe='f')
Reference: API_ENDPOINT_Forecast.md line 600-610
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_forecast_version(ftype, basedatetime, page_no=1, num_of_rows=1000, data_type='JSON')
¶
Get forecast version information (documented endpoint).
Documented endpoint: VilageFcstInfoService_2.0/getFcstVersion (OpenAPI)
Retrieves version information for village forecast data files. Useful for tracking data updates and changes.
Parameters:
-
ftype(str) –File type - 'ODAM' (observation), 'VSRT' (ultra short-term), 'SHRT' (short-term)
-
basedatetime(str) –Issue date/time in YYYYMMDDHHmm format (e.g., '202106280800')
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:1000) –Number of results per page (default: 1000)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_forecast_version( ... ftype='SHRT', ... basedatetime='202106280800' ... )
Reference: API_ENDPOINT_Forecast.md - Category 4: Village Forecast API
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_forecast_zone_code(page_no=1, num_of_rows=10, data_type='JSON', reg_id=None)
¶
Get forecast zone code information (documented endpoint).
Documented endpoint: FcstZoneInfoService/getFcstZoneCd (OpenAPI)
Retrieves forecast zone code information for administrative regions.
Parameters:
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
-
reg_id(str | None, default:None) –Region ID (e.g., '11A00101')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_forecast_zone_code(reg_id='11A00101')
Reference: API_ENDPOINT_Forecast.md line 722-727
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_grid_latlon_data(fct, latlon, disp='A')
¶
Get village forecast grid latitude/longitude data (documented endpoint).
Documented endpoint: nph-dfs_latlon_api (CGI)
Retrieves latitude or longitude values for all grid points in the village forecast system.
Parameters:
-
fct(str) –Forecast type - 'SHRT' (short-term), 'VSRT' (very short-term/observation)
-
latlon(str) –Coordinate type - 'lon' (longitude) or 'lat' (latitude) 'lon': outputs longitude values from bottom-left to top-right 'lat': outputs latitude values from bottom-left to top-right
-
disp(str, default:'A') –Display format (default: 'A') 'A' (ASCII): grid count + data values 'B' (BINARY): grid count (4 bytes) + data as floats
Returns:
Example
client = ForecastClient(auth_key='your_key')
Get longitude values for short-term forecast grid¶
data = client.get_grid_latlon_data(fct='SHRT', latlon='lon')
Reference: API_ENDPOINT_Forecast.md line 339-351
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_impact_forecast_status(tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, ifpar=None, ifarea='0', regid=None)
¶
Get impact forecast status (발표구역별 위험수준) (documented endpoint).
Documented endpoint: ifs_fct_pstt.php
Retrieves impact forecast status showing risk levels by region. Impact forecasts provide detailed impact information and response guidelines by risk level for heat waves and cold waves.
Parameters:
-
tmfc1(str | None, default:None) –Issue time period start (YYYYMMDDHHmm)
-
tmfc2(str | None, default:None) –Issue time period end (YYYYMMDDHHmm)
-
tmef1(str | None, default:None) –Effective time period start (YYYYMMDD)
-
tmef2(str | None, default:None) –Effective time period end (YYYYMMDD)
-
ifpar(str | None, default:None) –Impact forecast parameter. 'hw'=heat wave, 'cw'=cold wave
-
ifarea(str, default:'0') –Impact area (default: '0')
-
regid(str | None, default:None) –Warning region code
Returns:
Example
client = ForecastClient(auth_key='your_key')
Heat wave impact forecast for period (effective time basis)¶
data = client.get_impact_forecast_status( ... tmef1='20210701', tmef2='20210730', ifpar='hw' ... )
Cold wave impact forecast for period (issue time basis)¶
data = client.get_impact_forecast_status( ... tmfc1='20210101', tmfc2='20210131', ifpar='cw' ... )
Reference: API_ENDPOINT_Forecast.md line 647-663
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_impact_risk_level_distribution_map(tmfc, stn=None, ifpar=None, ifarea=None)
¶
Get impact forecast risk level distribution map (documented endpoint).
Documented endpoint: ifs_ilvl_dmap.php
Retrieves spatial distribution map of risk levels for impact forecasts.
Parameters:
-
tmfc(str) –Forecast issue date (YYYYMMDD)
-
stn(str | None, default:None) –Station/office code (e.g., '108')
-
ifpar(str | None, default:None) –Impact forecast parameter. 'hw'=heat wave, 'cw'=cold wave
-
ifarea(int | None, default:None) –Impact area code
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_impact_risk_level_distribution_map(tmfc='20220601')
Reference: API_ENDPOINT_Forecast.md line 692-716
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_impact_risk_level_zone_count(tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, ifarea='0', stn=None, ilvl=None)
¶
Get impact forecast risk level zone count (documented endpoint).
Documented endpoint: ifs_ilvl_zone_cnt.php
Retrieves the count of areas by risk level for impact forecasts.
Parameters:
-
tmfc1(str | None, default:None) –Issue time period start (YYYYMMDDHHmm)
-
tmfc2(str | None, default:None) –Issue time period end (YYYYMMDDHHmm)
-
tmef1(str | None, default:None) –Effective time period start (YYYYMMDD)
-
tmef2(str | None, default:None) –Effective time period end (YYYYMMDD)
-
ifarea(str, default:'0') –Impact area (default: '0')
-
stn(str | None, default:None) –Station/office code (e.g., '108')
-
ilvl(int | None, default:None) –Risk level (0-3)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_impact_risk_level_zone_count( ... tmef1='20210701', tmef2='20210730' ... )
Reference: API_ENDPOINT_Forecast.md line 666-689
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_land_forecast_message(page_no=1, num_of_rows=10, data_type='JSON', reg_id=None)
¶
Get land forecast messages (documented endpoint).
Documented endpoint: VilageFcstMsgService/getLandFcst (OpenAPI)
Retrieves land forecast messages for specific regions. Messages contain detailed weather forecasts for land areas.
Parameters:
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
-
reg_id(str | None, default:None) –Forecast region code. None for all regions. 11A00101=Baengnyeong, 11B10101=Seoul, 11B20201=Incheon, etc. See reference documentation for full list.
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_land_forecast_message(reg_id='11B10101', num_of_rows=5)
Reference: API_ENDPOINT_Forecast.md - Category 3: Village Forecast Messages
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_medium_term_land(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get medium-term land forecast (중기 육상예보) (documented endpoint).
Documented endpoint: fct_afs_wl.php
Retrieves medium-term land forecast data for 3-10 days ahead.
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_land( ... reg='', ... tmfc1='2013121106', ... tmfc2='2013121118', ... tmef1='20131214', ... tmef2='20131219' ... )
Reference: API_ENDPOINT_Forecast.md line 406-422
Source code in python/src/kma_mcp/forecast/forecast_client.py
1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 | |
get_medium_term_land_forecast(reg_id, tm_fc, page_no=1, num_of_rows=10, data_type='JSON')
¶
Get medium-term land forecast via OpenAPI (documented endpoint).
Documented endpoint: MidFcstInfoService/getMidLandFcst (OpenAPI)
Retrieves medium-term land forecast for specific regions. Issued twice daily at 06:00 and 18:00 KST. Only last 24 hours available.
Parameters:
-
reg_id(str) –Forecast region code (e.g., '11B00000' Seoul/Incheon/Gyeonggi, '11D10000' Gangwon Yeongdong)
-
tm_fc(str) –Forecast issue time in YYYYMMDDHHmm format (e.g., '202107300600') Must be either 0600 or 1800.
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_land_forecast( ... reg_id='11B00000', ... tm_fc='202107300600' ... )
Reference: API_ENDPOINT_Forecast.md line 489-503
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_medium_term_outlook(stn_id, tm_fc, page_no=1, num_of_rows=10, data_type='JSON')
¶
Get medium-term outlook/perspective forecast (중기전망) (documented endpoint).
Documented endpoint: MidFcstInfoService/getMidFcst (OpenAPI)
Retrieves medium-term forecast outlook for specific stations. Issued twice daily at 06:00 and 18:00 KST. Only last 24 hours available.
Parameters:
-
stn_id(str) –Station code (e.g., '108' National, '109' Seoul/Incheon/Gyeonggi)
-
tm_fc(str) –Forecast issue time in YYYYMMDDHHmm format (e.g., '201310170600') Must be either 0600 or 1800.
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_outlook( ... stn_id='108', ... tm_fc='201310170600' ... )
Reference: API_ENDPOINT_Forecast.md line 504-518
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_medium_term_overview(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, mode=0, disp=0)
¶
Get medium-term forecast overview (중기 개황) (documented endpoint).
Documented endpoint: fct_afs_ws.php
Retrieves medium-term forecast overview/summary information.
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
mode(int, default:0) –Display mode. 0=values only, 1=include forecaster info
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_overview( ... tmfc1='2013121106', tmfc2='2013121118' ... )
Reference: API_ENDPOINT_Forecast.md line 388-405
Source code in python/src/kma_mcp/forecast/forecast_client.py
1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 | |
get_medium_term_region(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, mode=0, disp=0)
¶
Get medium-term forecast region data (documented endpoint).
Documented endpoint: fct_medm_reg.php
Retrieves medium-term forecast region information. Medium-term forecasts cover 3-10 days ahead with AM/PM details for days 3-7 and daily for days 8-10.
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
mode(int, default:0) –Display mode. 0=values only (fast), 1=include forecaster ID/name/region name
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_region(tmfc='0')
Reference: API_ENDPOINT_Forecast.md line 370-387
Source code in python/src/kma_mcp/forecast/forecast_client.py
1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 | |
get_medium_term_sea(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get medium-term sea forecast (중기 해상예보) (documented endpoint).
Documented endpoint: fct_afs_wo.php
Retrieves medium-term marine/sea forecast data including wave height for 3-10 days ahead.
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_sea( ... reg='', ... tmfc1='2013121106', ... tmfc2='2013121118', ... tmef1='20131214', ... tmef2='20131219' ... )
Reference: API_ENDPOINT_Forecast.md line 440-456
Source code in python/src/kma_mcp/forecast/forecast_client.py
1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 | |
get_medium_term_sea_forecast(reg_id, tm_fc, page_no=1, num_of_rows=10, data_type='JSON')
¶
Get medium-term sea forecast via OpenAPI (documented endpoint).
Documented endpoint: MidFcstInfoService/getMidSeaFcst (OpenAPI)
Retrieves medium-term marine forecast for specific sea regions. Issued twice daily at 06:00 and 18:00 KST. Only last 24 hours available.
Parameters:
-
reg_id(str) –Forecast region code (e.g., '12A20000' West Sea Central, '12B10000' South Sea West)
-
tm_fc(str) –Forecast issue time in YYYYMMDDHHmm format (e.g., '201404080600') Must be either 0600 or 1800.
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_sea_forecast( ... reg_id='12A20000', ... tm_fc='201404080600' ... )
Reference: API_ENDPOINT_Forecast.md line 459-473
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_medium_term_temperature(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get medium-term temperature forecast (중기 기온예보) (documented endpoint).
Documented endpoint: fct_afs_wc.php
Retrieves medium-term temperature forecast data including max/min temperatures and temperature ranges for 3-10 days ahead.
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_temperature( ... reg='', ... tmfc1='2013121106', ... tmfc2='2013121118', ... tmef1='20131214', ... tmef2='20131219' ... )
Reference: API_ENDPOINT_Forecast.md line 423-439
Source code in python/src/kma_mcp/forecast/forecast_client.py
1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 | |
get_medium_term_temperature_forecast(reg_id, tm_fc, page_no=1, num_of_rows=10, data_type='JSON')
¶
Get medium-term temperature forecast via OpenAPI (documented endpoint).
Documented endpoint: MidFcstInfoService/getMidTa (OpenAPI)
Retrieves medium-term temperature forecast for specific regions. Issued twice daily at 06:00 and 18:00 KST. Only last 24 hours available.
Parameters:
-
reg_id(str) –Forecast region code (e.g., '11B10101' Seoul, '11B20201' Incheon)
-
tm_fc(str) –Forecast issue time in YYYYMMDDHHmm format (e.g., '201309030600') Must be either 0600 or 1800.
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_medium_term_temperature_forecast( ... reg_id='11B10101', ... tm_fc='201309030600' ... )
Reference: API_ENDPOINT_Forecast.md line 474-488
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_sea_forecast_message(page_no=1, num_of_rows=10, data_type='JSON', reg_id=None)
¶
Get sea forecast messages (documented endpoint).
Documented endpoint: VilageFcstMsgService/getSeaFcst (OpenAPI)
Retrieves sea/marine forecast messages for specific regions. Messages contain detailed weather forecasts for sea areas.
Parameters:
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
-
reg_id(str | None, default:None) –Forecast region code. None for all regions. 12A20100=West Sea Central, 12B20100=South Sea East, etc. See reference documentation for full list.
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_sea_forecast_message(reg_id='12A20100', num_of_rows=5)
Reference: API_ENDPOINT_Forecast.md - Category 3: Village Forecast Messages
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_short_term_distribution_map(data0, data1, tm_fc, tm_ef, dtm='H0', map='G1', mask='M', color='E', size=600, effect='NTL', overlay='S', zoom_rate=2, zoom_level=0, zoom_x='0000000', zoom_y='0000000', auto_man='m', mode='I', interval=1, rand=1412)
¶
Get graphical short-term forecast distribution map (documented endpoint).
Documented endpoint: nph-dfs_shrt_ana_5d_test (typ03 CGI)
Provides graphical distribution maps for short-term village forecasts. Returns images showing spatial distribution of forecast variables.
Parameters:
-
data0(str) –Data type (e.g., 'GEMD' for village forecast)
-
data1(str) –Variable type (e.g., 'PTY' for precipitation type, 'TMP' for temperature, 'SKY' for sky condition)
-
tm_fc(str | datetime) –Forecast issue time in 'YYYYMMDDHHmm' format or datetime object
-
tm_ef(str | datetime) –Forecast valid time in 'YYYYMMDDHHmm' format or datetime object
-
dtm(str, default:'H0') –Time step unit and value (default: 'H0')
-
map(str, default:'G1') –Map type (default: 'G1')
-
mask(str, default:'M') –Image land/sea mask (default: 'M')
-
color(str, default:'E') –Image color palette (default: 'E')
-
size(int, default:600) –Image size in pixels (default: 600)
-
effect(str, default:'NTL') –Image effects (default: 'NTL')
-
overlay(str, default:'S') –Image overlay (default: 'S')
-
zoom_rate(int, default:2) –Zoom magnification (default: 2)
-
zoom_level(int, default:0) –Zoom level (default: 0)
-
zoom_x(str, default:'0000000') –Zoom X coordinate (default: '0000000')
-
zoom_y(str, default:'0000000') –Zoom Y coordinate (default: '0000000')
-
auto_man(str, default:'m') –Auto/manual mode - 'a' (auto) or 'm' (manual) (default: 'm')
-
mode(str, default:'I') –Display format - 'H' (HTML), 'I' (image), 'A' (auto), 'F' (file) (default: 'I')
-
interval(int, default:1) –Time interval in hours (default: 1)
-
rand(int, default:1412) –Random number for image regeneration interval in minutes (default: 1412)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_short_term_distribution_map( ... data0='GEMD', ... data1='PTY', ... tm_fc='202212221400', ... tm_ef='202212260000' ... )
Reference: API_ENDPOINT_Forecast.md line 288-311
Source code in python/src/kma_mcp/forecast/forecast_client.py
985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 | |
get_short_term_land(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get short-term land forecast (육상예보).
Documented endpoint: fct_afs_dl.php Reference: API_ENDPOINT_Forecast.md line 64-79
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient('your_auth_key') data = client.get_short_term_land( ... reg='', tmfc1='2013121106', tmfc2='2013121118' ... )
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_short_term_land_v2(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get short-term land forecast v2 (육상예보 version 2).
Documented endpoint: fct_afs_dl2.php Reference: API_ENDPOINT_Forecast.md line 82-97
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient('your_auth_key') data = client.get_short_term_land_v2( ... reg='', tmfc1='2020052505', tmfc2='2020052517' ... )
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_short_term_overview(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get short-term forecast overview (개황).
Documented endpoint: fct_afs_ds.php Reference: API_ENDPOINT_Forecast.md line 46-61
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient('your_auth_key') data = client.get_short_term_overview( ... tmfc1='2013121106', tmfc2='2013121118' ... )
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_short_term_region(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get short-term forecast region data.
Documented endpoint: fct_shrt_reg.php Reference: API_ENDPOINT_Forecast.md line 28-43
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time in 'YYYYMMDDHHmm' format or datetime object. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient('your_auth_key')
Get most recent forecast¶
data = client.get_short_term_region(tmfc='0')
Get forecast for specific period¶
data = client.get_short_term_region( ... tmfc1='2013121106', tmfc2='2013121118' ... )
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_short_term_sea(stn=None, reg=None, tmfc=None, tmfc1=None, tmfc2=None, tmef1=None, tmef2=None, disp=0)
¶
Get short-term sea forecast (해상예보).
Documented endpoint: fct_afs_do.php Reference: API_ENDPOINT_Forecast.md line 100-115
Parameters:
-
stn(str | None, default:None) –Station/office number. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc(str | datetime | None, default:None) –Forecast time. None for all, '0' for most recent.
-
tmfc1(str | datetime | None, default:None) –Forecast period start time. None for most recent.
-
tmfc2(str | datetime | None, default:None) –Forecast period end time. None for most recent.
-
tmef1(str | datetime | None, default:None) –Effective period start time. None for all forecast period.
-
tmef2(str | datetime | None, default:None) –Effective period end time. None for all forecast period.
-
disp(int, default:0) –Display format. 0=Fortran (default), 1=Excel (CSV)
Returns:
Example
client = ForecastClient('your_auth_key') data = client.get_short_term_sea( ... reg='', tmfc1='2013121106', tmfc2='2013121118' ... )
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_ultra_short_term_forecast(base_date, base_time, nx, ny, page_no=1, num_of_rows=1000, data_type='JSON')
¶
Get ultra short-term forecast data (documented endpoint).
Documented endpoint: VilageFcstInfoService_2.0/getUltraSrtFcst (OpenAPI)
Retrieves ultra short-term forecast data for village forecast grid points. Issued every 30 minutes. Provides hourly forecasts up to 6 hours ahead.
Parameters:
-
base_date(str) –Issue date in YYYYMMDD format (e.g., '20210628')
-
base_time(str) –Issue time in HHmm format (e.g., '0630')
-
nx(int) –Forecast grid X coordinate (1~149)
-
ny(int) –Forecast grid Y coordinate (1~253)
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:1000) –Number of results per page (default: 1000)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_ultra_short_term_forecast( ... base_date='20210628', ... base_time='0630', ... nx=55, ... ny=127 ... )
Reference: API_ENDPOINT_Forecast.md - Category 4: Village Forecast API
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_ultra_short_term_observation(base_date, base_time, nx, ny, page_no=1, num_of_rows=1000, data_type='JSON')
¶
Get ultra short-term observation data (documented endpoint).
Documented endpoint: VilageFcstInfoService_2.0/getUltraSrtNcst (OpenAPI)
Retrieves current weather observation data for village forecast grid points. Issued every hour on the hour.
Parameters:
-
base_date(str) –Issue date in YYYYMMDD format (e.g., '20210628')
-
base_time(str) –Issue time in HHmm format (e.g., '0600')
-
nx(int) –Forecast grid X coordinate (1~149)
-
ny(int) –Forecast grid Y coordinate (1~253)
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:1000) –Number of results per page (default: 1000)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_ultra_short_term_observation( ... base_date='20210628', ... base_time='0600', ... nx=55, ... ny=127 ... )
Reference: API_ENDPOINT_Forecast.md - Category 4: Village Forecast API
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_very_short_term_distribution_map(data0, data1, tm_fc, tm_ef, dtm='H0', map='G1', mask='M', color='E', size=600, effect='NTL', overlay='S', zoom_rate=2, zoom_level=0, zoom_x='0000000', zoom_y='0000000', auto_man='m', mode='I', interval=1, rand=1412)
¶
Get graphical ultra short-term forecast distribution map (documented endpoint).
Documented endpoint: nph-dfs_shrt_ana_5d_test (typ03 CGI)
Provides graphical distribution maps for ultra short-term village forecasts. Returns images showing spatial distribution of forecast variables.
Parameters:
-
data0(str) –Data type (e.g., 'GEMD' for village forecast)
-
data1(str) –Variable type (e.g., 'PTY', 'TMP', 'SKY')
-
tm_fc(str | datetime) –Forecast issue time in 'YYYYMMDDHHmm' format or datetime object
-
tm_ef(str | datetime) –Forecast valid time in 'YYYYMMDDHHmm' format or datetime object
-
dtm(str, default:'H0') –Time step unit and value (default: 'H0')
-
map(str, default:'G1') –Map type (default: 'G1')
-
mask(str, default:'M') –Image land/sea mask (default: 'M')
-
color(str, default:'E') –Image color palette (default: 'E')
-
size(int, default:600) –Image size in pixels (default: 600)
-
effect(str, default:'NTL') –Image effects (default: 'NTL')
-
overlay(str, default:'S') –Image overlay (default: 'S')
-
zoom_rate(int, default:2) –Zoom magnification (default: 2)
-
zoom_level(int, default:0) –Zoom level (default: 0)
-
zoom_x(str, default:'0000000') –Zoom X coordinate (default: '0000000')
-
zoom_y(str, default:'0000000') –Zoom Y coordinate (default: '0000000')
-
auto_man(str, default:'m') –Auto/manual mode - 'a' or 'm' (default: 'm')
-
mode(str, default:'I') –Display format - 'H', 'I', 'A', 'F' (default: 'I')
-
interval(int, default:1) –Time interval in hours (default: 1)
-
rand(int, default:1412) –Random number for image regeneration interval (default: 1412)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_very_short_term_distribution_map( ... data0='GEMD', ... data1='PTY', ... tm_fc='202212221400', ... tm_ef='202212260000' ... )
Reference: API_ENDPOINT_Forecast.md line 313-336
Source code in python/src/kma_mcp/forecast/forecast_client.py
1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 | |
get_village_forecast(base_date, base_time, nx, ny, page_no=1, num_of_rows=1000, data_type='JSON')
¶
Get village short-term forecast data (documented endpoint).
Documented endpoint: VilageFcstInfoService_2.0/getVilageFcst (OpenAPI)
Retrieves short-term forecast data for village forecast grid points. Issued 8 times daily (02, 05, 08, 11, 14, 17, 20, 23 KST). Provides forecasts up to 3 days ahead.
Parameters:
-
base_date(str) –Issue date in YYYYMMDD format (e.g., '20210628')
-
base_time(str) –Issue time in HHmm format (e.g., '0500')
-
nx(int) –Forecast grid X coordinate (1~149)
-
ny(int) –Forecast grid Y coordinate (1~253)
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:1000) –Number of results per page (default: 1000)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_village_forecast( ... base_date='20210628', ... base_time='0500', ... nx=55, ... ny=127 ... )
Reference: API_ENDPOINT_Forecast.md - Category 4: Village Forecast API
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_village_observation_grid(tmfc=None, vars=None)
¶
Get village observation grid data (documented endpoint).
Documented endpoint: nph-dfs_odam_grd (CGI)
Provides current observation grid data for village-level analysis. Since 2024-03-04 10:00, issued every 10 minutes. Before that, issued every hour on the hour.
Parameters:
-
tmfc(str | datetime | None, default:None) –Observation time in 'YYYYMMDDHHmm' format or datetime object. Since 2024-03-04 10:00: issued every 10 minutes. Before: issued hourly.
-
vars(str | None, default:None) –Observation variables (comma-separated). T1H(temperature), UUU(u-wind), VVV(v-wind), VEC(wind direction), WSD(wind speed), PTY(precipitation type), RN1(1h precipitation), REH(humidity)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_village_observation_grid( ... tmfc='202403051010', ... vars='T1H,RN1,REH' ... )
Reference: API_ENDPOINT_Forecast.md - Category 2: Village Forecast Grid Data
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_village_short_term_grid(tmfc=None, tmef=None, vars=None)
¶
Get short-term village forecast grid data (documented endpoint).
Documented endpoint: nph-dfs_shrt_grd (CGI)
Provides short-term forecast grid data for village-level forecasts. Issued 8 times daily (02, 05, 08, 11, 14, 17, 20, 23 KST). Provides hourly forecasts up to 3 days.
Parameters:
-
tmfc(str | datetime | None, default:None) –Forecast issue time in 'YYYYMMDDHHmm' format or datetime object. If None, returns all data. If '0', returns most recent. Issued at 3-hour intervals (02, 05, 08, 11, 14, 17, 20, 23 KST).
-
tmef(str | datetime | None, default:None) –Forecast valid time in 'YYYYMMDDHHmm' format or datetime object. Hourly data provided up to 3 days ahead.
-
vars(str | None, default:None) –Forecast variables (comma-separated). TMP(temperature), TMX(max temp), TMN(min temp), UUU(u-wind), VVV(v-wind), VEC(wind direction), WSD(wind speed), SKY(sky condition), PTY(precipitation type), POP(precipitation probability), PCP(1h precipitation), SNO(1h snowfall), REH(humidity), WAV(wave height)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_village_short_term_grid( ... tmfc='202402250500', ... tmef='202402250600', ... vars='TMP,SKY,PTY' ... )
Reference: API_ENDPOINT_Forecast.md - Category 2: Village Forecast Grid Data
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_village_very_short_term_grid(tmfc=None, tmef=None, vars=None)
¶
Get very short-term village forecast grid data (documented endpoint).
Documented endpoint: nph-dfs_vsrt_grd (CGI)
Provides ultra short-term forecast grid data for village-level forecasts. Issued every 10 minutes. Provides hourly forecasts up to 6 hours ahead.
Parameters:
-
tmfc(str | datetime | None, default:None) –Forecast issue time in 'YYYYMMDDHHmm' format or datetime object. Issued every 10 minutes.
-
tmef(str | datetime | None, default:None) –Forecast valid time in 'YYYYMMDDHHmm' format or datetime object. Hourly data up to 6 hours from issue time.
-
vars(str | None, default:None) –Forecast variables (comma-separated). T1H(temperature), UUU(u-wind), VVV(v-wind), VEC(wind direction), WSD(wind speed), SKY(sky condition), LGT(lightning), PTY(precipitation type), RN1(1h precipitation), REH(humidity)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_village_very_short_term_grid( ... tmfc='202403011010', ... tmef='202403011100', ... vars='T1H,SKY,PTY' ... )
Reference: API_ENDPOINT_Forecast.md - Category 2: Village Forecast Grid Data
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_warning_data(wrn=None, reg=None, tmfc1=None, tmfc2=None, subcd=None, disp=0)
¶
Get weather warning data (documented endpoint).
Documented endpoint: wrn_met_data.php
Retrieves detailed weather warning data for analysis.
Parameters:
-
wrn(str | None, default:None) –Warning type (see get_warning_region for codes). None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc1(str | None, default:None) –Issue time period start. None for most recent.
-
tmfc2(str | None, default:None) –Issue time period end. None for most recent.
-
subcd(str | None, default:None) –Weather comment subtitle code. None for all.
-
disp(int, default:0) –Display level. 0=basic, 1=+warning content, 2=+editor info
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_warning_data( ... wrn='R', tmfc1='201501010000', tmfc2='201502010000' ... )
Reference: API_ENDPOINT_Forecast.md line 541-555
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_warning_image(tm, lat, lon, range, size, wrn, tmef=1, city=1, name=0, stn=None, out=0)
¶
Get weather warning image for arbitrary region (documented endpoint).
Documented endpoint: nph-wrn7 (typ03 CGI)
Retrieves weather warning images for specified regions and warning types.
Parameters:
-
tm(str) –Query time (warning issue time) in YYYYMMDDHHmm format
-
lat(float) –Latitude - center latitude for arbitrary region warning image
-
lon(float) –Longitude - center longitude for arbitrary region warning image
-
range(int) –Display radius in km from center (lat/lon)
-
size(int) –Warning image size in pixels
-
wrn(str) –Warning types (delimiter | for multiple). W=strong wind, R=heavy rain, C=cold wave, D=dry, O=storm surge, V=high waves, T=typhoon, S=heavy snow, Y=yellow dust, H=heat wave
-
tmef(int, default:1) –Issue/effective distinction. 0=issue time basis, 1=effective time basis (default: 1)
-
city(int, default:1) –City/county boundary. 0=not displayed, 1=displayed (default: 1)
-
name(int, default:0) –Administrative district name. 0=not displayed (default), 1=displayed
-
stn(str | None, default:None) –Regional office query. 108=HQ, 133=Daejeon, 159=Busan, 156=Gwangju, 184=Jeju, 105=Gangwon. None for arbitrary region.
-
out(int, default:0) –Output format (default: 0)
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_warning_image( ... tm='201611082300', ... lon=127.7, ... lat=36.1, ... range=300, ... size=685, ... wrn='W,R,C,D,O,V,T,S,Y,H' ... )
Reference: API_ENDPOINT_Forecast.md line 614-634
Source code in python/src/kma_mcp/forecast/forecast_client.py
2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 | |
get_warning_region(wrn=None, reg=None, tmfc1=None, tmfc2=None, subcd=None, disp=0)
¶
Get weather warning region data (documented endpoint).
Documented endpoint: wrn_reg.php
Retrieves weather warning region information for various warning types.
Parameters:
-
wrn(str | None, default:None) –Warning type. W=strong wind, R=heavy rain, C=cold wave, D=dry, O=storm surge, N=tsunami, V=high waves, T=typhoon, S=heavy snow, Y=yellow dust, H=heat wave, F=fog. None for all types.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc1(str | None, default:None) –Issue time period start (YYYYMMDDHHmm). None for most recent.
-
tmfc2(str | None, default:None) –Issue time period end (YYYYMMDDHHmm). None for most recent.
-
subcd(str | None, default:None) –Weather comment subtitle code. 11=ultra-short, 12=short, 13=medium, 99=direct input. None for all.
-
disp(int, default:0) –Display level. 0=basic, 1=+warning content, 2=+editor info
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_warning_region(tmfc1='201501010000', tmfc2='201502010000')
Reference: API_ENDPOINT_Forecast.md line 526-540
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_warning_zone_code(page_no=1, num_of_rows=10, data_type='JSON', kor_name=None)
¶
Get warning zone code information (documented endpoint).
Documented endpoint: WethrBasicInfoService/getWrnZoneCd (OpenAPI)
Retrieves warning zone code information for weather warnings.
Parameters:
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
-
kor_name(str | None, default:None) –Korean name of the region
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_warning_zone_code()
Reference: API_ENDPOINT_Forecast.md line 730-735
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_weather_commentary(tmfc1=None, tmfc2=None, stn='0', subcd='0', disp=0)
¶
Get weather commentary/explanation reports (documented endpoint).
Documented endpoint: wthr_cmt_rpt.php
Retrieves weather commentary and explanation reports from forecasters.
Parameters:
-
tmfc1(str | None, default:None) –Issue time period start. None for most recent.
-
tmfc2(str | None, default:None) –Issue time period end. None for most recent.
-
stn(str, default:'0') –Station number (default: '0' for all)
-
subcd(str, default:'0') –Weather comment subtitle code (default: '0' for all)
-
disp(int, default:0) –Display level. 0=basic, 1=+warning content, 2=+editor info
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_weather_commentary( ... tmfc1='202004130000', tmfc2='202004140000' ... )
Reference: API_ENDPOINT_Forecast.md line 571-585
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_weather_information(wrn=None, reg=None, tmfc1=None, tmfc2=None, stn='0', subcd=None, disp=0)
¶
Get weather information reports (documented endpoint).
Documented endpoint: wrn_inf_rpt.php
Retrieves weather information and alert reports.
Parameters:
-
wrn(str | None, default:None) –Warning type. None for all.
-
reg(str | None, default:None) –Forecast region code. None for all.
-
tmfc1(str | None, default:None) –Issue time period start. None for most recent.
-
tmfc2(str | None, default:None) –Issue time period end. None for most recent.
-
stn(str, default:'0') –Station number (default: '0' for all)
-
subcd(str | None, default:None) –Weather comment subtitle code. None for all.
-
disp(int, default:0) –Display level. 0=basic, 1=+warning content, 2=+editor info
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_weather_information( ... tmfc1='201505010000', tmfc2='201506010000' ... )
Reference: API_ENDPOINT_Forecast.md line 556-570
Source code in python/src/kma_mcp/forecast/forecast_client.py
get_weather_situation(page_no=1, num_of_rows=10, data_type='JSON', stn_id=None)
¶
Get weather situation overview messages (documented endpoint).
Documented endpoint: VilageFcstMsgService/getWthrSituation (OpenAPI)
Retrieves weather situation overview messages issued by regional offices. These messages provide general weather conditions and forecasts.
Parameters:
-
page_no(int, default:1) –Page number (default: 1)
-
num_of_rows(int, default:10) –Number of results per page (default: 10)
-
data_type(str, default:'JSON') –Response data format - 'XML' or 'JSON' (default: 'JSON')
-
stn_id(str | None, default:None) –Issuing office code. None for all offices. 108=KMA HQ, 109=Seoul, etc. See reference documentation.
Returns:
Example
client = ForecastClient(auth_key='your_key') data = client.get_weather_situation(stn_id='108', num_of_rows=5)
Reference: API_ENDPOINT_Forecast.md - Category 3: Village Forecast Messages