<jupyter_start><jupyter_text>Importando as bibliotecas do Python.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
import glob<jupyter_output><empty_output><jupyter_text>Criando as funções matemáticas e tarefa 3<jupyter_code>arquivos = glob.glob("dados/*W-TAVG-Trend.txt")
   
print (arquivos)
def coordgeo (latlong):
    
    abertura = open(latlong, encoding = "utf-8")
    
    qualquer = abertura.readlines()
    outra = qualquer [4] [1:].strip()
    
    cidademaisproxima = qualquer[35].split (sep = ',')[0][19:]
    
    return (outra, cidademaisproxima)
    
    

    
teste = coordgeo ('./dados/0.80S-49.02W-TAVG-Trend.txt')
print (teste)
for arquivo in arquivos:
    info = coordgeo (arquivo)
    print (info)<jupyter_output>('0.80 S, 49.02 W', 'Belém')
('10.45 S, 48.27 W', 'Palmas')
('13.66 S, 38.81 W', 'Salvador')
('15.27 S, 47.50 W', 'Brasília')
('2.41 S, 60.27 W', 'Manaus')
('20.09 S, 44.36 W', 'Belo Horizonte')
('20.09 S, 54.60 W', 'Campo Grande')
('23.31 S, 42.82 W', 'Rio de Janeiro')
('23.31 S, 46.31 W', 'São Paulo')
('24.92 S, 49.66 W', 'Curitiba')
('29.74 S, 51.69 W', 'Porto Alegre')
('4.02 S, 40.98 W', 'Fortaleza')<jupyter_text>Tarefa 4<jupyter_code>dados = np.loadtxt (arquivo, comments = '%')
def t_anual_estimativa (temp) :
    documento = open (temp)
    anual_anomalia = documento.readlines() [47].split()
    margem = np.array (anual_anomalia [8:9]) [0]
    
    tab = np.loadtxt (temp, comments = '%')
    year_anomaly = tab [:, 4]
    final_anomalia = np.array (year_anomaly)

    final = []
    for elementos in final_anomalia:
        final.append (float (elementos) + (float (margem)))
    t_anual_estimativa = np.array (final)
    return (t_anual_estimativa)
temperatura = t_anual_estimativa ('./dados/0.80S-49.02W-TAVG-Trend.txt')
print(temperatura)
for arquivo in arquivos [0:11]:
    soma_temperaturasabsolutas = t_anual_estimativa (arquivo)
    print (soma_temperaturasabsolutas)<jupyter_output>[    nan     nan  25.868 ...,     nan     nan     nan]
[    nan     nan  25.061 ...,     nan     nan     nan]
[    nan     nan  23.763 ...,     nan     nan     nan]
[    nan     nan  20.847 ...,     nan     nan     nan]
[ nan  nan  nan ...,  nan  nan  nan]
[    nan     nan  20.232 ...,     nan     nan     nan]
[    nan     nan  22.622 ...,     nan     nan     nan]
[    nan     nan  22.961 ...,     nan     nan     nan]
[    nan     nan  18.857 ...,     nan     nan     nan]
[    nan     nan  16.538 ...,     nan     nan     nan]
[    nan     nan  17.306 ...,     nan     nan     nan]<jupyter_text>Tarefa 5<jupyter_code>dado = np.loadtxt ('./dados/0.80S-49.02W-TAVG-Trend.txt', comments = '%')
anos = dados [:, 0]
meses = dados [:, 1]
ano_decimal = ((meses-1)/12 + anos)
def locais_1 (latlong2):
    documentos  = open(latlong2, encoding = "UTF-8")
    qualquer_2 = documentos.readlines()
    outra_2 = qualquer_2 [4] [1:]
    return (outra_2)
coordgeo ('./dados/0.80S-49.02W-TAVG-Trend.txt') [1]
def graficos (rascunhos):
    anos = np.loadtxt(rascunhos, comments = '%') [:, 0]
    meses = np.loadtxt(rascunhos, comments = '%') [:, 1]
    ano_decimal = ((meses-1)/12 + anos)
    final_anomalia = t_anual_estimativa (rascunhos)
    
    lc = coordgeo (rascunhos) [1] 
    nome_grafico = lc.replace (" ", "_")
    
    plt.figure()
    plt.plot (ano_decimal, final_anomalia, c = "#0000FF")
    plt.xlabel ("Anos")
    plt.ylabel ("Temperatura em °C")
    plt.title (locais_1 (rascunhos))
    plt.savefig("./GráficosPng/" + nome_grafico +".png", format = "png")
for arquivo in arquivos:
    graficos(arquivo)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16057585825027684, 'fraction_numerical': 0.06035437430786268, 'mean_word_length': 2.7479253112033195, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '550232', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 1614, 'n_tokens_neox': 1488, 'n_words': 326, 'path': 'python4.ipynb', 'repo_name': 'mat-esp-2016/python-4-python-4-lpgler007', 'size': '3612'}