Exemplo n.º 1
0
lines1 = tuple(open(time.strftime('Download/Solar-TILT_ANGLE%m-%d-%Y.txt'), "r"))
fileRav = open(time.strftime('Tilt_R_av.txt'), "w+")
fileRn =  open(time.strftime('Tilt_R_n.txt'), "w+")
fileRs =  open(time.strftime('Tilt_R_s.txt'), "w+")
fileLav = open(time.strftime('Tilt_L_av.txt'), "w+")
fileLn =  open(time.strftime('Tilt_L_n.txt'), "w+")
fileLs =  open(time.strftime('Tilt_L_s.txt'), "w+")


#splitto in colonne le varie righe
for j in range(len(lines1)-1):
   sline = lines1[j].split()
   year  = int(sline[2][0]+sline[2][1]+sline[2][2]+sline[2][3])
   month = int(sline[2][5]+sline[2][6])
   day   = int(sline[2][8]+sline[2][9])
   print(str(g2j(year,month,day)))
   a = str(g2j(year,month,day))
   fileRav.write(a + "  " + sline[4] + "\n")
   fileRn.write(a  + "  " + sline[5] + "\n")
   fileRs.write(a  + "  " + sline[6] + "\n")
   fileLav.write(a + "  " + sline[7] + "\n")
   fileLn.write(a  + "  " + sline[8] + "\n")
   fileLs.write(a  + "  " + sline[9] + "\n")
#chiudo e salvo file
f.close()
fileRav.close()
fileRn.close()
fileRs.close()
fileLav.close()
fileLn.close()
fileLs.close()
Exemplo n.º 2
0
print(n1)
print(n2)
#per evitare spazi indesiderati iniziali
file = open(('INVK.txt'), "a")
for j in range(n2, n1):
    sline = lines1[j].split()
    #print(lines1[j][0]+lines1[j][1]+lines1[j][2]+lines1[j][3])
    if len(sline) == 2:
        year = int(lines1[j][0] + lines1[j][1] + lines1[j][2] + lines1[j][3])
        month = int(lines1[j][5] + lines1[j][6])
        day = int(lines1[j][8] + lines1[j][9])
        value = sline[1][9]
        for i in range(10, len(sline[1])):
            value += sline[1][i]
        #print(str(g2j(year,month,day)))
        a = str(g2j(year, month, day))
        file.write(a + "  " + value + "\n")
    if len(sline) != 2:
        year = int(lines1[j][0] + lines1[j][1] + lines1[j][2] + lines1[j][3])
        month = int(lines1[j][5] + lines1[j][6])
        day = int(lines1[j][8] + lines1[j][9])
        #print(str(g2j(year,month,day)))
        a = str(g2j(year, month, day))
        file.write(a + "  " + sline[2] + "\n")

#chiudo e salvo file
file.close()

#-----------KERG----
KERG = "http://www.nmdb.eu/nest/draw_graph.php?formchk=1&stations[]=KERG&tabchoice=1h&dtype=corr_for_efficiency&tresolution=43200&yunits=0&date_choice=bydate&start_day=1&start_month=1&start_year=1960&start_hour=0&start_min=0&end_day=4&end_month=12&end_year=2019&end_hour=23&end_min=59&output=ascii"
year = str(now.year)
Exemplo n.º 3
0
            if lines1[i] == "\n":
                n1 -= 1
    if n2 != 0:
        for i in range(n2):
            if lines2[i] == "\n":
                n2 -= 1

    print(n1)
    print(n2)
    #per evitare spazi indesiderati iniziali
    file = open(path, "a")
    for j in range(n2, n1):
        sline = lines1[j].split()
        if len(sline) == 2:
            year = int(lines1[j][0] + lines1[j][1] + lines1[j][2] +
                       lines1[j][3])
            month = int(lines1[j][5] + lines1[j][6])
            day = int(lines1[j][8] + lines1[j][9])
            value = sline[1][9]
            for i in range(10, len(sline[1])):
                value += sline[1][i]
            a = str(g2j(year, month, day))
            file.write(a + "  " + value + "\n")
        if len(sline) != 2:
            year = int(lines1[j][0] + lines1[j][1] + lines1[j][2] +
                       lines1[j][3])
            month = int(lines1[j][5] + lines1[j][6])
            day = int(lines1[j][8] + lines1[j][9])
            a = str(g2j(year, month, day))
            file.write(a + "  " + sline[2] + "\n")