Skip to content

Instantly share code, notes, and snippets.

@erichare
Created August 3, 2022 22:17
Show Gist options
  • Save erichare/c67a9202c9d47220ea60d7a9fb424264 to your computer and use it in GitHub Desktop.
Save erichare/c67a9202c9d47220ea60d7a9fb424264 to your computer and use it in GitHub Desktop.
Functions to interface with the noaa-sdk package
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