def plotdiario(opcao): diainicial = 1 diafinal = diames(ano, mes) planilha = './DADOS/INMET/' + str(ano) + '/' + sigla + '/' + sigla + '-' + str(ano) + '-' + format(mes, '02d') + '.csv' inmet = pd.read_csv(planilha, header=None, sep=',', usecols=[0, 1, 2, 18]) col_dia = 1 col_hora = 2 col_ir = 18 for dia in range(diainicial, diafinal+1): textdia = format(dia, '02d') + '/' + format(mes, '02d') + '/' + str(ano) select = inmet.iloc[np.where(inmet[col_dia].values == textdia)] hora = select[col_hora].values.tolist() ir = select[col_ir].values.tolist() nhora = [*range(24)] nir = [*range(24)] for i in range(len(ir)): nir[int(hora[i])] = jouletowatthora(float(ir[i])) # Padronizar.. nhora[int(hora[i])] = hora[i] #if(ir[i] > 1600 or ir[i] < 0): ir[i]=None # or np.isnan(ir[i]) validar_diaria(dia, mes, ano, rede, sigla, nir, nhora, opcao); GL(sigla, listaunica, mes, ano) plotmensal(opcao, rede, sigla, mes, ano)
def plotdiario(opcao): diainicial = 1 diafinal = diames(ano, mes) planilha = './DADOS/SONDA/' + str(ano) + '/' + sigla + '/' + sigla + str( ano)[-2:] + format(mes, '02d') + 'ED.csv' sonda = pd.read_csv(planilha, header=None, sep=';', usecols=[*range(6)]) cabecalho(str(sonda.loc[0, 3]).isdigit()) for dia in range(diainicial, diafinal + 1): select = sonda.iloc[np.where( sonda[col_dia].values == diajuliano(dia, mes, ano))] minuto = select[col_min].values.tolist() ir = select[col_ir].values.tolist() for i in range(len(ir)): if (ir[i] > 1600 or ir[i] < 0 or np.isnan(ir[i])): ir[i] = None minuto[i] = horamin(minuto[i]) validar_diaria(dia, mes, ano, rede, sigla, ir, minuto, opcao) GL(sigla, listaunica, mes, ano) plotmensal(opcao, rede, sigla, mes, ano)
def plotdiario(opcao): diainicial = 1 diafinal = diames(ano, mes) planilha = './DADOS/' + rede + '/' + str(ano) + '/' + sigla + '/' + str(ano) + format(mes, '02d') + format(diainicial, '02d')+ '_' + str(ano) + format(mes, '02d') + format(diafinal, '02d') + '_' + sigla + '_py_ALLPOINTS.lev10' sp = pd.read_csv(planilha, sep=',', header=None, skiprows=4, usecols=[0, 1 , 3]) for dia in range(diainicial, diafinal+1): select_dia = format(dia, '02d') + ':' + format(mes, '02d') + ':' + str(ano) select_ir = sp.iloc[np.where(sp[col_dia].values == select_dia)] ir = select_ir[col_ir].values.tolist() minuto = select_ir[col_min].values.tolist() minuto = horatomin(minuto) temp = len(minuto) * [None] for i in range(len(minuto)): if(ir[i] < 0): temp[i]=None else: temp[i] = ir[i] ir = temp validar_diaria(dia, mes, ano, rede, sigla, ir, minuto, opcao) GL(sigla, listaunica, mes, ano) plotmensal(opcao, rede, sigla, mes, ano)
def plotgeral(mes, ano): diainicial = 1 diafinal = diames(ano, mes) opcao = 0 listaunica = 'ListaUnicaCompleta_201606.txt' dataestacoes = [] posicoes = [] NE = 4 matrizdiariaGL0 = np.zeros((NE, 27)) matrizposicoes = np.zeros((NE, 3)) matrizdiariaGL0[0, :3] = [29903, -9.871, -56.104] matrizdiariaGL0[1, :3] = [29907, -15.729, -56.021] matrizdiariaGL0[2, :3] = [29902, -10.934, -62.852] matrizdiariaGL0[3, :3] = [29905, -9.957, 67.869] latfinal = 22 - 0.04 loninicial = -100 for i in range(NE): LAT = matrizdiariaGL0[i, 1] LON = matrizdiariaGL0[i, 2] IDD = matrizdiariaGL0[i, 0] linha = int(((latfinal - LAT) / .04 + 0.5)) coluna = int((LON - loninicial) / .04 + 0.5) matrizposicoes[i, :3] = [IDD, linha, coluna] #dataallestacoes = len(dataestacoes) * [diafinal * [24 * [None]]] #dataallgl1x = len(dataestacoes) * [diafinal * [24 * [None]]] #dataallgl3x = len(dataestacoes) * [diafinal * [24 * [None]]] #dataallgl5x = len(dataestacoes) * [diafinal * [24 * [None]]] for dia in range(diainicial, diafinal + 1): minutonovo = gerarhoras() minutonovo = [i * 60 for i in minutonovo] # DATA anomesdia = ano * 10000 + mes * 100 + dia datagl = GLbinarios(anomesdia, matrizposicoes, matrizdiariaGL0) for i in range(len(dataestacoes)): #sigla = dataestacoes[i][0] #dadosdiaestacao = formatadia(dia, dataestacoes[i][1]) # datagl[0][estacao] gl1x = datagl[0][i, :] gl3x = datagl[1][i, :] gl5x = datagl[2][i, :] #csp = contarelemento(dadosdiaestacao) cgl1x = contarelemento(gl1x) cgl3x = contarelemento(gl3x) cgl5x = contarelemento(gl5x) if (cgl1x < 7): gl1x = len(gl1x) * [None] if (cgl3x < 7): gl3x = len(gl1x) * [None] if (cgl5x < 7): gl5x = len(gl1x) * [None] dataallgl1x[i][dia - 1] = gl1x dataallgl3x[i][dia - 1] = gl3x dataallgl5x[i][dia - 1] = gl5x hora = [*range(24)] mediasp = integral(hora, dadosdiaestacao, len(dadosdiaestacao)) mediagl1x = integral(hora, gl1x, len(gl1x)) mediagl3x = integral(hora, gl3x, len(gl3x)) mediagl5x = integral(hora, gl5x, len(gl5x)) if (csp > 7): dataallestacoes[i][dia - 1] = dadosdiaestacao # load tabela GL. >> plotmensal(opcao, rede, sigla, mes, ano) dataestacoes.clear() # limpa da memoria print('Concluido: ' + format(mes, '02d') + '-' + str(ano))
def plotgeral(mes, ano, estacoes): opcao = 0 diainicial = 1 diafinal = diames(ano, mes) listaunica = 'ListaUnicaCompleta_201606.txt' header = [] dataestacoes = [] posicoes = [] for i in range(len(estacoes)): try: sigla = estacoes[i] temploc = getLoc(sigla, listaunica) idd = temploc[0] lat = formatn(temploc[1]) long = formatn(temploc[2]) rede = temploc[3] readdata = lermes(diafinal, mes, ano, sigla, rede) latfinal = 22 - 0.04 loninicial = -100 linha = int(((latfinal - lat) / .04 + 0.5)) coluna = int((long - loninicial) / .04 + 0.5) posicoes.append([linha, coluna]) header.append([idd, lat, long]) dataestacoes.append([sigla, rede, readdata]) except FileNotFoundError: pass dataallestacoes = len(dataestacoes) * [diafinal * [24 * [None]]] dataallgl1x = len(dataestacoes) * [diafinal * [24 * [None]]] dataallgl3x = len(dataestacoes) * [diafinal * [24 * [None]]] dataallgl5x = len(dataestacoes) * [diafinal * [24 * [None]]] # Para apenas um dia, set dia inicial e final para o dia, aqui! for dia in range(diainicial, diafinal + 1): anomesdia = ano * 10000 + mes * 100 + dia minutonovo = gerarhoras() minutonovo = [i * 60 for i in minutonovo] datagl = GLbinarios(dia, mes, ano, posicoes) for i in range(len(datagl)): # 1x 3x 5x for x in range(len(datagl[i])): # estacoes datagl[i][x] = escalatemp2(minutonovo, datagl[i][x]) datasp = len(posicoes) * [24 * [None]] for i in range(len(dataestacoes)): sigla = dataestacoes[i][0] rede = dataestacoes[i][1] datasp[i] = formatadia(dia, dataestacoes[i][2], rede) # datagl[0][estacao] gl1x = datagl[0][i] gl3x = datagl[1][i] gl5x = datagl[2][i] csp = contarelemento(datasp[i]) cgl1x = contarelemento(gl1x) cgl3x = contarelemento(gl3x) cgl5x = contarelemento(gl5x) if (cgl1x < 7): gl1x = len(gl1x) * [None] if (cgl3x < 7): gl3x = len(gl1x) * [None] if (cgl5x < 7): gl5x = len(gl1x) * [None] dataallgl1x[i][dia - 1] = gl1x dataallgl3x[i][dia - 1] = gl3x dataallgl5x[i][dia - 1] = gl5x hora = [*range(24)] mediasp = integral(hora, datasp[i], len(datasp[i])) mediagl1x = integral(hora, gl1x, len(gl1x)) mediagl3x = integral(hora, gl3x, len(gl3x)) mediagl5x = integral(hora, gl5x, len(gl5x)) if (csp > 7): dataallestacoes[i][dia - 1] = datasp[i] figuradiaria(dia, sigla, ano, mes, opcao, hora, datasp[i], gl1x, gl3x, gl5x, mediasp, mediagl1x, mediagl3x, mediagl5x, rede) if (contarelemento(datagl[0][0]) > 7): gravardados(anomesdia, header, datasp, 'SP') gravardados(anomesdia, header, datagl[0], 'GL1X') gravardados(anomesdia, header, datagl[1], 'GL3X') gravardados(anomesdia, header, datagl[2], 'GL5X') #gerargraficodiferenca(dia, 'SOLRADNET', ano, mes, opcao, dataallestacoes, dataallgl1x) # gerar figura com dados das varias estacoes # salvar arquivo for p in range(len(dataestacoes)): sigla = dataestacoes[p][0] G = arraymedias(dataallestacoes[p]) GLir = GL(sigla, listaunica, mes, ano) DIAS = [*range(1, diafinal + 1)] gravartexto(ano, mes, sigla, DIAS, G, GLir) # load tabela GL. >> plotmensal(opcao, rede, sigla, mes, ano) dataestacoes.clear() # limpa da memoria print('Concluido: ' + format(mes, '02d') + '-' + str(ano))