Created
August 3, 2022 22:17
-
-
Save erichare/c67a9202c9d47220ea60d7a9fb424264 to your computer and use it in GitHub Desktop.
Functions to interface with the noaa-sdk package
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def available_wx_data(country_code, postal_code): | |
res = n.get_observations(postal_code, country_code) | |
return sorted(list(list(res)[0].keys())), res | |
def forecast(country_code, postal_code, vars, dat=None): | |
if not dat: | |
dat = n.get_forecasts(postal_code, country_code, type='forecastGridData') | |
return {k:v for k, v in dat.items() if k in vars} | |
def observations(country_code, postal_code, vars, dat=None): | |
if not dat: | |
dat = n.get_observations(postal_code, country_code) | |
return {k:v for k, v in list(dat)[0].items() if k in vars} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment