【问题标题】:NOAA API returning impossible historical temperature valuesNOAA API 返回不可能的历史温度值
【发布时间】:2018-08-23 03:12:28
【问题描述】:

API:

https://www.ncdc.noaa.gov/cdo-web/webservices/v2

参数:

CITY:US270013 指定明尼苏达州明尼阿波利斯

datatypeid=TOBS 指定我想要观察到的温度

Python 代码

url = 'https://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&locationid=CITY:US270013&startdate=2016-05-01&enddate=2016-05-31&limit=1000&datatypeid=TOBS'

response = requests.get(url, headers = headers)
response = response.json()
stationData = pd.DataFrame(response['results'])
print(stationData.sort_values(by='station').to_string(index=False))

结果:

attributes datatype                 date            station  value
 ,,7,2400     TOBS  2016-05-01T00:00:00  GHCND:USC00211448     89
 ,,7,2400     TOBS  2016-05-14T00:00:00  GHCND:USC00211448      6
 ,,7,2400     TOBS  2016-05-07T00:00:00  GHCND:USC00211448     61
 ,,7,2400     TOBS  2016-05-16T00:00:00  GHCND:USC00211448    106
 ,,7,2400     TOBS  2016-05-26T00:00:00  GHCND:USC00211448    172
 ,,7,2400     TOBS  2016-05-28T00:00:00  GHCND:USC00211448    161
 ,,7,2400     TOBS  2016-05-17T00:00:00  GHCND:USC00211448     50
 ,,7,2400     TOBS  2016-05-06T00:00:00  GHCND:USC00211448    178

根据该表,2015 年 5 月 6 日,明尼阿波利斯的观测温度为 178 度。这显然是错误的,但他们的网站上几乎没有文档。他们的TOBS 是否遵循不同的温度标度,还是我应该使用不同的变量?

【问题讨论】:

    标签: python weather-api noaa


    【解决方案1】:

    来自文档:

    ftp://ftp.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt

    TOBS = Temperature at the time of observation (tenths of degrees C)
    

    将您的结果除以 10,乘以 9/5 + 32 以转换为 F(或您需要做的任何事情)。

    明尼阿波利斯五月会很冷!

    【讨论】:

      猜你喜欢
      • 2019-06-27
      • 2015-08-15
      • 1970-01-01
      • 2017-09-18
      • 2013-11-27
      • 2014-11-15
      • 2017-11-29
      • 2023-02-02
      • 2020-06-02
      相关资源
      最近更新 更多