Данные метеокомпании IBM, максимальная температура и минимальная температура для дневной и ночной части прогноза

В случае прогноза IBM Weather Company Data, какой ключ дает максимальную и минимальную температуру для дневной и ночной части прогноза? В настоящее время я использую:

nightHigh = result.forecasts[0].night.hi;
nightLow = result.forecasts[0].night.wc;

Вот JSON, полученный от вызова API.

{
"metadata": {
    "language": "en-US",
    "transaction_id": "1500467819366:918701294",
    "version": "1",
    "latitude": 36.11,
    "longitude": -115.17,
    "units": "e",
    "expire_time_gmt": 1500469259,
    "status_code": 200
},
"forecasts": [
    {
        "class": "fod_long_range_daily",
        "expire_time_gmt": 1500469259,
        "fcst_valid": 1500472800,
        "fcst_valid_local": "2017-07-19T07:00:00-0700",
        "num": 1,
        "max_temp": 98,
        "min_temp": 81,
        "torcon": null,
        "stormcon": null,
        "blurb": null,
        "blurb_author": null,
        "lunar_phase_day": 25,
        "dow": "Wednesday",
        "lunar_phase": "Waning Crescent",
        "lunar_phase_code": "WNC",
        "sunrise": "2017-07-19T05:38:06-0700",
        "sunset": "2017-07-19T19:55:22-0700",
        "moonrise": "2017-07-19T02:05:45-0700",
        "moonset": "2017-07-19T16:14:29-0700",
        "qualifier_code": null,
        "qualifier": null,
        "narrative": "More clouds than sun. Highs in the upper 90s and lows in the low 80s.",
        "qpf": 0,
        "snow_qpf": 0,
        "snow_range": "",
        "snow_phrase": "",
        "snow_code": "",
        "night": {
            "fcst_valid": 1500516000,
            "fcst_valid_local": "2017-07-19T19:00:00-0700",
            "day_ind": "N",
            "thunder_enum": 0,
            "daypart_name": "Tonight",
            "long_daypart_name": "Wednesday night",
            "alt_daypart_name": "Tonight",
            "thunder_enum_phrase": "No thunder",
            "num": 2,
            "temp": 81,
            "hi": 95,
            "wc": 82,
            "pop": 0,
            "icon_extd": 2900,
            "icon_code": 29,
            "wxman": "wx1600",
            "phrase_12char": "P Cloudy",
            "phrase_22char": "Partly Cloudy",
            "phrase_32char": "Partly Cloudy",
            "subphrase_pt1": "Partly",
            "subphrase_pt2": "Cloudy",
            "subphrase_pt3": "",
            "precip_type": "rain",
            "rh": 44,
            "wspd": 9,
            "wdir": 135,
            "wdir_cardinal": "SE",
            "clds": 61,
            "pop_phrase": "",
            "temp_phrase": "Low 81F.",
            "accumulation_phrase": "",
            "wind_phrase": "Winds SE at 5 to 10 mph.",
            "shortcast": "Partly cloudy",
            "narrative": "Partly cloudy skies. Low 81F. Winds SE at 5 to 10 mph.",
            "qpf": 0,
            "snow_qpf": 0,
            "snow_range": "",
            "snow_phrase": "",
            "snow_code": "",
            "vocal_key": "D2:DA02:X3000300021:S300021:TL81:W06R02",
            "qualifier_code": null,
            "qualifier": null,
            "uv_index_raw": 0,
            "uv_index": 0,
            "uv_warning": 0,
            "uv_desc": "Low",
            "golf_index": null,
            "golf_category": ""
        },
        "day": {
            "fcst_valid": 1500472800,
            "fcst_valid_local": "2017-07-19T07:00:00-0700",
            "day_ind": "D",
            "thunder_enum": 0,
            "daypart_name": "Today",
            "long_daypart_name": "Wednesday",
            "alt_daypart_name": "Today",
            "thunder_enum_phrase": "No thunder",
            "num": 1,
            "temp": 98,
            "hi": 99,
            "wc": 90,
            "pop": 10,
            "icon_extd": 2800,
            "icon_code": 28,
            "wxman": "wx1230",
            "phrase_12char": "M Cloudy",
            "phrase_22char": "Mostly Cloudy",
            "phrase_32char": "Mostly Cloudy",
            "subphrase_pt1": "Mostly",
            "subphrase_pt2": "Cloudy",
            "subphrase_pt3": "",
            "precip_type": "rain",
            "rh": 36,
            "wspd": 11,
            "wdir": 137,
            "wdir_cardinal": "SE",
            "clds": 75,
            "pop_phrase": "",
            "temp_phrase": "High 98F.",
            "accumulation_phrase": "",
            "wind_phrase": "Winds SE at 10 to 15 mph.",
            "shortcast": "More clouds than sun",
            "narrative": "Mostly cloudy. High 98F. Winds SE at 10 to 15 mph.",
            "qpf": 0,
            "snow_qpf": 0,
            "snow_range": "",
            "snow_phrase": "",
            "snow_code": "",
            "vocal_key": "D1:DA01:X2600280011:S280013:TH98:W06R03",
            "qualifier_code": null,
            "qualifier": null,
            "uv_index_raw": 8.22,
            "uv_index": 8,
            "uv_warning": 0,
            "uv_desc": "Very High",
            "golf_index": 7,
            "golf_category": "Good"
        }
    }
],
"address": "Las Vegas",
"temperatureUnits": "fahrenheit",
"phrase": "You don't need umbrella. Today's rain fall probability is 10% in Las Vegas."

}


person Ketu    schedule 25.07.2017    source источник


Ответы (1)


wc — это индикатор охлаждения ветром, а не минимальной температуры.

Самое близкое, что у вас есть, это result.forecasts[:].max_temp и result.forecasts[:].min_temp, которые являются ключами для максимальной и минимальной температуры (соответственно) за весь дневной период.

Похоже, вы используете API 'Прогноз в течение дня'. Если вы выберете API 'Hourly Forecast', вы будете получать почасовые данные о температуре, что позволит вам анализировать минимальные и максимальные значения для дневных и ночных периодов.

person igrolvr    schedule 23.08.2017