meteortools.ukmondb.getMatches
Examples showing how to use the APIs.
1# 2# Example showing how to use the matchdata API from Python 3# 4# Copyright (C) 2018-2023 Mark McIntyre 5 6""" 7Examples showing how to use the APIs. 8""" 9import pandas as pd 10 11 12def getMatchesForDate(dtstr): 13 """get names of all matches for a given date 14 15 Arguments: 16 dtstr: [string] date in YYYYMMDD format 17 18 Returns: 19 list of matches for that date 20 21 """ 22 apiurl = 'https://api.ukmeteors.co.uk/matches' 23 apicall = f'{apiurl}?reqtyp=matches&reqval={dtstr}' 24 matchlist = pd.read_json(apicall, lines=True) 25 return matchlist 26 27 28def getDetailsOfMatch(eventstr): 29 """ get details of one matched event 30 31 Arguments: 32 dtstr: [string] event name eg 20230826_000424.273_UK 33 34 Returns: 35 pandas series containing the event details 36 37 """ 38 apiurl = 'https://api.ukmeteors.co.uk/matches' 39 apicall = f'{apiurl}?reqtyp=detail&reqval={eventstr}' 40 evtdetail = pd.read_json(apicall, typ='series') 41 return evtdetail 42 43 44def getDetailOfMatchList(matchlist): 45 """ 46 get details for multiple events 47 48 Arguments: 49 matchlist: [list] list of matched events as returned by getMatchesForDate 50 51 Returns: 52 pandas dataframe containing the event details 53 54 """ 55 apiurl = 'https://api.ukmeteors.co.uk/matches' 56 details = [] 57 for id in matchlist.orbname: 58 reqval = id 59 apicall = f'{apiurl}?reqtyp=detail&reqval={reqval}' 60 details.append(pd.read_json(apicall, typ='series')) 61 df = pd.DataFrame(details) 62 df = df.sort_values(by=['_mag']) 63 return df
def
getMatchesForDate(dtstr):
13def getMatchesForDate(dtstr): 14 """get names of all matches for a given date 15 16 Arguments: 17 dtstr: [string] date in YYYYMMDD format 18 19 Returns: 20 list of matches for that date 21 22 """ 23 apiurl = 'https://api.ukmeteors.co.uk/matches' 24 apicall = f'{apiurl}?reqtyp=matches&reqval={dtstr}' 25 matchlist = pd.read_json(apicall, lines=True) 26 return matchlist
get names of all matches for a given date
Arguments:
dtstr: [string] date in YYYYMMDD format
Returns: list of matches for that date
def
getDetailsOfMatch(eventstr):
29def getDetailsOfMatch(eventstr): 30 """ get details of one matched event 31 32 Arguments: 33 dtstr: [string] event name eg 20230826_000424.273_UK 34 35 Returns: 36 pandas series containing the event details 37 38 """ 39 apiurl = 'https://api.ukmeteors.co.uk/matches' 40 apicall = f'{apiurl}?reqtyp=detail&reqval={eventstr}' 41 evtdetail = pd.read_json(apicall, typ='series') 42 return evtdetail
get details of one matched event
Arguments:
dtstr: [string] event name eg 20230826_000424.273_UK
Returns: pandas series containing the event details
def
getDetailOfMatchList(matchlist):
45def getDetailOfMatchList(matchlist): 46 """ 47 get details for multiple events 48 49 Arguments: 50 matchlist: [list] list of matched events as returned by getMatchesForDate 51 52 Returns: 53 pandas dataframe containing the event details 54 55 """ 56 apiurl = 'https://api.ukmeteors.co.uk/matches' 57 details = [] 58 for id in matchlist.orbname: 59 reqval = id 60 apicall = f'{apiurl}?reqtyp=detail&reqval={reqval}' 61 details.append(pd.read_json(apicall, typ='series')) 62 df = pd.DataFrame(details) 63 df = df.sort_values(by=['_mag']) 64 return df
get details for multiple events
Arguments:
matchlist: [list] list of matched events as returned by getMatchesForDate
Returns: pandas dataframe containing the event details