├── .gitignore ├── README.md ├── analysis └── README.md ├── chromedriver.exe ├── config.py ├── data ├── estacao_dados.csv └── station_numbers.txt ├── documents ├── Comparação de médias diarias de temperatura.pdf └── documentacao_metodologia.pdf ├── examples ├── DAYFULL_3stations_2018-2019.csv └── MONTH_2018-2019.csv ├── extract_data.py ├── requirements.txt ├── state.py └── station.py /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # IDE 7 | .idea/ 8 | 9 | # Django Migrations 10 | 11 | 12 | # Static Files generated by collectstatic 13 | staticfiles/ 14 | 15 | # C extensions 16 | *.so 17 | 18 | # Distribution / packaging 19 | .Python 20 | build/ 21 | develop-eggs/ 22 | dist/ 23 | downloads/ 24 | eggs/ 25 | .eggs/ 26 | lib/ 27 | lib64/ 28 | parts/ 29 | sdist/ 30 | var/ 31 | wheels/ 32 | *.egg-info/ 33 | .installed.cfg 34 | *.egg 35 | MANIFEST 36 | 37 | # PyInstaller 38 | # Usually these files are written by a python script from a template 39 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 40 | *.manifest 41 | *.spec 42 | 43 | # Installer logs 44 | pip-log.txt 45 | pip-delete-this-directory.txt 46 | 47 | # Unit test / coverage reports 48 | htmlcov/ 49 | .tox/ 50 | .coverage 51 | .coverage.* 52 | .cache 53 | nosetests.xml 54 | coverage.xml 55 | *.cover 56 | .hypothesis/ 57 | .pytest_cache/ 58 | 59 | # Translations 60 | *.mo 61 | *.pot 62 | 63 | # Django stuff: 64 | *.log 65 | local_settings.py 66 | db.sqlite3 67 | 68 | # Flask stuff: 69 | instance/ 70 | .webassets-cache 71 | 72 | # Scrapy stuff: 73 | .scrapy 74 | 75 | # Sphinx documentation 76 | docs/_build/ 77 | 78 | # PyBuilder 79 | target/ 80 | 81 | # Jupyter Notebook 82 | .ipynb_checkpoints 83 | 84 | # pyenv 85 | .python-version 86 | 87 | # celery beat schedule file 88 | celerybeat-schedule 89 | 90 | # SageMath parsed files 91 | *.sage.py 92 | 93 | # Environments 94 | .env 95 | .venv 96 | env/ 97 | venv/ 98 | ENV/ 99 | env.bak/ 100 | venv.bak/ 101 | 102 | # Spyder project settings 103 | .spyderproject 104 | .spyproject 105 | 106 | # Rope project settings 107 | .ropeproject 108 | 109 | # mkdocs documentation 110 | /site 111 | 112 | # mypy 113 | .mypy_cache/ 114 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # INMET-API-temperatura 2 | API para extrair os dados __históricos__ de temperatura da Base do INMET 3 | 4 | ## Descrição 5 | Os dados são da base __BDMEP - Banco de Dados Meteorológicos para Ensino e Pesquisa__. São dados históricos, a partir de 1961 extraidos de estações __convencionais__ ([link](http://www.inmet.gov.br/portal/index.php?r=bdmep/bdmep)). 6 | 7 | Os dados do BDMEP são dados históricos e não em tempo real, ou seja, as vezes só estão disponíveis dados anteriores a 1~3 meses. 8 | 9 | Um pré requisito para acessar a base é ter cadastro no BDMEP. Veja a sessão de links abaixo. 10 | 11 | ## Links 12 | 13 | * Pagina Inicial do [INMET](http://www.inmet.gov.br/) 14 | * Pagina dos dados [BDMEP](http://www.inmet.gov.br/portal/index.php?r=bdmep/bdmep) 15 | * Caso ainda não possua cadastro para consulta da base BDMEP, acesse [AQUI](http://www.inmet.gov.br/projetos/rede/pesquisa/cad_senha.php) 16 | * Para fazer o login e ver os dados no site acesse [AQUI](http://www.inmet.gov.br/projetos/rede/pesquisa/inicio.php) 17 | * Tabela de código de ventos [AQUI](http://www.inmet.gov.br/projetos/rede/pesquisa/tabela_de_codigos.html) 18 | * Lista de estações [AQUI](http://www.inmet.gov.br/projetos/rede/pesquisa/lista_estacao.php) 19 | 20 | ## Como executar o projeto? 21 | 22 | ### Requerimentos 23 | * Python 3 24 | * Selenium 25 | * Selenium web driver (chromedriver.exe ou outro se [sua escolha](https://www.seleniumhq.org/download/#thirdPartyDrivers)) 26 | * Beautiful Soup4 27 | 28 | ### Instalação 29 | * Instale Git e faça o download deste projeto ([para Windows](https://gitforwindows.org/)) 30 | * Instale Python 3 31 | * Na linha de comando, crie um VirtualEnv para seu codigo python: ```> python -m venv venv``` 32 | * Inicie seu virtualEnv com: ```> venv\Scripts\activate``` 33 | * Se precisar desativar é só ```> venv\Scripts\deactivate``` 34 | * Após criar o VirtualEnv e inicia-lo, vamos agora instalar as dependencias deste projeto. Para isso use: 35 | 36 | ```> pip install -r requirements.txt``` 37 | * Pronto, tudo certinho para executar o projeto :) 38 | 39 | ### Executando o projeto 40 | * A base do BDMEP possui varios tipo de consultas. Para facilitar o uso, foram criados alguns Templates: 41 | * __HOUR__ | Consulta de apenas alguns parametros e 3x ao dia 42 | * __DAY__ | Consulta de apenas alguns parametros e 2x ao dia 43 | * __DAYFULL__ | Consulta de todos os parametros e 3x ao dia 44 | * __MONTH__ | Consulta de todos os parametros e 1x ao mes 45 | 46 | _*Recomendo utilizar ou o Template __DAYFULL__, pois é o que aparenta estar mais completo._ 47 | 48 | * Para executar use o comando abaixo: 49 | 50 | ```> python extract_data.py DAYFULL``` 51 | 52 | * O arquivo será gerado em ``` data/output_data.csv ``` 53 | 54 | _*Por enquanto não foi adicionado nem a opção de data nem a opção de nome do arquivo. Para alterar a data de extraão edite a linha 94 do extract_data.py_ 55 | 56 | ## Sobre o BDMEP 57 | 58 | ### Detalhes importantes 59 | 60 | Um detalhe importante é que a base do BDMEP são dados de estações __"Convencionais"__. Existem dois tipos de estações: 61 | * __Convêncional__: É composta de vários sensores isolados que registram continuamente os parâmetros meteorológicos (pressão, temperatura, etc..), que são lidos e anotados por um observador (humano ou sistema) a cada intervalo de tempo ([link](http://www.inmet.gov.br/portal/index.php?r=estacoes/estacoesConvencionais)). 62 | * __Automática__: É composta de uma unidade de memória central ("data logger"), ligada a vários sensores meteorológicos, e que integra os valores observados minuto a minuto e os disponibiliza automaticamente a cada hora ([link](http://www.inmet.gov.br/portal/index.php?r=estacoes/estacoesAutomaticas)). 63 | 64 | 65 | Então, para neste projeto estamos usando os dados Convêncionais. 66 | 67 | As observações ocorrem todos os dias as 0900, 1500 e 2100 (UTC-3). 68 | 69 | A formula usada para o cálculo da Temperatura média compensada (TC) é: 70 | 71 | TC = ( T12 + 2*T0 + T_(min) + T_(max) ) / 5 72 | 73 | 74 | 75 | ### Documentos Importantes 76 | * [Esse documento](http://www.inmet.gov.br/webcdp/climatologia/normais/imagens/normais/textos/metodologia.pdf) que explica a metodologia utilizada para construir a base. 77 | 78 | * [Essa publicação sobre medias diarias](./documents/Comparação%20de%20médias%20diarias%20de%20temperatura.pdf) e Temperatura média compensada 79 | 80 | 81 | 82 | ### Parâmetros 83 | 84 | * __Dados Horários__ ([link](http://www.inmet.gov.br/projetos/rede/pesquisa/form_mapas_c_horario.php)) 85 | * Dados de 3x ao dia 86 | 87 | * __Dados Diários__ ([link](http://www.inmet.gov.br/projetos/rede/pesquisa/form_mapas_c_diario.php)) 88 | * Dados de 3x ao dia contendo a media diaria e mais algumas medidas calculadas 89 | 90 | * __Dados Mensais__ ([link](http://www.inmet.gov.br/projetos/rede/pesquisa/form_mapas_mensal.php)) 91 | * Dados de 1x ao mes, com a media mensal 92 | 93 | * __Atributos__: 94 | * mRelEstacao 95 | * btnProcesso 96 | * mRelDtInicio 97 | * mRelDtFim 98 | * mAtributos=,,,,,,,,,,,,,,,, -> Conjunto de atributos separados por virgula. Se tiver o atributo então recebe o valor 1, se não fica vazio (ex: mAtributos=1,1,1,,,,,,,,,,1,1,,,). Lista de atributos: 99 | * 1º Direção do Vento Predominante ([tabela](http://www.inmet.gov.br/projetos/rede/pesquisa/tabela_de_codigos.html)) 100 | * 2º Velocidade do Vento Média (mps) 101 | * 3º Velocidade do Vento Máxima Média (mps) 102 | * 4º Evaporação do Piche (mm) 103 | * 5º Evapotranspiração Potencial BH (mm) 104 | * 6º Evapotranspiração Real BH (mm) 105 | * 7º Insolação Total (hs) 106 | * 8º Nebulosidade Média (décimos) 107 | * 9º Número de Dias com Precipitação (qtd) 108 | * 10º Precipitação Total (mm) 109 | * 11º Pressão Atm nível Mar Média (mbar) 110 | * 12º Pressão Atm Média (mbar) 111 | * 13º Temp Máxima Média(ºC) 112 | * 14º Temp Compensada Média(ºC) 113 | * 15º Temp Mínima Média(ºC) 114 | * 16º Umidade Relativa Média (%) 115 | * 17º Visibilidade Média (%)([tabela](http://www.inmet.gov.br/projetos/rede/pesquisa/tabela_visibilidade.html)) 116 | 117 | * Informações sobre os parametros: 118 | * [Bulbo Umido](https://pt.wikipedia.org/wiki/Temperatura_de_bulbo_%C3%BAmido) 119 | * [Bulbo Seco](https://es.wikipedia.org/wiki/Temperatura_de_bulbo_seco) 120 | 121 | 122 | 123 | 124 | 125 | ## TO DO 126 | * [ ] Tratamento para login com usuario errado. 127 | * [X] Exportar para arquivo 128 | * [ ] Adicionar input para data 129 | 130 | 131 | 132 | ## Saiba mais 133 | 134 | * [Organização Metereológica Mundial (OMM)](https://pt.wikipedia.org/wiki/Organiza%C3%A7%C3%A3o_Meteorol%C3%B3gica_Mundial) 135 | * [Institudo Nacional de Metereologia (INMET)](https://pt.wikipedia.org/wiki/Instituto_Nacional_de_Meteorologia) 136 | * [Diferença entre as Estações de Observação](http://www.inmet.gov.br/html/rede_obs/rede_obs.html) 137 | -------------------------------------------------------------------------------- /analysis/README.md: -------------------------------------------------------------------------------- 1 | * [Implementar mapa usando D3](http://blog.superquadra.co/frontend/mapa-do-brasil-em-d3js/) 2 | * [BR-Atlas - mapa do Brazil em topoJSON](https://github.com/carolinabigonha/br-atlas) 3 | * [Outra opção para o mapa - DataMap (usando D3)](http://datamaps.github.io/) 4 | -------------------------------------------------------------------------------- /chromedriver.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabinhojorge/INMET-API-temperature/2a8c261b04e062e7285dd6083fae269a7b6103ba/chromedriver.exe -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | Author: Fabio Rodrigues Jorge 6 | Email: fabinhojorgenet@gmail.com 7 | Description: Config file. 8 | """ 9 | 10 | LOGIN = { 11 | 'url': 'http://www.inmet.gov.br/projetos/rede/pesquisa/inicio.php', 12 | 'username': '', 13 | 'password': '', 14 | } 15 | 16 | URL_TEMPLATE = { 17 | 'HOUR': 'http://www.inmet.gov.br/projetos/rede/pesquisa/gera_serie_txt.php?&mRelEstacao={omm_code}' 18 | '&btnProcesso=serie&mRelDtInicio={start_date}&mRelDtFim={end_date}&mAtributos=1,1,,,1,1,,1,1,,,1,,,,,', 19 | 'DAY': 'http://www.inmet.gov.br/projetos/rede/pesquisa/gera_serie_txt.php?&mRelEstacao={omm_code}' 20 | '&btnProcesso=serie&mRelDtInicio={start_date}&mRelDtFim={end_date}&mAtributos=,,1,1,,,,,,1,1,,1,1,1,1,', 21 | 'DAYFULL': 'http://www.inmet.gov.br/projetos/rede/pesquisa/gera_serie_txt.php?&mRelEstacao={omm_code}' 22 | '&btnProcesso=serie&mRelDtInicio={start_date}&mRelDtFim={end_date}' 23 | '&mAtributos=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1', 24 | 'MONTH': 'http://www.inmet.gov.br/projetos/rede/pesquisa/gera_serie_txt_mensal.php?&mRelEstacao={omm_code}' 25 | '&btnProcesso=serie&mRelDtInicio={start_date}&mRelDtFim={end_date}' 26 | '&mAtributos=1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1', 27 | } 28 | -------------------------------------------------------------------------------- /data/estacao_dados.csv: -------------------------------------------------------------------------------- 1 | codigo_omm,station_name,state,state_initials,region,latitude,longitude,altitude,altitude_type,start_operation_date,station_situation,data_situation 2 | 82989,AGUA BRANCA,Alagoas,AL,Nosdeste,-9.28,-37.9,605.34,meters,1928-05-05,operante,operante 3 | 83249,ALAGOINHAS,Bahia,BA,Nordeste,-12.14,-38.42,130.92,meters,1931-01-01,operante,operante 4 | 82353,ALTAMIRA,Para,PA,Norte,-3.21,-52.21,74.04,meters,1927-04-24,operante,operante 5 | 82970,ALTO PARNAIBA,Maranhao,MA,Nordeste,-9.1,-45.93,285.05,meters,1976-08-21,operante,operante 6 | 82590,APODI,Rio_Grande_do_Norte,RN,Nordeste,-5.61,-37.81,150.00,meters,1962-12-18,operante,operante 7 | 83096,ARACAJU,Sergipe,SE,Nordeste,-10.95,-37.04,4.72,meters,1910-03-01,operante,operante 8 | 83442,ARACUAI,Minas_Gerais,MG,Sudeste,-16.83,-42.05,289.00,meters,1918-09-06,operante,operante 9 | 83368,ARAGARCAS,Goias,GO,Centro-Oeste,-15.9,-52.23,345.00,meters,1970-07-19,operante,operante 10 | 82659,ARAGUAINA,Tocantins,TO,Norte,-7.2,-48.2,228.52,meters,1984-08-21,operante,operante 11 | 83579,ARAXA,Minas_Gerais,MG,Sudeste,-19.6,-46.94,1023.61,meters,1916-09-07,operante,operante 12 | 82890,ARCOVERDE,Pernambuco,PE,Nordeste,-8.41,-37.08,680.70,meters,1973-02-01,operante,operante 13 | 82696,AREIA,Paraiba,PB,Nordeste,-6.97,-35.68,574.62,meters,1929-01-01,operante,operante 14 | 83384,ARINOS,Minas_Gerais,MG,Sudeste,-15.91,-46.1,519.00,meters,1976-04-05,operante,operante 15 | 83049,AVELAR P DO ALFERES,Rio_de_Janeiro,RJ,Sudeste,-22.35,-43.41,507.00,meters,1971-04-01,operante,operante 16 | 82460,BACABAL,Maranhao,MA,Nordeste,-4.21,-44.76,25.07,meters,1976-08-15,operante,operante 17 | 83980,BAGE,Rio_Grande_do_Sul,RS,Sul,-31.33,-54.1,242.31,meters,1912-01-01,operante,operante 18 | 82768,BALSAS,Maranhao,MA,Nordeste,-7.53,-46.03,259.38,meters,1976-08-14,operante,operante 19 | 83582,BAMBUI,Minas_Gerais,MG,Sudeste,-20.03,-45,661.27,meters,1926-08-26,operante,operante 20 | 83689,BARBACENA,Minas_Gerais,MG,Sudeste,-21.25,-43.76,1126.00,meters,1914-06-09,operante,operante 21 | 82784,BARBALHA,Ceara,CE,Nordeste,-7.31,-39.3,409.03,meters,1948-01-01,operante,operante 22 | 82113,BARCELOS,Amazonas,AM,Norte,-0.96,-62.91,40.00,meters,1924-08-01,operante,operante 23 | 83179,BARRA,Bahia,BA,Nordeste,-11.08,-43.16,401.58,meters,1925-03-03,operante,operante 24 | 82571,BARRA DO CORDA,Maranhao,MA,Nordeste,-5.5,-45.23,153.00,meters,1912-01-14,operante,operante 25 | 83236,BARREIRAS,Bahia,BA,Nordeste,-12.15,-45,439.29,meters,1924-01-01,operante,operante 26 | 82191,BELEM,Para,PA,Norte,-1.43,-48.43,10.00,meters,1923-11-01,operante,operante 27 | 83587,BELO HORIZONTE,Minas_Gerais,MG,Sudeste,-19.93,-43.93,915.00,meters,1910-03-03,operante,operante 28 | 82246,BELTERRA,Para,PA,Norte,-2.63,-54.95,175.74,meters,1971-08-01,operante,operante 29 | 82410,BENJAMIN CONSTANT,Amazonas,AM,Norte,-4.38,-70.03,65.00,meters,1924-01-01,operante,operante 30 | 82024,BOA VISTA,Roraima,RR,Norte,2.82,-60.66,83.00,meters,1923-01-01,operante,operante 31 | 83533,BOM DESPACHO,Minas_Gerais,MG,Sudeste,-19.68,-45.36,695.00,meters,1981-01-01,operante,operante 32 | 83919,BOM JESUS,Rio_Grande_do_Sul,RS,Sul,-28.66,-50.43,1047.50,meters,1948-05-01,operante,operante 33 | 83288,BOM JESUS DA LAPA,Bahia,BA,Nordeste,-13.26,-43.41,439.96,meters,1941-11-01,operante,operante 34 | 82975,BOM JESUS DO PIAUI,Piaui,PI,Nordeste,-9.1,-44.11,331.74,meters,1971-04-19,operante,operante 35 | 83377,BRASILIA,Distrito_Federal,DF,Centro-Oeste,-15.78,-47.92,1159.54,meters,1961-09-12,operante,operante 36 | 82188,BREVES,Para,PA,Norte,-1.68,-50.48,14.74,meters,1970-09-01,operante,operante 37 | 83589,C DO MATO DENTRO,Minas_Gerais,MG,Sudeste,-19.02,-43.43,652.00,meters,1925-06-30,operante,operante 38 | 82886,CABROBO,Pernambuco,PE,Nordeste,-8.51,-39.33,341.46,meters,1927-10-17,operante,operante 39 | 83339,CAETITE,Bahia,BA,Nordeste,-14.06,-42.48,882.47,meters,1907-01-01,operante,operante 40 | 82263,CAMETA,Para,PA,Norte,-2.25,-49.5,23.90,meters,1970-05-01,operante,operante 41 | 82795,CAMPINA GRANDE,Paraiba,PB,Nordeste,-7.22,-35.88,547.56,meters,1911-01-01,operante,operante 42 | 83783,CAMPO MOURAO,Parana,PR,Sul,-24.05,-52.36,616.40,meters,1958-04-02,operante,operante 43 | 83698,CAMPOS,Rio_de_Janeiro,RJ,Sudeste,-21.74,-41.33,11.20,meters,1911-06-17,operante,operante 44 | 83714,CAMPOS DO JORDAO,Sao_Paulo,SP,Sudeste,-22.75,-45.6,1642.00,meters,1939-01-01,operante,operante 45 | 83887,CAMPOS NOVOS,Santa_Catarina,SC,Sul,-27.38,-51.2,946.67,meters,1923-07-01,operante,operante 46 | 82777,CAMPOS SALES,Ceara,CE,Nordeste,-7,-40.38,583.50,meters,1960-06-01,operante,operante 47 | 83270,CANARANA,Mato_Grosso,MT,Centro-Oeste,-13.47,-52.27,430.00,meters,1987-08-04,operante,operante 48 | 83398,CANAVIEIRAS,Bahia,BA,Nordeste,-15.66,-38.95,3.87,meters,1930-01-01,operante,operante 49 | 83639,CAPARAO,Minas_Gerais,MG,Sudeste,-20.51,-41.9,843.18,meters,1972-11-17,operante,operante 50 | 83514,CAPINOPOLIS,Minas_Gerais,MG,Sudeste,-18.71,-49.55,620.60,meters,1969-08-13,operante,operante 51 | 82042,CARACARAI,Roraima,RR,Norte,1.83,-61.12,60.00,meters,1970-01-11,operante,operante 52 | 82976,CARACOL,Piaui,PI,Nordeste,-9.28,-43.33,522.77,meters,1975-10-03,operante,operante 53 | 83592,CARATINGA,Minas_Gerais,MG,Sudeste,-19.73,-42.13,609.65,meters,1924-03-15,operante,operante 54 | 83498,CARAVELAS,Bahia,BA,Nordeste,-17.73,-39.25,2.88,meters,1930-05-01,operante,operante 55 | 83485,CARBONITA,Minas_Gerais,MG,Sudeste,-17.53,-43,736.38,meters,1981-01-01,operante,operante 56 | 83408,CARINHANHA,Bahia,BA,Nordeste,-14.28,-43.76,450.18,meters,1927-12-01,operante,operante 57 | 82765,CAROLINA,Maranhao,MA,Nordeste,-7.33,-47.46,192.83,meters,1913-01-01,operante,operante 58 | 83813,CASTRO,Parana,PR,Sul,-24.78,-50,1008.80,meters,1922-11-01,operante,operante 59 | 83526,CATALAO,Goias,GO,Centro-Oeste,-18.18,-47.95,840.47,meters,1913-01-01,operante,operante 60 | 83676,CATANDUVA,Sao_Paulo,SP,Sudeste,-21.11,-48.93,570.00,meters,1936-08-01,operante,operante 61 | 82476,CAXIAS,Maranhao,MA,Nordeste,-4.86,-43.35,103.56,meters,1976-03-15,operante,operante 62 | 83942,CAXIAS DO SUL,Rio_Grande_do_Sul,RS,Sul,-29.16,-51.2,759.60,meters,1912-04-12,operante,operante 63 | 82596,CEARA MIRIM,Rio_Grande_do_Norte,RN,Nordeste,-5.65,-35.65,61.35,meters,1967-06-01,operante,operante 64 | 82382,CHAPADINHA,Maranhao,MA,Nordeste,-3.73,-43.35,103.50,meters,1976-08-28,operante,operante 65 | 83883,CHAPECO,Santa_Catarina,SC,Sul,-27.11,-52.61,679.01,meters,1973-05-10,operante,operante 66 | 83192,CIPO,Bahia,BA,Nordeste,-11.08,-38.51,145.31,meters,1935-01-01,operante,operante 67 | 82425,COARI,Amazonas,AM,Norte,-4.08,-63.13,46.00,meters,1926-01-01,operante,operante 68 | 82326,CODAJAS,Amazonas,AM,Norte,-3.83,-62.08,48.00,meters,1974-08-19,operante,operante 69 | 82676,COLINAS,Maranhao,MA,Nordeste,-6.03,-44.25,179.75,meters,1976-05-19,operante,operante 70 | 82861,CONCEICAO DO ARAGUAIA,Para,PA,Norte,-8.26,-49.26,156.85,meters,1920-03-19,operante,operante 71 | 83718,CORDEIRO,Rio_de_Janeiro,RJ,Sudeste,-22.02,-42.36,505.92,meters,1971-07-16,operante,operante 72 | 83286,CORRENTINA,Bahia,BA,Nordeste,-13.33,-44.61,549.47,meters,1975-08-11,operante,operante 73 | 82583,CRATEUS,Ceara,CE,Nordeste,-5.16,-40.66,296.82,meters,1962-12-01,operante,operante 74 | 83912,CRUZ ALTA,Rio_Grande_do_Sul,RS,Sul,-28.63,-53.6,472.50,meters,1912-02-02,operante,operante 75 | 83222,CRUZ DAS ALMAS,Bahia,BA,Nordeste,-12.66,-39.08,225.87,meters,1958-01-01,operante,operante 76 | 82704,CRUZEIRO DO SUL,Acre,AC,Norte,-7.6,-72.66,170.00,meters,1928-01-01,operante,operante 77 | 82693,CRUZETA,Rio_Grande_do_Norte,RN,Nordeste,-6.43,-36.58,226.46,meters,1930-01-01,operante,operante 78 | 83361,CUIABA,Mato_Grosso,MT,Centro-Oeste,-15.61,-56.1,145.00,meters,1911-01-01,operante,operante 79 | 83842,CURITIBA,Parana,PR,Sul,-25.43,-49.26,923.50,meters,1911-01-01,operante,operante 80 | 83536,CURVELO,Minas_Gerais,MG,Sudeste,-18.75,-44.45,672.00,meters,1912-09-03,operante,operante 81 | 83538,DIAMANTINA,Minas_Gerais,MG,Sudeste,-18.23,-43.64,1296.12,meters,1918-04-13,operante,operante 82 | 83309,DIAMANTINO,Mato_Grosso,MT,Centro-Oeste,-14.4,-56.45,286.30,meters,1932-01-01,operante,operante 83 | 83635,DIVINOPOLIS,Minas_Gerais,MG,Sudeste,-20.17,-44.87,788.35,meters,1995-10-11,operante,operante 84 | 82610,EIRUNEPE,Amazonas,AM,Norte,-6.66,-69.86,104.00,meters,1928-01-01,operante,operante 85 | 83964,ENCRUZILHADA DO SUL,Rio_Grande_do_Sul,RS,Sul,-30.53,-52.51,427.75,meters,1913-05-01,operante,operante 86 | 82298,ESPERANTINA,Piaui,PI,Nordeste,-3.9,-42.25,87.05,meters,1974-03-17,operante,operante 87 | 83338,ESPINOSA,Minas_Gerais,MG,Sudeste,-14.91,-42.8,569.64,meters,1974-03-01,operante,operante 88 | 83221,FEIRA DE SANTANA,Bahia,BA,Nordeste,-12.18,-38.96,230.68,meters,1939-01-01,operante,operante 89 | 82691,FLORANIA,Rio_Grande_do_Norte,RN,Nordeste,-6.11,-36.81,324.45,meters,1962-12-19,operante,operante 90 | 83581,FLORESTAL,Minas_Gerais,MG,Sudeste,-19.88,-44.41,760.00,meters,1960-04-09,operante,operante 91 | 82678,FLORIANO,Piaui,PI,Nordeste,-6.76,-43.01,123.27,meters,1968-01-21,operante,operante 92 | 83897,FLORIANOPOLIS,Santa_Catarina,SC,Sul,-27.58,-48.56,1.84,meters,1921-12-01,operante,operante 93 | 82212,FONTE BOA,Amazonas,AM,Norte,-2.53,-66.16,55.57,meters,1925-01-01,operante,operante 94 | 83379,FORMOSA,Goias,GO,Centro-Oeste,-15.54,-47.33,935.19,meters,1925-01-01,operante,operante 95 | 83334,FORMOSO,Minas_Gerais,MG,Sudeste,-14.93,-46.25,840.00,meters,1976-04-03,operante,operante 96 | 82397,FORTALEZA,Ceara,CE,Nordeste,-3.81,-38.53,26.45,meters,1919-10-27,operante,operante 97 | 83630,FRANCA,Sao_Paulo,SP,Sudeste,-20.58,-47.36,1026.20,meters,1911-01-01,operante,operante 98 | 82893,GARANHUNS,Pernambuco,PE,Nordeste,-8.88,-36.51,822.76,meters,1913-02-01,operante,operante 99 | 83423,GOIANIA,Goias,GO,Centro-Oeste,-16.66,-49.25,741.48,meters,1937-07-11,operante,operante 100 | 83374,GOIAS,Goias,GO,Centro-Oeste,-15.91,-50.13,512.22,meters,1946-04-20,operante,operante 101 | 82487,GUARAMIRANGA,Ceara,CE,Nordeste,-4.28,-39,870.67,meters,1911-02-01,operante,operante 102 | 83446,GUARATINGA,Bahia,BA,Nordeste,-16.73,-39.54,194.67,meters,1973-09-10,operante,operante 103 | 82067,IAUARETE,Amazonas,AM,Norte,0.61,-69.18,120.00,meters,1943-07-16,operante,operante 104 | 83632,IBIRITE,Minas_Gerais,MG,Sudeste,-20.01,-44.05,814.54,meters,1959-04-06,operante,operante 105 | 82686,IGUATU,Ceara,CE,Nordeste,-6.36,-39.29,217.67,meters,1911-01-01,operante,operante 106 | 82564,IMPERATRIZ,Maranhao,MA,Nordeste,-5.53,-47.48,123.30,meters,1913-01-01,operante,operante 107 | 83872,INDAIAL,Santa_Catarina,SC,Sul,-26.9,-49.21,86.13,meters,1970-10-14,operante,operante 108 | 83522,IPAMERI,Goias,GO,Centro-Oeste,-17.71,-48.16,772.99,meters,1977-02-10,operante,operante 109 | 83881,IRAI,Rio_Grande_do_Sul,RS,Sul,-27.18,-53.23,247.10,meters,1935-06-01,operante,operante 110 | 83836,IRATI,Parana,PR,Sul,-25.46,-50.63,836.95,meters,1966-09-24,operante,operante 111 | 83182,IRECE,Bahia,BA,Nordeste,-11.3,-41.86,747.16,meters,1970-12-01,operante,operante 112 | 83195,ITABAIANINHA,Sergipe,SE,Nordeste,-11.11,-37.81,208.00,meters,1923-08-06,operante,operante 113 | 83244,ITABERABA,Bahia,BA,Nordeste,-12.51,-40.28,249.89,meters,1931-08-21,operante,operante 114 | 82336,ITACOATIARA,Amazonas,AM,Norte,-3.13,-58.43,40.00,meters,1927-01-01,operante,operante 115 | 82445,ITAITUBA,Para,PA,Norte,-4.28,-55.98,45.00,meters,1928-01-01,operante,operante 116 | 83488,ITAMARANDIBA,Minas_Gerais,MG,Sudeste,-17.85,-42.85,914.00,meters,1925-03-27,operante,operante 117 | 83695,ITAPERUNA,Rio_de_Janeiro,RJ,Sudeste,-21.2,-41.9,123.59,meters,1922-01-01,operante,operante 118 | 83295,ITIRUCU JAGUAQUARA,Bahia,BA,Nordeste,-13.35,-40.11,755.61,meters,1941-08-01,operante,operante 119 | 83292,ITUACU,Bahia,BA,Nordeste,-13.81,-41.3,531.43,meters,1973-02-18,operante,operante 120 | 83811,IVAI,Parana,PR,Sul,-25,-50.86,808.00,meters,1912-01-01,operante,operante 121 | 83186,JACOBINA,Bahia,BA,Nordeste,-11.18,-40.46,484.74,meters,1912-12-01,operante,operante 122 | 82493,JAGUARUANA,Ceara,CE,Nordeste,-4.78,-37.76,11.71,meters,1914-01-01,operante,operante 123 | 83395,JANAUBA,Minas_Gerais,MG,Sudeste,-15.8,-43.29,516.00,meters,1975-03-15,operante,operante 124 | 83386,JANUARIA,Minas_Gerais,MG,Sudeste,-15.45,-44,473.71,meters,1912-06-19,operante,operante 125 | 83464,JATAI,Goias,GO,Centro-Oeste,-17.91,-51.71,662.86,meters,1978-11-24,operante,operante 126 | 82798,JOAO PESSOA,Paraiba,PB,Nordeste,-7.1,-34.86,7.43,meters,1912-01-01,operante,operante 127 | 83481,JOAO PINHEIRO,Minas_Gerais,MG,Sudeste,-17.73,-46.17,760.36,meters,1925-12-09,operante,operante 128 | 83692,JUIZ DE FORA,Minas_Gerais,MG,Sudeste,-21.76,-43.36,939.96,meters,1910-01-01,operante,operante 129 | 83452,JURAMENTO,Minas_Gerais,MG,Sudeste,-16.77,-43.66,648.00,meters,1986-11-14,operante,operante 130 | 82723,LABREA,Amazonas,AM,Norte,-7.25,-64.83,61.00,meters,1972-11-30,operante,operante 131 | 83891,LAGES,Santa_Catarina,SC,Sul,-27.81,-50.33,936.83,meters,1914-01-01,operante,operante 132 | 83916,LAGOA VERMELHA,Rio_Grande_do_Sul,RS,Sul,-28.21,-51.5,840.00,meters,1914-06-01,operante,operante 133 | 83687,LAVRAS,Minas_Gerais,MG,Sudeste,-21.75,-45,918.84,meters,1911-02-18,operante,operante 134 | 83242,LENCOIS,Bahia,BA,Nordeste,-12.56,-41.38,438.74,meters,1931-09-01,operante,operante 135 | 83766,LONDRINA,Parana,PR,Sul,-23.31,-51.13,566.00,meters,1953-12-11,operante,operante 136 | 82296,LUZILANDIA LAG DO PIAUI,Piaui,PI,Nordeste,-3.41,-42.28,49.00,meters,1972-05-18,operante,operante 137 | 82098,MACAPA,Amapa,AP,Norte,-0.05,-51.11,14.46,meters,1925-01-01,operante,operante 138 | 82594,MACAU,Rio_Grande_do_Norte,RN,Nordeste,-5.15,-36.57,32.00,meters,1908-11-18,operante,operante 139 | 82994,MACEIO,Alagoas,AL,Nosdeste,-9.66,-35.7,64.50,meters,1909-01-01,operante,operante 140 | 83683,MACHADO,Minas_Gerais,MG,Sudeste,-21.68,-45.94,873.35,meters,1961-09-01,operante,operante 141 | 82331,MANAUS,Amazonas,AM,Norte,-3.1,-60.01,61.25,meters,1910-01-01,operante,operante 142 | 82533,MANICORE,Amazonas,AM,Norte,-5.81,-61.3,50.00,meters,1928-01-01,operante,operante 143 | 82562,MARABA,Para,PA,Norte,-5.36,-49.13,95.00,meters,1952-01-01,operante,operante 144 | 83767,MARINGA,Parana,PR,Sul,-23.4,-51.91,542.00,meters,1953-12-01,operante,operante 145 | 83214,MATUPA,Mato_Grosso,MT,Centro-Oeste,-10.25,-54.91,285.00,meters,1986-12-15,operante,operante 146 | 82181,MONTE ALEGRE,Para,PA,Norte,-2,-54.1,145.85,meters,1974-03-09,operante,operante 147 | 83090,MONTE SANTO,Bahia,BA,Nordeste,-10.43,-39.29,464.60,meters,1913-05-15,operante,operante 148 | 82792,MONTEIRO,Paraiba,PB,Nordeste,-7.88,-37.06,603.66,meters,1940-01-14,operante,operante 149 | 83437,MONTES CLAROS,Minas_Gerais,MG,Sudeste,-16.68,-43.84,652.00,meters,1912-01-01,operante,operante 150 | 82588,MORADA NOVA,Ceara,CE,Nordeste,-5.11,-38.36,43.62,meters,1962-10-01,operante,operante 151 | 83184,MORRO DO CHAPEU,Bahia,BA,Nordeste,-11.21,-41.21,1003.27,meters,1913-01-13,operante,operante 152 | 82598,NATAL,Rio_Grande_do_Norte,RN,Nordeste,-5.91,-35.2,48.60,meters,1911-01-01,operante,operante 153 | 83319,NOVA XAV XAVANTINA,Mato_Grosso,MT,Centro-Oeste,-14.7,-52.35,316.00,meters,1987-08-05,operante,operante 154 | 82178,OBIDOS,Para,PA,Norte,-1.91,-55.51,37.00,meters,1927-01-01,operante,operante 155 | 82753,OURICURI,Pernambuco,PE,Nordeste,-7.9,-40.04,459.28,meters,1975-09-16,operante,operante 156 | 83364,PADRE RICARDO REMETTER,Mato_Grosso,MT,Centro-Oeste,-15.78,-56.06,140.00,meters,1986-01-01,operante,operante 157 | 83033,PALMAS,Tocantins,TO,Norte,-10.19,-48.3,280.00,meters,1993-10-08,operante,operante 158 | 82992,PALMEIRA DOS INDIOS,Alagoas,AL,Nosdeste,-9.44,-36.7,274.90,meters,1928-01-01,operante,operante 159 | 82990,PAO DE ACUCAR,Alagoas,AL,Nosdeste,-9.75,-37.43,19.10,meters,1927-03-14,operante,operante 160 | 83479,PARACATU,Minas_Gerais,MG,Sudeste,-17.24,-46.88,712.00,meters,1918-05-13,operante,operante 161 | 83844,PARANAGUA,Parana,PR,Sul,-25.53,-48.51,4.50,meters,1911-01-01,operante,operante 162 | 83565,PARANAIBA,Mato_Grosso_do_Sul,MS,Centro-Oeste,-19.75,-51.18,331.25,meters,1971-07-07,operante,operante 163 | 82240,PARINTINS,Amazonas,AM,Norte,-2.63,-56.73,29.00,meters,1912-01-01,operante,operante 164 | 82287,PARNAIBA,Piaui,PI,Nordeste,-3.08,-41.76,79.50,meters,1970-11-16,operante,operante 165 | 83914,PASSO FUNDO,Rio_Grande_do_Sul,RS,Sul,-28.21,-52.4,684.05,meters,1912-08-01,operante,operante 166 | 82791,PATOS,Paraiba,PB,Nordeste,-7.01,-37.26,249.09,meters,1975-10-17,operante,operante 167 | 83531,PATOS DE MINAS,Minas_Gerais,MG,Sudeste,-18.51,-46.43,940.28,meters,1947-10-23,operante,operante 168 | 82882,PAULISTANA,Piaui,PI,Nordeste,-8.13,-41.13,374.22,meters,1975-09-22,operante,operante 169 | 83393,PEDRA AZUL,Minas_Gerais,MG,Sudeste,-16,-41.28,648.91,meters,1918-10-01,operante,operante 170 | 82863,PEDRO AFONSO,Tocantins,TO,Norte,-8.96,-48.18,187.00,meters,1977-03-04,operante,operante 171 | 83228,PEIXE,Tocantins,TO,Norte,-12.01,-48.35,242.49,meters,1975-05-01,operante,operante 172 | 83985,PELOTAS,Rio_Grande_do_Sul,RS,Sul,-31.78,-52.41,13.00,meters,1926-01-01,operante,operante 173 | 82983,PETROLINA,Pernambuco,PE,Nordeste,-9.38,-40.48,370.46,meters,1941-01-01,operante,operante 174 | 82780,PICOS,Piaui,PI,Nordeste,-7.03,-41.48,207.93,meters,1923-11-01,operante,operante 175 | 83483,PIRAPORA,Minas_Gerais,MG,Sudeste,-17.35,-44.91,505.24,meters,1912-12-23,operante,operante 176 | 83376,PIRENOPOLIS,Goias,GO,Centro-Oeste,-15.85,-48.96,740.00,meters,1977-02-17,operante,operante 177 | 82480,PIRIPIRI,Piaui,PI,Nordeste,-4.26,-41.78,161.12,meters,1976-03-09,operante,operante 178 | 83702,PONTA PORA,Mato_Grosso_do_Sul,MS,Centro-Oeste,-22.55,-55.71,650.00,meters,1941-11-24,operante,operante 179 | 83967,PORTO ALEGRE,Rio_Grande_do_Sul,RS,Sul,-30.05,-51.16,46.97,meters,1909-12-09,operante,operante 180 | 82184,PORTO DE MOZ,Para,PA,Norte,-1.73,-52.23,15.93,meters,1928-04-23,operante,operante 181 | 82996,PORTO DE PEDRAS,Alagoas,AL,Nosdeste,-9.18,-35.43,50.02,meters,1927-03-14,operante,operante 182 | 83064,PORTO NACIONAL,Tocantins,TO,Norte,-10.71,-48.41,239.20,meters,1915-01-01,operante,operante 183 | 83332,POSSE,Goias,GO,Centro-Oeste,-14.1,-46.36,825.64,meters,1975-08-04,operante,operante 184 | 83358,POXOREO,Mato_Grosso,MT,Centro-Oeste,-15.83,-54.38,450.00,meters,1978-09-18,operante,operante 185 | 83097,PROPRIA,Sergipe,SE,Nordeste,-10.21,-36.84,19.92,meters,1925-05-10,operante,operante 186 | 82586,QUIXERAMOBIM,Ceara,CE,Nordeste,-5.16,-39.28,79.50,meters,1896-01-01,operante,operante 187 | 82900,RECIFE CURADO,Pernambuco,PE,Nordeste,-8.05,-34.95,10.00,meters,1961-07-07,operante,operante 188 | 82979,REMANSO,Bahia,BA,Nordeste,-9.63,-42.1,400.51,meters,1927-10-01,operante,operante 189 | 83738,RESENDE,Rio_de_Janeiro,RJ,Sudeste,-22.45,-44.44,439.89,meters,1944-05-22,operante,operante 190 | 82915,RIO BRANCO,Acre,AC,Norte,-9.96,-67.8,160.00,meters,1929-01-01,operante,operante 191 | 83743,RIO DE JANEIRO,Rio_de_Janeiro,RJ,Sudeste,-22.89,-43.18,11.10,meters,1917-01-01,operante,operante 192 | 83470,RIO VERDE,Goias,GO,Centro-Oeste,-17.8,-50.91,774.62,meters,1971-01-01,operante,operante 193 | 83373,RONCADOR,Distrito_Federal,DF,Centro-Oeste,-15.93,-47.88,1100.57,meters,1979-05-28,operante,operante 194 | 83410,RONDONOPOLIS,Mato_Grosso,MT,Centro-Oeste,-16.45,-54.56,284.00,meters,1992-01-01,operante,operante 195 | 82106,S G DA CACHOEIRA UAUPES,Amazonas,AM,Norte,-0.11,-67,90.00,meters,1920-04-01,operante,operante 196 | 82689,SAO GONCALO,Paraiba,PB,Nordeste,-6.75,-38.21,233.06,meters,1938-10-08,operante,operante 197 | 83441,SALINAS,Minas_Gerais,MG,Sudeste,-16.15,-42.28,471.32,meters,1925-03-05,operante,operante 198 | 83229,SALVADOR ONDINA,Bahia,BA,Nordeste,-13.01,-38.53,51.41,meters,1903-01-01,operante,operante 199 | 83936,SANTA MARIA,Rio_Grande_do_Sul,RS,Sul,-29.7,-53.7,95.00,meters,1912-01-01,operante,operante 200 | 83997,SANTA VITORIA DO PALMAR,Rio_Grande_do_Sul,RS,Sul,-33.51,-53.35,24.01,meters,1912-10-01,operante,operante 201 | 83726,SAO CARLOS,Sao_Paulo,SP,Sudeste,-21.96,-47.86,856.00,meters,1939-09-24,operante,operante 202 | 82668,SAO FELIX DO XINGU,Para,PA,Norte,-6.63,-51.96,206.00,meters,1972-07-07,operante,operante 203 | 82879,SAO JOAO DO PIAUI,Piaui,PI,Nordeste,-8.35,-42.25,235.33,meters,1975-09-30,operante,operante 204 | 83920,SAO JOAQUIM,Santa_Catarina,SC,Sul,-28.3,-49.93,1415.00,meters,1954-08-01,operante,operante 205 | 83267,SAO JOSE DO RIO CLARO,Mato_Grosso,MT,Centro-Oeste,-13.43,-56.71,350.00,meters,1990-03-14,operante,operante 206 | 83736,SAO LOURENCO,Minas_Gerais,MG,Sudeste,-22.1,-45.01,953.20,meters,1922-02-04,operante,operante 207 | 82280,SAO LUIS,Maranhao,MA,Nordeste,-2.53,-44.21,50.86,meters,1924-11-18,operante,operante 208 | 83907,SAO LUIZ GONZAGA,Rio_Grande_do_Sul,RS,Sul,-28.4,-55.01,245.11,meters,1912-04-01,operante,operante 209 | 83550,SAO MATEUS,Esperito_Santo,ES,Sudeste,-18.7,-39.85,25.04,meters,1969-06-26,operante,operante 210 | 83781,SAO PAULO MIR de SANTANA,Sao_Paulo,SP,Sudeste,-23.5,-46.61,792.06,meters,1945-12-01,operante,operante 211 | 83669,SAO SIMAO,Sao_Paulo,SP,Sudeste,-21.48,-47.55,617.39,meters,1920-01-01,operante,operante 212 | 82690,SERIDO CAICO,Rio_Grande_do_Norte,RN,Nordeste,-6.46,-37.08,169.85,meters,1995-03-14,operante,operante 213 | 83190,SERRINHA,Bahia,BA,Nordeste,-11.63,-38.96,359.63,meters,1904-02-01,operante,operante 214 | 83586,SETE LAGOAS,Minas_Gerais,MG,Sudeste,-19.46,-44.25,732.00,meters,1926-05-03,operante,operante 215 | 82392,SOBRAL,Ceara,CE,Nordeste,-3.73,-40.33,109.62,meters,1919-07-01,operante,operante 216 | 83851,SOROCABA,Sao_Paulo,SP,Sudeste,-23.48,-47.43,645.00,meters,1928-01-01,operante,operante 217 | 82141,SOURE,Para,PA,Norte,-0.73,-48.51,10.49,meters,1928-08-21,operante,operante 218 | 83076,STa R DE CASSIA IBIPETUBA,Bahia,BA,Nordeste,-11.01,-44.51,450.30,meters,1911-12-13,operante,operante 219 | 82797,SURUBIM,Pernambuco,PE,Nordeste,-7.83,-35.71,418.32,meters,1929-10-01,operante,operante 220 | 83235,TAGUATINGA,Tocantins,TO,Norte,-12.4,-46.41,603.59,meters,1915-12-22,operante,operante 221 | 82807,TARAUACA,Acre,AC,Norte,-8.16,-70.76,190.00,meters,1966-06-06,operante,operante 222 | 82683,TAUA,Ceara,CE,Nordeste,-6,-40.41,398.77,meters,1962-02-01,operante,operante 223 | 82317,TEFE,Amazonas,AM,Norte,-3.83,-64.7,47.00,meters,1929-01-04,operante,operante 224 | 82578,TERESINA,Piaui,PI,Nordeste,-5.08,-42.81,74.36,meters,1911-03-21,operante,operante 225 | 83948,TORRES,Rio_Grande_do_Sul,RS,Sul,-29.35,-49.73,4.66,meters,1913-01-01,operante,operante 226 | 82145,TRACUATEUA,Para,PA,Norte,-1.06,-46.9,36.00,meters,1972-09-08,operante,operante 227 | 82789,TRIUNFO,Pernambuco,PE,Nordeste,-7.81,-38.11,1105.00,meters,1953-06-01,operante,operante 228 | 82361,TUCURUI,Para,PA,Norte,-3.76,-49.66,40.00,meters,1970-01-01,operante,operante 229 | 82198,TURIACU,Maranhao,MA,Nordeste,-1.56,-45.36,44.06,meters,1976-07-29,operante,operante 230 | 83577,UBERABA,Minas_Gerais,MG,Sudeste,-19.73,-47.95,737.00,meters,1913-10-11,operante,operante 231 | 83428,UNAI,Minas_Gerais,MG,Sudeste,-16.36,-46.88,460.00,meters,1976-04-07,operante,operante 232 | 83927,URUGUAIANA,Rio_Grande_do_Sul,RS,Sul,-29.75,-57.08,62.31,meters,1912-02-01,operante,operante 233 | 82870,VALE DO GURGUEIA CRISTIANO CASTRO,Piaui,PI,Nordeste,-8.41,-43.71,265.00,meters,1978-08-01,operante,operante 234 | 83642,VICOSA,Minas_Gerais,MG,Sudeste,-20.76,-42.86,712.20,meters,1919-10-01,operante,operante 235 | 83648,VITORIA,Esperito_Santo,ES,Sudeste,-20.31,-40.31,36.20,meters,1923-11-20,operante,operante 236 | 83344,VITORIA DA CONQUISTA,Bahia,BA,Nordeste,-14.88,-40.79,874.81,meters,1936-01-01,operante,operante 237 | 83623,VOTUPORANGA,Sao_Paulo,SP,Sudeste,-20.41,-49.98,502.50,meters,1976-07-05,operante,operante 238 | 82376,ZE DOCA,Maranhao,MA,Nordeste,-3.26,-45.65,45.28,meters,1970-08-25,operante,operante 239 | -------------------------------------------------------------------------------- /data/station_numbers.txt: -------------------------------------------------------------------------------- 1 | 82294 2 | 82989 3 | 83595 4 | 83249 5 | 82353 6 | 82970 7 | 82590 8 | 83096 9 | 83442 10 | 83368 11 | 82659 12 | 83579 13 | 82890 14 | 82696 15 | 83384 16 | 83773 17 | 83049 18 | 82460 19 | 83980 20 | 82768 21 | 83582 22 | 83689 23 | 82784 24 | 82113 25 | 83179 26 | 82571 27 | 83236 28 | 82191 29 | 83587 30 | 82246 31 | 82410 32 | 83941 33 | 82024 34 | 83533 35 | 83919 36 | 83288 37 | 82975 38 | 83377 39 | 82188 40 | 83589 41 | 82886 42 | 83405 43 | 83339 44 | 83681 45 | 82474 46 | 82263 47 | 82795 48 | 83783 49 | 83698 50 | 83714 51 | 83887 52 | 82777 53 | 83270 54 | 83398 55 | 83639 56 | 83514 57 | 82042 58 | 82976 59 | 83592 60 | 83498 61 | 83485 62 | 83408 63 | 82765 64 | 83813 65 | 83526 66 | 83676 67 | 82476 68 | 83942 69 | 82596 70 | 82382 71 | 83883 72 | 83192 73 | 82425 74 | 82326 75 | 82676 76 | 82861 77 | 83718 78 | 83037 79 | 83286 80 | 83552 81 | 82583 82 | 83912 83 | 83222 84 | 82704 85 | 82693 86 | 83361 87 | 83842 88 | 83536 89 | 83538 90 | 83309 91 | 83635 92 | 82610 93 | 83964 94 | 82298 95 | 83338 96 | 83221 97 | 82691 98 | 83581 99 | 82678 100 | 83897 101 | 82212 102 | 83379 103 | 83334 104 | 82397 105 | 83630 106 | 83574 107 | 82893 108 | 83264 109 | 83423 110 | 83374 111 | 82487 112 | 83446 113 | 83075 114 | 82067 115 | 83632 116 | 82686 117 | 82564 118 | 83872 119 | 83522 120 | 83881 121 | 83836 122 | 83182 123 | 83195 124 | 83244 125 | 82336 126 | 82445 127 | 83488 128 | 83695 129 | 83295 130 | 83292 131 | 83521 132 | 83523 133 | 83811 134 | 83704 135 | 83186 136 | 82493 137 | 83395 138 | 83386 139 | 83464 140 | 82798 141 | 83481 142 | 83692 143 | 83452 144 | 82723 145 | 83891 146 | 83916 147 | 83032 148 | 83687 149 | 83242 150 | 83766 151 | 82296 152 | 82098 153 | 82594 154 | 82994 155 | 83683 156 | 82331 157 | 82533 158 | 82562 159 | 83767 160 | 83214 161 | 83389 162 | 82181 163 | 83388 164 | 83090 165 | 82792 166 | 83437 167 | 82588 168 | 83184 169 | 82598 170 | 83513 171 | 83319 172 | 82178 173 | 82753 174 | 83364 175 | 83033 176 | 82992 177 | 82990 178 | 83479 179 | 83844 180 | 83565 181 | 82240 182 | 82287 183 | 83914 184 | 82791 185 | 83531 186 | 82882 187 | 82986 188 | 83393 189 | 82863 190 | 83228 191 | 83985 192 | 82983 193 | 82780 194 | 83483 195 | 83376 196 | 82480 197 | 83570 198 | 83702 199 | 83967 200 | 82184 201 | 82996 202 | 83064 203 | 83332 204 | 83358 205 | 83716 206 | 83097 207 | 82586 208 | 82900 209 | 82979 210 | 83738 211 | 82915 212 | 83743 213 | 83995 214 | 83470 215 | 83373 216 | 83410 217 | 82106 218 | 82689 219 | 83441 220 | 83229 221 | 83936 222 | 83997 223 | 83953 224 | 83726 225 | 82668 226 | 82879 227 | 83920 228 | 83267 229 | 83736 230 | 82280 231 | 83907 232 | 83550 233 | 83781 234 | 83631 235 | 83669 236 | 83088 237 | 82690 238 | 83190 239 | 83586 240 | 82392 241 | 83851 242 | 82141 243 | 83076 244 | 82797 245 | 83235 246 | 82807 247 | 82683 248 | 83784 249 | 82317 250 | 82578 251 | 83948 252 | 82145 253 | 82789 254 | 82361 255 | 82198 256 | 83577 257 | 83428 258 | 83927 259 | 83923 260 | 82870 261 | 83642 262 | 83648 263 | 83344 264 | 83623 265 | 82376 -------------------------------------------------------------------------------- /documents/Comparação de médias diarias de temperatura.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabinhojorge/INMET-API-temperature/2a8c261b04e062e7285dd6083fae269a7b6103ba/documents/Comparação de médias diarias de temperatura.pdf -------------------------------------------------------------------------------- /documents/documentacao_metodologia.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fabinhojorge/INMET-API-temperature/2a8c261b04e062e7285dd6083fae269a7b6103ba/documents/documentacao_metodologia.pdf -------------------------------------------------------------------------------- /extract_data.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # -*- coding: utf-8 -*- 3 | 4 | """ 5 | Author: Fabio Rodrigues Jorge 6 | Email: fabinhojorgenet@gmail.com 7 | Description: Web Crawler to extract information from BDMEP (INMET) database. 8 | """ 9 | 10 | import time 11 | import sys 12 | import csv 13 | from selenium import webdriver 14 | from bs4 import BeautifulSoup 15 | from config import LOGIN, URL_TEMPLATE 16 | from datetime import datetime 17 | from station import Station 18 | 19 | 20 | class InputError(Exception): 21 | """Exception raised for errors in the input.""" 22 | pass 23 | 24 | 25 | def init_webdriver_config(impl_delay=30): 26 | """Function to set the configuration of the Selenium web Driver.""" 27 | 28 | chrome_options = webdriver.ChromeOptions() 29 | chrome_options.add_experimental_option("prefs", {"profile.default_content_setting_values.notifications": 2}) 30 | 31 | chrome_driver = webdriver.Chrome(chrome_options=chrome_options) 32 | chrome_driver.implicitly_wait(impl_delay) 33 | return chrome_driver 34 | 35 | 36 | def get_page(_driver, _url): 37 | """Helper function that navigates and returns an BeautifulSoup page.""" 38 | _driver.get(_url) 39 | time.sleep(5) 40 | return BeautifulSoup(_driver.page_source, 'html.parser') 41 | 42 | 43 | def inmet_login(_driver): 44 | """This function navigates to the login page and do the login.""" 45 | 46 | get_page(_driver, LOGIN['url']) 47 | 48 | _driver.find_element_by_name("mCod").send_keys(LOGIN['username']) 49 | _driver.find_element_by_name("mSenha").send_keys(LOGIN['password']) 50 | _driver.find_element_by_name("btnProcesso").click() 51 | 52 | 53 | def get_url_pattern(): 54 | """This function returns the URL pattern accordingly to the Template passed as system parameter.""" 55 | 56 | if len(sys.argv) > 1: 57 | if sys.argv[1].upper() in URL_TEMPLATE.keys(): 58 | print('TEMPLATE: ', sys.argv[1].upper()) 59 | return URL_TEMPLATE[sys.argv[1].upper()] 60 | else: 61 | raise InputError('The template {0} don´t exist.'.format(sys.argv[1].upper())) 62 | 63 | print('TEMPLATE Default: MONTH') 64 | return URL_TEMPLATE['MONTH'] 65 | 66 | 67 | def load_station_numbers(_path): 68 | """It returns the list of stations.""" 69 | 70 | with open(_path) as _file: 71 | _station_numbers = _file.readlines() 72 | _station_numbers = list(map(lambda x: x.replace("\n", ""), _station_numbers)) 73 | 74 | return _station_numbers 75 | 76 | 77 | if __name__ == '__main__': 78 | 79 | print(">> WebCrawler Started <<") 80 | 81 | count_success = 0 82 | count_error = 0 83 | station_list = [] 84 | 85 | driver = init_webdriver_config(30) 86 | 87 | try: 88 | inmet_login(driver) 89 | 90 | url_pattern = get_url_pattern() 91 | 92 | station_numbers = load_station_numbers("./data/station_numbers.txt") 93 | 94 | start_date = "01/01/2018" 95 | end_date = datetime.now().strftime("%d/%m/%Y") 96 | 97 | for omm_code in station_numbers: 98 | url = url_pattern.format(omm_code=omm_code, start_date=start_date, end_date=end_date) 99 | soup = get_page(driver, url) 100 | 101 | soup_pre = soup.select('pre') 102 | 103 | if len(soup_pre) == 0: # In case of an exception go to the next station 104 | continue 105 | 106 | if 'Não existem dados disponiveis' in soup_pre[0].text: 107 | count_error += 1 108 | else: 109 | content = soup_pre[0].text.split('--------------------') 110 | station = Station.parser(content[2]) 111 | station.set_observation(Station.observation_parser(content[4])) 112 | station_list.append(station) 113 | count_success += 1 114 | 115 | except InputError as e: 116 | print(e) 117 | except Exception as e: 118 | print(e) 119 | finally: 120 | driver.quit() 121 | print(">> WebCrawler Finished <<") 122 | print("SUCCESS: {0}\nERROR: {1}\nTOTAL: {2}".format(count_success, count_error, count_success + count_error)) 123 | 124 | if len(station_list) == 0: 125 | print('No data collected. Exiting...') 126 | exit() 127 | 128 | print(">> Data Processing Started <<") 129 | 130 | data_header = list(filter(None, station_list[0].weather_observation_header.split(';'))) 131 | header = Station.get_station_header() + data_header 132 | 133 | file_path = 'data/output_data.csv' 134 | with open(file_path, 'w', newline='\n', encoding='utf-8') as f: 135 | writer = csv.writer(f, delimiter=';', quotechar="'", quoting=csv.QUOTE_MINIMAL) 136 | 137 | writer.writerow(header) 138 | 139 | for station in station_list: 140 | for ob in station.weather_observation: 141 | row = station.get_station_information() + ob.split(';') 142 | writer.writerow(row) 143 | 144 | print('Saving the file {0} [...]'.format(file_path)) 145 | 146 | print(">> Data Processing Finished <<") 147 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beautifulsoup4==4.8.0 2 | bs4==0.0.1 3 | selenium==3.141.0 4 | soupsieve==1.9.2 5 | urllib3==1.25.3 6 | -------------------------------------------------------------------------------- /state.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | 5 | class State: 6 | """This is a helper class that contains the Brazilian states and their respective regions.""" 7 | 8 | __state = { 9 | 'AC': {'name': 'Acre', 'region': 'Norte'}, 10 | 'AL': {'name': 'Alagoas', 'region': 'Nosdeste'}, 11 | 'AP': {'name': 'Amapa', 'region': 'Norte'}, 12 | 'AM': {'name': 'Amazonas', 'region': 'Norte'}, 13 | 'BA': {'name': 'Bahia', 'region': 'Nordeste'}, 14 | 'CE': {'name': 'Ceara', 'region': 'Nordeste'}, 15 | 'DF': {'name': 'Distrito_Federal', 'region': 'Centro-Oeste'}, 16 | 'ES': {'name': 'Esperito_Santo', 'region': 'Sudeste'}, 17 | 'GO': {'name': 'Goias', 'region': 'Centro-Oeste'}, 18 | 'MA': {'name': 'Maranhao', 'region': 'Nordeste'}, 19 | 'MT': {'name': 'Mato_Grosso', 'region': 'Centro-Oeste'}, 20 | 'MS': {'name': 'Mato_Grosso_do_Sul', 'region': 'Centro-Oeste'}, 21 | 'MG': {'name': 'Minas_Gerais', 'region': 'Sudeste'}, 22 | 'PA': {'name': 'Para', 'region': 'Norte'}, 23 | 'PB': {'name': 'Paraiba', 'region': 'Nordeste'}, 24 | 'PR': {'name': 'Parana', 'region': 'Sul'}, 25 | 'PE': {'name': 'Pernambuco', 'region': 'Nordeste'}, 26 | 'PI': {'name': 'Piaui', 'region': 'Nordeste'}, 27 | 'RJ': {'name': 'Rio_de_Janeiro', 'region': 'Sudeste'}, 28 | 'RN': {'name': 'Rio_Grande_do_Norte', 'region': 'Nordeste'}, 29 | 'RS': {'name': 'Rio_Grande_do_Sul', 'region': 'Sul'}, 30 | 'RO': {'name': 'Rondonia', 'region': 'Norte'}, 31 | 'RR': {'name': 'Roraima', 'region': 'Norte'}, 32 | 'SC': {'name': 'Santa_Catarina', 'region': 'Sul'}, 33 | 'SP': {'name': 'Sao_Paulo', 'region': 'Sudeste'}, 34 | 'SE': {'name': 'Sergipe', 'region': 'Nordeste'}, 35 | 'TO': {'name': 'Tocantins', 'region': 'Norte'}, 36 | } 37 | 38 | @classmethod 39 | def find_state_by_key(cls, key): 40 | """This is the State.find_state_by_key. It returns the state information given the initials of the respective 41 | state.""" 42 | if key not in cls.__state.keys(): 43 | return dict() 44 | return cls.__state[key] 45 | 46 | @classmethod 47 | def find_state_by_name(cls, name): 48 | """This is the State.find_state_by_name. It returns the state information given the Name of the respective 49 | state.""" 50 | return dict(filter(lambda a: str(name).upper() == str(a[1]['name']).upper(), cls.__state.items())) 51 | -------------------------------------------------------------------------------- /station.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | 4 | from state import State 5 | 6 | 7 | class Station: 8 | """This class keep the information related for each one of the stations in station list. And also their 9 | observations""" 10 | 11 | def __init__(self, name_complete, lat, lng, alt, status, op_date): 12 | """Constructor of the Station class: name_complete, lat, lng, alt, status, op_date.""" 13 | 14 | self.name_complete = name_complete 15 | self.lat = lat 16 | self.lng = lng 17 | self.alt = alt 18 | self.status = status 19 | self.op_start_date = op_date 20 | self.weather_observation = [] 21 | self.weather_observation_header = '' 22 | 23 | name_splitted = self.name_complete_parser(name_complete) 24 | self.name = name_splitted['name'] 25 | self.state_initials = name_splitted['state_initials'] 26 | state = State.find_state_by_key(self.state_initials) 27 | self.state_name = state['name'] 28 | self.state_region = state['region'] 29 | self.omm_code = name_splitted['omm_code'] 30 | 31 | @staticmethod 32 | def name_complete_parser(name_complete): 33 | """(Static Method) Parser that given the station name extract from the observation page, it returns a Dict with 34 | the name, state_initials and omm_code""" 35 | 36 | s = name_complete.split('-') 37 | name = s[0].strip() 38 | s = s[1].split('(') 39 | state_initials = s[0].strip() 40 | omm_code = s[1].replace('OMM: ', '').replace(')', '') 41 | 42 | return {'name': name, 'state_initials': state_initials, 'omm_code': omm_code} 43 | 44 | @staticmethod 45 | def parser(data): 46 | """(Static Method) Parser that given the Station information it returns a Station object.""" 47 | ds = data.split('\n') 48 | return Station(ds[1][20:], ds[2][20:], ds[3][20:], ds[4][20:], ds[5], ds[6][20:]) 49 | 50 | @staticmethod 51 | def observation_parser(data): 52 | """(Static Method) Parser that given a observation data it returns a Dict with header and data.""" 53 | ds = data.split('\n') 54 | ds = list(filter(None, ds)) 55 | return {'header': ds[0], 'data': ds[1:], } 56 | 57 | def set_observation(self, observation): 58 | """Given an observation parser object, it sets the observation and observation_header attributes for the Station 59 | class.""" 60 | self.weather_observation_header = observation['header'] 61 | self.weather_observation = observation['data'] 62 | 63 | @staticmethod 64 | def get_station_header(): 65 | """(Static Method) It returns the fixed header fields for the Station. This is used to create the CSV header""" 66 | return [ 67 | 'CodigoOMM', 'NomeEstacao', 'Estado', 'EstadoDesc', 'EstadoRegiao', 'Latitude', 'Longitude', 'Altitude', 68 | 'EstacaoStituacao', 'OperanteDesde', ] 69 | 70 | def get_station_information(self): 71 | """It returns the Station information as a list""" 72 | return [ 73 | self.omm_code, self.name, self.state_initials, self.state_name, self.state_region, self.lat, self.lng, 74 | self.alt, self.status, self.op_start_date, ] 75 | 76 | def __str__(self): 77 | return "{0}|{1}/{2}/{3}/{4})| Lat: {5}| Lng: {6}| Alt: {7}| Situação: {8}| Em operação desde {9}"\ 78 | .format( 79 | self.omm_code, self.name, self.state_initials, self.state_name, self.state_region, self.lat, self.lng, 80 | self.alt, self.status, self.op_start_date) 81 | --------------------------------------------------------------------------------