meteortools.utils.getActiveShowers

 1# Copyright (C) 2018-2023 Mark McIntyre
 2#
 3# simple script to get the active shower list from the IMO working list
 4
 5try:
 6    from ..fileformats import imoWorkingShowerList as iwsl
 7except Exception:
 8    from meteortools.fileformats import imoWorkingShowerList as iwsl
 9
10import datetime
11
12
13def getActiveShowers(targdate, retlist=False, inclMinor=False):
14    """
15    Return a list of showers active at the specified date  
16
17    Arguments:  
18        targdate:   [str] Date in YYYYMMDD format  
19
20    Keyword Arguments:  
21        retlist:    [bool] return a list, or print to console. Default False=print  
22        inclMinor:  [bool] include minor showers or only return major showers  
23
24    Returns:  
25        If retlist is true, returns a python list of shower short-codes eg ['PER','LYR']  
26
27    """
28    sl = iwsl.IMOshowerList()
29    testdate = datetime.datetime.strptime(targdate, '%Y%m%d')
30    listofshowers=sl.getActiveShowers(testdate, True, inclMinor=inclMinor)
31    if retlist is False:
32        for shwr in listofshowers:
33            print(shwr)
34    else:
35        return listofshowers
36
37
38def getActiveShowersStr(targdatestr):
39    """
40    Prints a comma-separated list of showers active at the specified date  
41
42    Arguments:  
43        targdate:   [str] Date in YYYYMMDD format  
44
45    Returns:  
46        nothing  
47
48    """
49    shwrs = getActiveShowers(targdatestr, retlist=True)
50    shwrs.append('spo')
51    for s in shwrs:
52        print(s)
def getActiveShowers(targdate, retlist=False, inclMinor=False):
14def getActiveShowers(targdate, retlist=False, inclMinor=False):
15    """
16    Return a list of showers active at the specified date  
17
18    Arguments:  
19        targdate:   [str] Date in YYYYMMDD format  
20
21    Keyword Arguments:  
22        retlist:    [bool] return a list, or print to console. Default False=print  
23        inclMinor:  [bool] include minor showers or only return major showers  
24
25    Returns:  
26        If retlist is true, returns a python list of shower short-codes eg ['PER','LYR']  
27
28    """
29    sl = iwsl.IMOshowerList()
30    testdate = datetime.datetime.strptime(targdate, '%Y%m%d')
31    listofshowers=sl.getActiveShowers(testdate, True, inclMinor=inclMinor)
32    if retlist is False:
33        for shwr in listofshowers:
34            print(shwr)
35    else:
36        return listofshowers

Return a list of showers active at the specified date

Arguments:
targdate: [str] Date in YYYYMMDD format

Keyword Arguments:
retlist: [bool] return a list, or print to console. Default False=print
inclMinor: [bool] include minor showers or only return major showers

Returns:
If retlist is true, returns a python list of shower short-codes eg ['PER','LYR']

def getActiveShowersStr(targdatestr):
39def getActiveShowersStr(targdatestr):
40    """
41    Prints a comma-separated list of showers active at the specified date  
42
43    Arguments:  
44        targdate:   [str] Date in YYYYMMDD format  
45
46    Returns:  
47        nothing  
48
49    """
50    shwrs = getActiveShowers(targdatestr, retlist=True)
51    shwrs.append('spo')
52    for s in shwrs:
53        print(s)

Prints a comma-separated list of showers active at the specified date

Arguments:
targdate: [str] Date in YYYYMMDD format

Returns:
nothing