# Version 2.0 update # 9 November 2016 (The day Trump won the presidential election) # Plot the temperature climotology for a station's lifetime from datetime import datetime import json import urllib2 from get_token import my_token # returns my personal token from convert_MW_date import MWdate_to_datetime import numpy as np # Get your own key and token from here: https://mesowest.org/api/signup/ token = my_token() def get_mesowest_climatology(station, start, end, variables='air_temp'): """ Get data from MesoWest Climatology service for a station between two dates. Input: station - MesoWest station id as a string.a start - 'mmddHHMM' end - 'mmddHHMM' To Do: [ ] Somehow convert the input as a datetime object, not string """ # Convert datetime object to MesoWest input date string
# Brian Blaylock # 17 Feb. 2015 # pylint: disable=C0103 # Function for getting MesoWest time series from the API for one station from datetime import datetime import json import numpy as np from get_token import my_token # returns my personal token import urllib2 token = my_token() # Request your own token at http://mesowest.org/api/signup/ variables = 'T_water_temp,wind_direction,wind_speed,wind_gust,air_temp,dew_point_temperature,relative_humidity' def get_buoy_ts(start_time, end_time, stationID='GSLBY'): """ Makes a time series query from the MesoWest API Input: stationID : string of the station ID start_time : datetime object of the start time in UTC end_time : datetime object of the end time in UTC Output: a dictionary of the data """ # convert the start and end time to the string format requried by the API