2017-07-25 68 views
0

對於IBM天氣預報公司的數據預測,哪個密鑰提供了預測的晝夜部分的最高和最低溫度?我目前使用:IBM天氣公司數據,預測的日間和夜間部分的最高溫度和最低溫度

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

這裏是從API調用接收到的JSON。

{ 
"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." 

}

回答

0

wc爲風寒,不是最小溫度指示器。

您最接近的是result.forecasts[:].max_tempresult.forecasts[:].min_temp,這是全天最高和最低溫度(分別)的關鍵。

您似乎正在使用「每日預測」 API。如果您選擇「每小時預測」 API,您將收到每小時的溫度數據,這將允許您分析晝夜的最小/最大值