2

I am able get the values of TMAX, TMIN, AWND (Wind Speed) etc. Unable to find how to get Dew Point, Humidity and Pressure from the API

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

I use Python to get historical data.

Can any one guide me in this regard.

Thanks

Murthy Pydikondala
  • 447
  • 1
  • 4
  • 15

1 Answers1

1

Run this request.
url='http://www.ncdc.noaa.gov/cdo-web/api/v2/datatypes?limit=1000' Then search for DEW when the results are done

id : HLY-DEWP-10PCTL maxdate : 2010-12-31 datacoverage : 1 name : Dew point 10th percentile mindate : 2010-01-01 id : HLY-DEWP-90PCTL maxdate : 2010-12-31 datacoverage : 1 name : Dew point 90th percentile mindate : 2010-01-01 id : HLY-DEWP-NORMAL maxdate : 2010-12-31 datacoverage : 1 name : Dew point mean mindate : 2010-01-01 id : HLY-HIDX-NORMAL maxdate : 2010-12-31 datacoverage : 1 name : Heat index mean mindate : 2010-01-01 id : HLY-HTDH-NORMAL

THEN RUN THIS, As I understand it.. DEW points are stored in the NORMAL_HRL url= 'http://www.ncdc.noaa.gov/cdo-web/api/v2/datasets?datatypeid=HLY-DEWP-10PCTL' id: NORMAL_HRL, name : Normals Hourly

This also works ... but? url='http://www.ncdc.noaa.gov/cdo-web/api/v2/datatypes/HLY-DEWP-10PCTL'

This returns all stations with DEW. need to refine it down to 1 station,28000 records returned url='http://www.ncdc.noaa.gov/cdo-web/api/v2/locations?datatypeid=HLY-DEWP-10PCTL'

Not a perfect Answer but this should get you somewhere

Here some Python code

import requests, json
def dumpclean(obj):
 if type(obj) == dict:
    for k, v in obj.items():
        if hasattr(v, '__iter__'):
           print k
           dumpclean(v)
        else:
          print '%s : %s' % (k, v)
 elif type(obj) == list:
    for v in obj:
        if hasattr(v, '__iter__'):
            dumpclean(v)
        else:
            print v
 else:
    print obj


#url ='http://www.ncdc.noaa.gov/cdo-web/api/v2/data?     limit=726&datasetid=GHCND&stationid=GHCND:USC00350694&units=standard&startdate=201 6-10-31&enddate=2016-10-31&datatypeid=TMAX&datatypeid=TMIN'
url='http://www.ncdc.noaa.gov/cdo-web/api/v2/datacategories'
#url='http://www.ncdc.noaa.gov/cdo-web/api/v2/datacategories/LAND'
#url='http://www.ncdc.noaa.gov/cdo-web/api/v2/datatypes?datacategoryid=HYDROMETEOR&limit=100'
#url='http://www.ncdc.noaa.gov/cdo-web/api/v2/datatypes?limit=10'
#url='http://www.ncdc.noaa.gov/cdo-web/api/v2/data?  datasetid=PRECIP_15&stationid=COOP:010008&units=metric&startdate=2010-05-01&enddate=2010-05-31'
#url= 'http://www.ncdc.noaa.gov/cdo-web/api/v2/datasets?datatypeid=HLY-DEWP-10PCTL'
#url='http://www.ncdc.noaa.gov/cdo-web/api/v2/datatypes/HLY-DEWP-10PCTL'
#url='http://www.ncdc.noaa.gov/cdo-web/api/v2/data?datasetid=GHCND&locationid=ZIP:28801&startdate=2010-05-01&enddate=2010-05-01'
url='http://www.ncdc.noaa.gov/cdo-web/api/v2/stations/COOP:010008'

headers = {'token': 'YOURCODEKEY'}
response = requests.get(url, headers = headers)
json_data = json.loads(response.text)
#print str(json_data)
obj = response.json()
dumpclean(obj)
dirtsniffer
  • 139
  • 1
  • 6