Пример #1
0
def ice23(lstData, Num):
    """write data from block =23 to list of lists"""
    from Functions import DataToLists, ObjectNumCheck

    # copypaste DataICE22
    lstDataIce23_1, lstDataIce23_2 = [], []
    for x in range(0, 22, 1):
        lstDataIce23_1.append([])
        lstDataIce23_2.append([])
        for y in range(0, Num, 1):
            lstDataIce23_1[x].append('-')
            lstDataIce23_2[x].append('-')
    # Searching cycle begin
    for i in range(0, len(lstData), 1):
        # Needed numbers are next to string
        if type(lstData[i]) == str:
            # Looking for full block =23 with data
            if lstData[i] == '=23' and lstData[i+1] != "-":
                # and data for 1 ice object
                if ObjectNumCheck(lstData, i) == 1:
                    DataToLists(lstData, i, *lstDataIce23_1)
                # and data for 1 ice object
                if ObjectNumCheck(lstData, i) == 2:
                    DataToLists(lstData, i, *lstDataIce23_2)
    return lstDataIce23_1, lstDataIce23_2
Пример #2
0
def ice21(lstData, Num):
    """ Write ice data after blocks =21, =25 into lists.
        Its always have constant amount of parts
        unlike =22,=23,=24"""

    from Functions import DataToLists, ObjectNumCheck
    lstIceTime1, lstIceVis1, lstIceWDir1, lstIceWSpd1, \
        lstIceTa1, lstIceTw1 = [], [], [], [], [], [],
    lstChar11, lstChar12, lstChar13, lstChar14, lstChar15, \
        lstChar16 = [], [], [], [], [], []
    lstIceTime2, lstIceVis2, lstIceWDir2, lstIceWSpd2, \
        lstIceTa2, lstIceTw2 = [], [], [], [], [], []
    lstChar21, lstChar22, lstChar23, lstChar24, lstChar25, \
        lstChar26 = [], [], [], [], [], []
    for L in (lstIceTime1, lstIceVis1, lstIceWDir1, lstIceWSpd1, lstIceTa1,
              lstIceTw1, lstIceTime2, lstIceVis2, lstIceWDir2, lstIceWSpd2,
              lstIceTa2, lstIceTw2, lstChar11, lstChar12, lstChar13, lstChar14,
              lstChar15, lstChar16, lstChar21, lstChar22, lstChar23, lstChar24,
              lstChar25, lstChar26):
        for n in range(0, Num, 1):
            L.append('-')
    for i in range(0, len(lstData), 1):  # Searching cycle begin
        if type(lstData[i]) == str:  # Needed numbers are next to string
            if lstData[i] == '=21' and lstData[
                    i + 1] != "-":  # Looking for full block =21 with data
                if ObjectNumCheck(lstData,
                                  i) == 1:  # and data for 1 ice object
                    DataToLists(lstData, i, lstIceTime1, lstIceVis1,
                                lstIceWDir1, lstIceWSpd1, lstIceTa1, lstIceTw1)
                elif ObjectNumCheck(lstData,
                                    i) == 2:  # and data for 2 ice object
                    DataToLists(lstData, i, lstIceTime2, lstIceVis2,
                                lstIceWDir2, lstIceWSpd2, lstIceTa2, lstIceTw2)
            if lstData[i] == '=25':  # Looking for full block =21 with data
                if ObjectNumCheck(lstData,
                                  i) == 1:  # and data for 1 ice object
                    DataToLists(lstData, i, lstChar11, lstChar12, lstChar13,
                                lstChar14, lstChar15, lstChar16)
                elif ObjectNumCheck(lstData,
                                    i) == 2:  # and data for 2 ice object
                    DataToLists(lstData, i, lstChar21, lstChar22, lstChar23,
                                lstChar24, lstChar25, lstChar26)
    return lstIceTime1, lstIceVis1, lstIceWDir1, lstIceWSpd1, \
           lstIceTa1, lstIceTw1, lstIceTime2, lstIceVis2, \
           lstIceWDir2, lstIceWSpd2, lstIceTa2, lstIceTw2,\
           lstChar11, lstChar12, lstChar13, lstChar14, lstChar15,\
           lstChar16, lstChar21, lstChar22, lstChar23, lstChar24, \
           lstChar25, lstChar26
Пример #3
0
def hour_levels(lstData, Num):
    '''Extracting hour-levels'''
    from Functions import DayHour24, BlockIdx, DataToLists

    lstHourLvls = []
    lstMaxTime, lstMaxLvl, lstMinTime, lstMinLvl = [], [], [], []
    lstHiUpTime, lstHiUpLvl, lstHiDwTime, lstHiDwLvl, lstLowHiTime, \
        lstLowHiLvl, lstLowDwTime, lstLowDwLvl = [], [], [], [], [], [], [], []
    # create list exclusively for hour-levels
    for n in range(0, 24*Num, 1):
        lstHourLvls.append('-')
    for L in (lstMaxTime, lstMaxLvl, lstMinTime, lstMinLvl, lstHiUpTime,
              lstHiUpLvl, lstHiDwTime, lstHiDwLvl, lstLowHiTime,
              lstLowHiLvl, lstLowDwTime, lstLowDwLvl):
        for n in range(0, Num, 1):
            L.append('-')
    # Searching cycle begins
    for i in range(0, len(lstData), 1):
        # Needed numbers are next to string
        if type(lstData[i]) == str:
            # Hour-levels search
            if BlockIdx(lstData[i]) == 7:
                z = 0
                while z < 24:
                    if str(lstData[i+z+1])[0:2] == '((':
                        break
                    if type(lstData[i+z+1]) == int:
                        lstHourLvls[DayHour24(lstData, i)+z] = lstData[i+z+1]
                    z += 1
            # Max and min for a day
            if BlockIdx(lstData[i]) == 8:
                DataToLists(lstData, i, lstMaxTime, lstMaxLvl, lstMinTime, lstMinLvl)
            # Extremums of daily sea levels
            if BlockIdx(lstData[i]) == 9:
                DataToLists(lstData, i, lstHiUpTime, lstHiUpLvl,
                            lstHiDwTime, lstHiDwLvl, lstLowHiTime,
                            lstLowHiLvl, lstLowDwTime, lstLowDwLvl)
    return lstHourLvls, lstMaxTime, lstMaxLvl, lstMinTime, lstMinLvl, \
           lstHiUpTime, lstHiUpLvl, lstHiDwTime, lstHiDwLvl, lstLowHiTime, \
           lstLowHiLvl, lstLowDwTime, lstLowDwLvl
Пример #4
0
def ice22(lstData, Num):
    """Write data from block =22 to list of lists"""
    from Functions import DataToLists, ObjectNumCheck

    lstDataIce22_1, lstDataIce22_2 = [], []
    # yeah, don't wanna manually write vars, cycles is better this time
    for x in range(0, 19, 1):
        lstDataIce22_1.append([])
        lstDataIce22_2.append([])
        for y in range(0, Num, 1):
            lstDataIce22_1[x].append('-')
            lstDataIce22_2[x].append('-')
    for i in range(0, len(lstData), 1):  # Searching cycle begin
        if type(lstData[i]) == str:  # Needed numbers are next to string
            if lstData[i] == '=22' and lstData[
                    i + 1] != "-":  # Looking for full block =22 with data
                if ObjectNumCheck(lstData,
                                  i) == 1:  # and data for 1 ice object
                    DataToLists(lstData, i, *lstDataIce22_1)
                if ObjectNumCheck(lstData,
                                  i) == 2:  # and data for 1 ice object
                    DataToLists(lstData, i, *lstDataIce22_2)
    return lstDataIce22_1, lstDataIce22_2
Пример #5
0
def ice26(lstData, Num):
    """write data from blocks =26 and = 27 to list of lists"""
    from Functions import DataToLists, ObjectNumCheck

    lstDataIce26_1, lstDataIce26_2 = [], []
    lstDataIce27_1, lstDataIce27_2 = [], []
    for x in range(0, 6, 1):
        lstDataIce26_1.append([])
        lstDataIce26_2.append([])
        lstDataIce27_1.append([])
        lstDataIce27_2.append([])
        for y in range(0, Num, 1):
            lstDataIce26_1[x].append('-')
            lstDataIce26_2[x].append('-')
            lstDataIce27_1[x].append('-')
            lstDataIce27_2[x].append('-')
    # Searching cycle begin
    for i in range(0, len(lstData), 1):
        # Needed numbers are next to string
        if type(lstData[i]) == str:
            # Looking for full block =21 with data
            if lstData[i] == '=26' and lstData[i + 1] != "-":
                # data for 1 ice object
                if ObjectNumCheck(lstData, i) == 1:
                    DataToLists(lstData, i, *lstDataIce26_1)
                # data for 2 ice object
                elif ObjectNumCheck(lstData, i) == 2:
                    DataToLists(lstData, i, *lstDataIce26_2)
            # Looking for full block =21 with data
            if lstData[i] == '=27' and lstData[i + 1] != "-":
                # data for 1 ice object
                if ObjectNumCheck(lstData, i) == 1:
                    DataToLists(lstData, i, *lstDataIce27_1)
                # data for 2 ice object
                elif ObjectNumCheck(lstData, i) == 2:
                    DataToLists(lstData, i, *lstDataIce27_2)
    return lstDataIce26_1, lstDataIce26_2, lstDataIce27_1, lstDataIce27_2
Пример #6
0
def data_hy_met(lstData, Num):
    """Search through lstData for values in blocks = 01, =02, =03
       Return as tuple"""
    from Functions import DataToLists, BlockIdx

    # Creating 'empty' lists to write in later
    lstVis, lstWeath, lstWDir, lstWSpd, \
        lstWGst, lstTemp, lstLevels = [], [], [], [], [], [], []
    lstAirTemp, lstAirTempWet, lstPres, \
        lstFullCld, lstLowCld, lstHmdt = [], [], [], [], [], []
    lstWaveType, lstWaveDirM, lstWaveDirS, \
        lstWaveHav, lstWaveHmx, lstWavePer, lstWaveLen = [], [], [], [], [], [], []
    for L in (
            lstVis, lstWeath, lstWDir, lstWSpd, lstWGst, lstTemp, lstLevels,
            lstAirTemp, lstAirTempWet, lstPres, lstFullCld, lstLowCld, lstHmdt,
            lstWaveType, lstWaveDirM, lstWaveDirS, lstWaveHav, lstWaveHmx,
            lstWavePer,
            lstWaveLen):  # Filling list with '-' to write data correctly later
        for n in range(0, 4 * Num, 1):
            L.append('-')
    for i in range(0, len(lstData), 1):  # Searching cycle begins
        if type(lstData[i]) == str:  # Needed numbers are next to string
            # Looking for full block =01 with data
            if BlockIdx(lstData[i]) == 1 and lstData[i + 1] != "-":
                DataToLists(lstData, i, lstVis, lstWeath, lstWDir, lstWSpd,
                            lstWGst, lstTemp, lstLevels)
            # Looking for full block =06 with data
            if BlockIdx(lstData[i]) == 6 and lstData[i + 1] != "-":
                DataToLists(lstData, i, lstAirTemp, lstAirTempWet, lstPres,
                            lstFullCld, lstLowCld, lstHmdt)
            # Looking for full block =02 with data
            if BlockIdx(lstData[i]) == 2 and lstData[i + 1] != "-" and lstData[
                    i + 1] != "/":
                DataToLists(lstData, i, lstWaveType, lstWaveDirM, lstWaveDirS,
                            lstWaveHav, lstWaveHmx, lstWavePer, lstWaveLen)
    return lstVis, lstWeath, lstWDir, lstWSpd, lstWGst, lstTemp, lstLevels