Пример #1
0
        with open(path, "w") as file:
            for i in range(len(lines1)):
                if i > 24:
                    file.write(lines1[i])
#su Oulu.txt ho scaricato i dati correnti devo confrontarli con Oulu.txt storico

        lines1 = tuple(open(path, "r"))

        file = open(path, "w")

        for j in range(len(lines1)):
            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(decimal_year(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(decimal_year(year, month, day))
                file.write(a + "  " + sline[2] + "\n")
Пример #2
0
import requests
import shutil
from DECIMAL import decimal_year
import os
import time

m = int(time.strftime('%m'))
d = int(time.strftime('%d'))
Y = int(time.strftime('%Y'))

with open("/var/www/html/Wilcox_SFS/E.txt", "w") as f:
    f.write('1974.001')
    f.write("\n")
    f.write(str(decimal_year(Y, m, d)))

with open("/var/www/html/Wilcox_SFS/Set.txt", "w") as g:
    g.write('1\n')
    g.write('2\n')
    g.write('3\n')
    g.write('4')
Пример #3
0
        if not sline[3] == '-1.0' or sline[
                3] == '-1':  #non stampo i valori non disponibili che SILSO indica con -1 o -1.0
            file.write(smooth[j])
#smooth completed

day = 15

#creare subito il database da cui fare il grafico
import re
line = tuple(open(time.strftime('/var/www/html/SSN/SSN_13.txt'), "r"))

with open(time.strftime('/var/www/html/SSN/SSN_13.txt'), "w") as outfile:
    for j in range(len(line)):
        sline = line[j].split()
        outfile.write(
            str(decimal_year(int(sline[0]), int(sline[1]), day)) + ' ')
        outfile.write(sline[3] + ' ')
        if sline[4] == '-1.0' or sline[
                4] == '-1':  #stampo 0 se non sono disponibili gli errori che SILSO indica con -1 o -1.0
            outfile.write('0' + ' ' + '0 ' + '\n')
        else:
            outfile.write('0' + ' ' + sline[4] + ' ' + '\n')

outfile.close()

import re
line = tuple(open(time.strftime('/var/www/html/SSN/SSN_Monthly.txt'), "r"))

with open(time.strftime('/var/www/html/SSN/SSN_Monthly.txt'), "w") as outfile2:
    for j in range(len(line)):
        sline = line[j].split()
Пример #4
0
        with open(fname) as infile:
            for line in infile:
                outfile.write(line)
                print(line)

shutil.copyfile("/var/www/html/SSN/SSN_Hist.txt",
                "/var/www/html/SSN/SSN_ALL.txt")

#riordinamento txt per SSN

import re

infile = open('/var/www/html/SSN/SSN_Hist.txt', 'r')
outfile = open('/var/www/html/SSN/SSN.txt', 'w')
column1 = 3
column2 = 4
column3 = 5

lines = infile.readlines()
new = lines
for i in range(len(new)):
    sline = lines[i].split()
    outfile.write(
        str(decimal_year(int(sline[0]), int(sline[1]), int(sline[2]))) + ' ')
    outfile.write(sline[column2] + ' ')
    outfile.write('0' + ' ')
    outfile.write(sline[column3] + '\n')

infile.close()
outfile.close()