├── .gitignore ├── INSTALL.md ├── LICENSE-CC-BY.txt ├── LICENSE-MIT.txt ├── Makefile ├── README.md ├── code ├── baixa_dados.py ├── conta_dados.sh ├── lista_paises.py ├── plota_dados.py ├── variacao_temperatura.py └── variacao_temperatura_todos.sh ├── img ├── git-windows-1.png ├── git-windows-2.png ├── git-windows-3.png └── miniforge-1.png └── paper ├── paper.tex └── referencias.bib /.gitignore: -------------------------------------------------------------------------------- 1 | paper/*.pdf 2 | resultados/* 3 | paper/variaveis/* 4 | dados 5 | figuras 6 | -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | # Instalando os softwares no seu computador 2 | 3 | Durante o curso, utilizaremos alguns softwares para acessar o `git`, `make`, 4 | `python` e LaTex: 5 | 6 | * **Git:** O `git` já vem com a maioria dos sistemas Linux. No Windows, 7 | utilizaremos o [Git for Windows](https://gitforwindows.org/) que já vem com 8 | um terminal com Bash (que é muito melhor que o `cmd.exe`). 9 | * **Miniforge:** Para acessar o Python, utilizaremos a distribuição 10 | [Miniforge](https://conda-forge.org/download/). Ela é melhor que o Anaconda 11 | pois vem somente com o Python e o programa `conda` que é utilizado para 12 | instalar outros pacotes. Assim, fica mais fácil instalar novos pacotes 13 | e atualizá-los sem ter conflitos entre versões, como acontece rotineiramente 14 | no Anaconda. O Miniforge também é o jeito mais fácil de instalar o `make` 15 | e o compilador de LaTeX `tectonic` no Windows. 16 | * **Tectonic:** Existem diversos compiladores de LaTeX para as diferentes 17 | plataformas. A maioria costuma ser grande e difícil de instalar, 18 | principalmente no Windows. 19 | O [Tectonic](https://tectonic-typesetting.github.io/en-US/) é um compilador 20 | novo de LaTeX que é fácil de instalar pelo Miniforge e mais fácil de rodar 21 | que os outros compiladores de LaTeX. 22 | 23 | **Siga as instruções abaixo para instalá-los corretamente!** 24 | 25 | ## Windows 26 | 27 | ### 1. Editor de texto 28 | 29 | Baixe e instale um editor de texto, como 30 | [VSCode](https://code.visualstudio.com/) ou 31 | [Notepad++](https://notepad-plus-plus.org/). 32 | Utilize o que achar melhor. Durante o curso utilizaremos o Notepad++ pois 33 | é simples e já está instalado nos computadores da sala. 34 | **Instale o editor de texto primeiro!** 35 | 36 | ### 2. Git e um terminal 37 | 38 | 1. Baixe o [Git for Windows](https://gitforwindows.org/). Ele te dará um 39 | terminal com Bash e Git instalados. 40 | 1. Durante a instalação, siga os passos com a configuração padrão **exceto**: 41 | 1. Na parte "Choosing the default editor used by Git": Selecione o seu 42 | editor de texto no menu. 43 | 44 | ![](img/git-windows-1.png) 45 | 46 | 1. Na parte "Adjusting the name of the initial branch in new repositories": 47 | Selecione "Override the default branch name for new repositories" 48 | 49 | ![](img/git-windows-2.png) 50 | 51 | 1. Na parte "Configuring the terminal emulator to use with Git Bash": 52 | Selecione "Use Windows' default console window" 53 | 54 | ![](img/git-windows-3.png) 55 | 56 | Ao final, você terá acesso ao programa "Git Bash" que te fornecerá um terminal 57 | com a linguagem Bash e o programa Git instalado. 58 | 59 | ### 3. Miniforge 60 | 61 | 1. Baixe o [Miniforge](https://conda-forge.org/download/) para Windows. 62 | 1. Durante a instalação, siga os passos com a configuração padrão **exceto**: 63 | 1. Na parte "Advanced installation options": Selecione "Add Miniforge3 to 64 | my PATH environment variable". 65 | 66 | ![](img/miniforge-1.png) 67 | 68 | Ao final, você poderá usar os comandos `python` e `conda` no terminal do Git 69 | Bash. 70 | 71 | ### 4. Make, Tectonic e outros 72 | 73 | 1. Abra o Git Bash. 74 | 1. Digite `conda install -y make tectonic numpy pandas matplotlib` e aperte 75 | *Enter*. 76 | Isso deve baixar e instalar o programa `make`, o Tectonic e as bibliotecas 77 | de Python que iremos utilizar. 78 | 79 | ## Linux 80 | 81 | Na maioria dos sistemas Linux você já terá um terminal com Bash, `make` e o Git 82 | instalados. Caso seja necessário, instale um editor de texto também, embora 83 | a maioria das distribuições já venha com um. 84 | 85 | 1. Baixe e instale o [Miniforge](https://github.com/conda-forge/miniforge). Ele 86 | te dará o Python e o gerenciador de software `conda` que utilizaremos para 87 | instalar o LaTeX. Siga os passos do instalador para colocar as coisas no seu 88 | `PATH`. 89 | 1. Rode o comando `conda install -y tectonic numpy pandas matplotlib` no 90 | terminal após instalar o Miniforge. 91 | Isso deve baixar e instalar o Tectonic e as bibliotecas de Python que iremos 92 | utilizar. 93 | 94 | -------------------------------------------------------------------------------- /LICENSE-CC-BY.txt: -------------------------------------------------------------------------------- 1 | Attribution 4.0 International 2 | 3 | ======================================================================= 4 | 5 | Creative Commons Corporation ("Creative Commons") is not a law firm and 6 | does not provide legal services or legal advice. Distribution of 7 | Creative Commons public licenses does not create a lawyer-client or 8 | other relationship. Creative Commons makes its licenses and related 9 | information available on an "as-is" basis. Creative Commons gives no 10 | warranties regarding its licenses, any material licensed under their 11 | terms and conditions, or any related information. Creative Commons 12 | disclaims all liability for damages resulting from their use to the 13 | fullest extent possible. 14 | 15 | Using Creative Commons Public Licenses 16 | 17 | Creative Commons public licenses provide a standard set of terms and 18 | conditions that creators and other rights holders may use to share 19 | original works of authorship and other material subject to copyright 20 | and certain other rights specified in the public license below. The 21 | following considerations are for informational purposes only, are not 22 | exhaustive, and do not form part of our licenses. 23 | 24 | Considerations for licensors: Our public licenses are 25 | intended for use by those authorized to give the public 26 | permission to use material in ways otherwise restricted by 27 | copyright and certain other rights. Our licenses are 28 | irrevocable. Licensors should read and understand the terms 29 | and conditions of the license they choose before applying it. 30 | Licensors should also secure all rights necessary before 31 | applying our licenses so that the public can reuse the 32 | material as expected. Licensors should clearly mark any 33 | material not subject to the license. This includes other CC- 34 | licensed material, or material used under an exception or 35 | limitation to copyright. More considerations for licensors: 36 | wiki.creativecommons.org/Considerations_for_licensors 37 | 38 | Considerations for the public: By using one of our public 39 | licenses, a licensor grants the public permission to use the 40 | licensed material under specified terms and conditions. If 41 | the licensor's permission is not necessary for any reason--for 42 | example, because of any applicable exception or limitation to 43 | copyright--then that use is not regulated by the license. Our 44 | licenses grant only permissions under copyright and certain 45 | other rights that a licensor has authority to grant. Use of 46 | the licensed material may still be restricted for other 47 | reasons, including because others have copyright or other 48 | rights in the material. A licensor may make special requests, 49 | such as asking that all changes be marked or described. 50 | Although not required by our licenses, you are encouraged to 51 | respect those requests where reasonable. More_considerations 52 | for the public: 53 | wiki.creativecommons.org/Considerations_for_licensees 54 | 55 | ======================================================================= 56 | 57 | Creative Commons Attribution 4.0 International Public License 58 | 59 | By exercising the Licensed Rights (defined below), You accept and agree 60 | to be bound by the terms and conditions of this Creative Commons 61 | Attribution 4.0 International Public License ("Public License"). To the 62 | extent this Public License may be interpreted as a contract, You are 63 | granted the Licensed Rights in consideration of Your acceptance of 64 | these terms and conditions, and the Licensor grants You such rights in 65 | consideration of benefits the Licensor receives from making the 66 | Licensed Material available under these terms and conditions. 67 | 68 | 69 | Section 1 -- Definitions. 70 | 71 | a. Adapted Material means material subject to Copyright and Similar 72 | Rights that is derived from or based upon the Licensed Material 73 | and in which the Licensed Material is translated, altered, 74 | arranged, transformed, or otherwise modified in a manner requiring 75 | permission under the Copyright and Similar Rights held by the 76 | Licensor. For purposes of this Public License, where the Licensed 77 | Material is a musical work, performance, or sound recording, 78 | Adapted Material is always produced where the Licensed Material is 79 | synched in timed relation with a moving image. 80 | 81 | b. Adapter's License means the license You apply to Your Copyright 82 | and Similar Rights in Your contributions to Adapted Material in 83 | accordance with the terms and conditions of this Public License. 84 | 85 | c. Copyright and Similar Rights means copyright and/or similar rights 86 | closely related to copyright including, without limitation, 87 | performance, broadcast, sound recording, and Sui Generis Database 88 | Rights, without regard to how the rights are labeled or 89 | categorized. For purposes of this Public License, the rights 90 | specified in Section 2(b)(1)-(2) are not Copyright and Similar 91 | Rights. 92 | 93 | d. Effective Technological Measures means those measures that, in the 94 | absence of proper authority, may not be circumvented under laws 95 | fulfilling obligations under Article 11 of the WIPO Copyright 96 | Treaty adopted on December 20, 1996, and/or similar international 97 | agreements. 98 | 99 | e. Exceptions and Limitations means fair use, fair dealing, and/or 100 | any other exception or limitation to Copyright and Similar Rights 101 | that applies to Your use of the Licensed Material. 102 | 103 | f. Licensed Material means the artistic or literary work, database, 104 | or other material to which the Licensor applied this Public 105 | License. 106 | 107 | g. Licensed Rights means the rights granted to You subject to the 108 | terms and conditions of this Public License, which are limited to 109 | all Copyright and Similar Rights that apply to Your use of the 110 | Licensed Material and that the Licensor has authority to license. 111 | 112 | h. Licensor means the individual(s) or entity(ies) granting rights 113 | under this Public License. 114 | 115 | i. Share means to provide material to the public by any means or 116 | process that requires permission under the Licensed Rights, such 117 | as reproduction, public display, public performance, distribution, 118 | dissemination, communication, or importation, and to make material 119 | available to the public including in ways that members of the 120 | public may access the material from a place and at a time 121 | individually chosen by them. 122 | 123 | j. Sui Generis Database Rights means rights other than copyright 124 | resulting from Directive 96/9/EC of the European Parliament and of 125 | the Council of 11 March 1996 on the legal protection of databases, 126 | as amended and/or succeeded, as well as other essentially 127 | equivalent rights anywhere in the world. 128 | 129 | k. You means the individual or entity exercising the Licensed Rights 130 | under this Public License. Your has a corresponding meaning. 131 | 132 | 133 | Section 2 -- Scope. 134 | 135 | a. License grant. 136 | 137 | 1. Subject to the terms and conditions of this Public License, 138 | the Licensor hereby grants You a worldwide, royalty-free, 139 | non-sublicensable, non-exclusive, irrevocable license to 140 | exercise the Licensed Rights in the Licensed Material to: 141 | 142 | a. reproduce and Share the Licensed Material, in whole or 143 | in part; and 144 | 145 | b. produce, reproduce, and Share Adapted Material. 146 | 147 | 2. Exceptions and Limitations. For the avoidance of doubt, where 148 | Exceptions and Limitations apply to Your use, this Public 149 | License does not apply, and You do not need to comply with 150 | its terms and conditions. 151 | 152 | 3. Term. The term of this Public License is specified in Section 153 | 6(a). 154 | 155 | 4. Media and formats; technical modifications allowed. The 156 | Licensor authorizes You to exercise the Licensed Rights in 157 | all media and formats whether now known or hereafter created, 158 | and to make technical modifications necessary to do so. The 159 | Licensor waives and/or agrees not to assert any right or 160 | authority to forbid You from making technical modifications 161 | necessary to exercise the Licensed Rights, including 162 | technical modifications necessary to circumvent Effective 163 | Technological Measures. For purposes of this Public License, 164 | simply making modifications authorized by this Section 2(a) 165 | (4) never produces Adapted Material. 166 | 167 | 5. Downstream recipients. 168 | 169 | a. Offer from the Licensor -- Licensed Material. Every 170 | recipient of the Licensed Material automatically 171 | receives an offer from the Licensor to exercise the 172 | Licensed Rights under the terms and conditions of this 173 | Public License. 174 | 175 | b. No downstream restrictions. You may not offer or impose 176 | any additional or different terms or conditions on, or 177 | apply any Effective Technological Measures to, the 178 | Licensed Material if doing so restricts exercise of the 179 | Licensed Rights by any recipient of the Licensed 180 | Material. 181 | 182 | 6. No endorsement. Nothing in this Public License constitutes or 183 | may be construed as permission to assert or imply that You 184 | are, or that Your use of the Licensed Material is, connected 185 | with, or sponsored, endorsed, or granted official status by, 186 | the Licensor or others designated to receive attribution as 187 | provided in Section 3(a)(1)(A)(i). 188 | 189 | b. Other rights. 190 | 191 | 1. Moral rights, such as the right of integrity, are not 192 | licensed under this Public License, nor are publicity, 193 | privacy, and/or other similar personality rights; however, to 194 | the extent possible, the Licensor waives and/or agrees not to 195 | assert any such rights held by the Licensor to the limited 196 | extent necessary to allow You to exercise the Licensed 197 | Rights, but not otherwise. 198 | 199 | 2. Patent and trademark rights are not licensed under this 200 | Public License. 201 | 202 | 3. To the extent possible, the Licensor waives any right to 203 | collect royalties from You for the exercise of the Licensed 204 | Rights, whether directly or through a collecting society 205 | under any voluntary or waivable statutory or compulsory 206 | licensing scheme. In all other cases the Licensor expressly 207 | reserves any right to collect such royalties. 208 | 209 | 210 | Section 3 -- License Conditions. 211 | 212 | Your exercise of the Licensed Rights is expressly made subject to the 213 | following conditions. 214 | 215 | a. Attribution. 216 | 217 | 1. If You Share the Licensed Material (including in modified 218 | form), You must: 219 | 220 | a. retain the following if it is supplied by the Licensor 221 | with the Licensed Material: 222 | 223 | i. identification of the creator(s) of the Licensed 224 | Material and any others designated to receive 225 | attribution, in any reasonable manner requested by 226 | the Licensor (including by pseudonym if 227 | designated); 228 | 229 | ii. a copyright notice; 230 | 231 | iii. a notice that refers to this Public License; 232 | 233 | iv. a notice that refers to the disclaimer of 234 | warranties; 235 | 236 | v. a URI or hyperlink to the Licensed Material to the 237 | extent reasonably practicable; 238 | 239 | b. indicate if You modified the Licensed Material and 240 | retain an indication of any previous modifications; and 241 | 242 | c. indicate the Licensed Material is licensed under this 243 | Public License, and include the text of, or the URI or 244 | hyperlink to, this Public License. 245 | 246 | 2. You may satisfy the conditions in Section 3(a)(1) in any 247 | reasonable manner based on the medium, means, and context in 248 | which You Share the Licensed Material. For example, it may be 249 | reasonable to satisfy the conditions by providing a URI or 250 | hyperlink to a resource that includes the required 251 | information. 252 | 253 | 3. If requested by the Licensor, You must remove any of the 254 | information required by Section 3(a)(1)(A) to the extent 255 | reasonably practicable. 256 | 257 | 4. If You Share Adapted Material You produce, the Adapter's 258 | License You apply must not prevent recipients of the Adapted 259 | Material from complying with this Public License. 260 | 261 | 262 | Section 4 -- Sui Generis Database Rights. 263 | 264 | Where the Licensed Rights include Sui Generis Database Rights that 265 | apply to Your use of the Licensed Material: 266 | 267 | a. for the avoidance of doubt, Section 2(a)(1) grants You the right 268 | to extract, reuse, reproduce, and Share all or a substantial 269 | portion of the contents of the database; 270 | 271 | b. if You include all or a substantial portion of the database 272 | contents in a database in which You have Sui Generis Database 273 | Rights, then the database in which You have Sui Generis Database 274 | Rights (but not its individual contents) is Adapted Material; and 275 | 276 | c. You must comply with the conditions in Section 3(a) if You Share 277 | all or a substantial portion of the contents of the database. 278 | 279 | For the avoidance of doubt, this Section 4 supplements and does not 280 | replace Your obligations under this Public License where the Licensed 281 | Rights include other Copyright and Similar Rights. 282 | 283 | 284 | Section 5 -- Disclaimer of Warranties and Limitation of Liability. 285 | 286 | a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE 287 | EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS 288 | AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF 289 | ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS, 290 | IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION, 291 | WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR 292 | PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS, 293 | ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT 294 | KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT 295 | ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU. 296 | 297 | b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE 298 | TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION, 299 | NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, 300 | INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES, 301 | COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR 302 | USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN 303 | ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR 304 | DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR 305 | IN PART, THIS LIMITATION MAY NOT APPLY TO YOU. 306 | 307 | c. The disclaimer of warranties and limitation of liability provided 308 | above shall be interpreted in a manner that, to the extent 309 | possible, most closely approximates an absolute disclaimer and 310 | waiver of all liability. 311 | 312 | 313 | Section 6 -- Term and Termination. 314 | 315 | a. This Public License applies for the term of the Copyright and 316 | Similar Rights licensed here. However, if You fail to comply with 317 | this Public License, then Your rights under this Public License 318 | terminate automatically. 319 | 320 | b. Where Your right to use the Licensed Material has terminated under 321 | Section 6(a), it reinstates: 322 | 323 | 1. automatically as of the date the violation is cured, provided 324 | it is cured within 30 days of Your discovery of the 325 | violation; or 326 | 327 | 2. upon express reinstatement by the Licensor. 328 | 329 | For the avoidance of doubt, this Section 6(b) does not affect any 330 | right the Licensor may have to seek remedies for Your violations 331 | of this Public License. 332 | 333 | c. For the avoidance of doubt, the Licensor may also offer the 334 | Licensed Material under separate terms or conditions or stop 335 | distributing the Licensed Material at any time; however, doing so 336 | will not terminate this Public License. 337 | 338 | d. Sections 1, 5, 6, 7, and 8 survive termination of this Public 339 | License. 340 | 341 | 342 | Section 7 -- Other Terms and Conditions. 343 | 344 | a. The Licensor shall not be bound by any additional or different 345 | terms or conditions communicated by You unless expressly agreed. 346 | 347 | b. Any arrangements, understandings, or agreements regarding the 348 | Licensed Material not stated herein are separate from and 349 | independent of the terms and conditions of this Public License. 350 | 351 | 352 | Section 8 -- Interpretation. 353 | 354 | a. For the avoidance of doubt, this Public License does not, and 355 | shall not be interpreted to, reduce, limit, restrict, or impose 356 | conditions on any use of the Licensed Material that could lawfully 357 | be made without permission under this Public License. 358 | 359 | b. To the extent possible, if any provision of this Public License is 360 | deemed unenforceable, it shall be automatically reformed to the 361 | minimum extent necessary to make it enforceable. If the provision 362 | cannot be reformed, it shall be severed from this Public License 363 | without affecting the enforceability of the remaining terms and 364 | conditions. 365 | 366 | c. No term or condition of this Public License will be waived and no 367 | failure to comply consented to unless expressly agreed to by the 368 | Licensor. 369 | 370 | d. Nothing in this Public License constitutes or may be interpreted 371 | as a limitation upon, or waiver of, any privileges and immunities 372 | that apply to the Licensor or You, including from the legal 373 | processes of any jurisdiction or authority. 374 | 375 | 376 | ======================================================================= 377 | 378 | Creative Commons is not a party to its public 379 | licenses. Notwithstanding, Creative Commons may elect to apply one of 380 | its public licenses to material it publishes and in those instances 381 | will be considered the “Licensor.” The text of the Creative Commons 382 | public licenses is dedicated to the public domain under the CC0 Public 383 | Domain Dedication. Except for the limited purpose of indicating that 384 | material is shared under a Creative Commons public license or as 385 | otherwise permitted by the Creative Commons policies published at 386 | creativecommons.org/policies, Creative Commons does not authorize the 387 | use of the trademark "Creative Commons" or any other trademark or logo 388 | of Creative Commons without its prior written consent including, 389 | without limitation, in connection with any unauthorized modifications 390 | to any of its public licenses or any other arrangements, 391 | understandings, or agreements concerning use of licensed material. For 392 | the avoidance of doubt, this paragraph does not form part of the 393 | public licenses. 394 | 395 | Creative Commons may be contacted at creativecommons.org. 396 | -------------------------------------------------------------------------------- /LICENSE-MIT.txt: -------------------------------------------------------------------------------- 1 | Copyright 2025 Leonardo Uieda, Yago M. Castro, Arthur S. Macêdo 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the “Software”), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies 7 | of the Software, and to permit persons to whom the Software is furnished to do 8 | so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Pipeline que gera os resultados, figuras e o PDF do artigo 2 | ############################################################################### 3 | 4 | # Regras para geração dos produtos 5 | ############################################################################### 6 | 7 | # Gera o PDF com o tectonic. Depende do LaTeX, Bibtex, figuras e variáveis 8 | paper/paper.pdf: paper/paper.tex paper/referencias.bib figuras/taxas_variacao.png paper/variaveis/n_paises.tex paper/variaveis/paises.tex 9 | tectonic -X compile paper/paper.tex 10 | 11 | # Regra para remover todos os arquivos gerados pelo Make. 12 | # Isso é padrão em quase todos os Makefiles. 13 | clean: 14 | rm -v -r -f paper/paper.pdf resultados/ paper/variaveis/ dados/ figuras/ 15 | 16 | dados/temperature-data.zip: code/baixa_dados.py 17 | python code/baixa_dados.py dados/ 18 | 19 | # Gera os resultados de variação de temperatura 20 | resultados/variacao_temperatura.csv: code/variacao_temperatura_todos.sh code/variacao_temperatura.py dados/temperature-data.zip 21 | # O mkdir -p cria a pasta caso ela não exista. 22 | # O -p faz com que não ocorra um erro se a pasta já existir. 23 | mkdir -p resultados 24 | bash code/variacao_temperatura_todos.sh dados/temperatura > resultados/variacao_temperatura.csv 25 | 26 | # Gera a figura a partir dos resultados 27 | figuras/taxas_variacao.png: code/plota_dados.py resultados/variacao_temperatura.csv 28 | # O mkdir -p cria a pasta caso ela não exista. 29 | # O -p faz com que não ocorra um erro se a pasta já existir. 30 | mkdir -p figuras 31 | python code/plota_dados.py resultados/variacao_temperatura.csv figuras/taxas_variacao.png 32 | 33 | # Regras para gerar as variáveis utilizadas no LaTeX 34 | paper/variaveis/n_paises.tex: dados/temperature-data.zip 35 | # O mkdir -p cria a pasta caso ela não exista. O -p faz com que não ocorra 36 | # um erro se a pasta já existir. 37 | mkdir -p paper/variaveis 38 | printf "%s" "\\newcommand{\\NPaises}{`ls dados/temperatura/*.csv | wc -l`}" > paper/variaveis/n_paises.tex 39 | 40 | paper/variaveis/paises.tex: code/lista_paises.py dados/temperature-data.zip 41 | # O mkdir -p cria a pasta caso ela não exista. O -p faz com que não ocorra 42 | # um erro se a pasta já existir. 43 | mkdir -p paper/variaveis 44 | python code/lista_paises.py dados/temperatura > paper/variaveis/paises.tex 45 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Kit de sobrevivência digital para cientistas 2 | 3 | Minicurso de 20h que ensina o uso de algumas ferramentas indispensáveis para 4 | o kit de qualquer cientista que lida com dados. 5 | 6 | | | Info | 7 | |--:|:--| 8 | | **Instrutor** | [Leonardo Uieda](https://www.leouieda.com/) | 9 | | **Autores** | [Leonardo Uieda](https://www.leouieda.com/), [Arthur Siqueira de Macêdo](https://github.com/arthursmacedo), [Yago Moreira Castro](https://github.com/YagoMCastro) | 10 | 11 | > Este curso foi desenvolvido como parte das atividades de Leonardo Uieda como 12 | > Embaixador da 13 | > [Rede Brasileira de Reprodutibilidade](https://www.reprodutibilidade.org/), 14 | > uma iniciativa multidisciplinar para promoção de práticas de pesquisa 15 | > transparentes e confiáveis na comunidade científica brasileira. 16 | 17 | ## Objetivos 18 | 19 | Nosso principal objetivo é difundir as práticas de ciência aberta e o uso de 20 | ferramentas que nos auxiliam a garantir a reprodutibilidade de nossos 21 | experimentos e análises computacionais. 22 | Para tanto, ensinaremos noções básicas de diversas ferramentas digitais 23 | (shell/bash, git, GitHub, make, LaTeX) que podem poupar esforços e frustrações 24 | de pesquisadores, alunos e profissionais que lidam com dados (amplamente 25 | definido). 26 | Além disso, o uso das ferramentas e práticas ensinadas pode potencializar sua 27 | produtividade e a robustez de seus fluxos de trabalho. 28 | A fluência no uso destas ferramentas também permitirá a colaboração em projetos 29 | de software livre desenvolvidos pela comunidade. 30 | 31 | ## Justificativa 32 | 33 | A ciência no século XXI depende cada vez de recursos computacionais, desde 34 | estudos inteiros feitos somente utilizando um computador (simulações 35 | geodinâmicas ou de galáxias) até a análise de dados experimentais e produção de 36 | gráficos. 37 | Porém, a maioria dos cientistas e profissionais que trabalham com dads não 38 | possuem treinamento formal em como manejar fluxos computacionais de 39 | processamento de dados complexos, muito menos como desenvolvê-los de forma 40 | colaborativa e que garanta a reprodutibilidade dos resultados. 41 | Este curso visa providenciar tal treinamento. 42 | Nosso foco será ensinar ferramentas que possibilitam a automatização 43 | e documentação do processo científico digital, desde a análise inicial dos 44 | dados até a produção de um artigo científico ou relatório técnico. 45 | Também discutiremos as definições de ciência aberta e reprodutível e como 46 | praticá-la. 47 | 48 | ## Pré-requisitos 49 | 50 | **Público alvo:** Estudantes de graduação e pós-graduação, pesquisadores(as) 51 | e docentes em Geofísica, Geologia, Meteorologia, Astronomia ou outras áreas 52 | correlatas, além de profissionais atuantes na área de análise de dados. 53 | 54 | Os pré-requisitos são: 55 | 56 | * **Conhecimento básico de programação** (de preferência na linguagem Python): 57 | variáveis, funções, loops, criar gráficos. Os exemplos dados em aula 58 | utilizarão scripts e notebooks em Python mas não serão o foco das aulas. 59 | * **Conhecimento básico de análise de dados**: regressão linear, médias, desvio 60 | padrão. Os exemplos dados em aula utilizarão alguns desses conceitos mas eles 61 | não serão o foco das aulas. 62 | 63 | ## Ementa 64 | 65 | O programa do curso é: 66 | 67 | 1. **Uso do terminal e de shell scripts:** Em qualquer sistema operacional, 68 | aprender a utilizar o terminal pode parecer arcaico mas pode ser 69 | extremamente eficaz para executar tarefas repetitivas e automatizar 70 | conjuntos de operações que são feitas com frequência. Aprender a navegar em 71 | um terminal e utilizar a linguagem Bash abrem portas para várias outras 72 | ferramentas úteis. 73 | 2. **Controle de versão e colaboração online com git e GitHub:** Sistemas de 74 | controle de versão, como o git, servem para rastrear mudanças feitas 75 | a conjuntos de arquivos. Se utilizadas de maneira correta, podem fornecer 76 | fontes de backup e a segurança para alterar o conteúdo de arquivos sem 77 | o medo de perder a versão original. Pareados com plataformas online, como 78 | o GitHub e GitLab, o uso desses sistemas permite a colaboração em projetos 79 | de software, websites e até mesmo artigos, livros e teses. 80 | 3. **Automatização de workflows com Make:** O programa Make é amplamente 81 | utilizado desde a década de 70 para automatizar fluxos de trabalho. O uso 82 | mais comum é para a compilação de códigos complexos, mas seu uso vai muito 83 | além disso. Com o Make, é possível automatizar tarefas comuns, como rodar 84 | scripts para produzir figuras, criar PDFs a partir de código LaTeX, etc. 85 | 4. **Criação de artigos, relatórios e teses com LaTeX:** O LaTeX é um 86 | "typesetting system", que transforma código em PDFs. Embora seja mais 87 | trabalhoso de aprender do que softwares como Word, o fato do texto ser 88 | escrito em forma de código possui diversas vantagens: o mesmo texto pode ser 89 | usado para gerar documentos com temas diferentes, facilidade na utilização 90 | de referências cruzadas, geração automática de bibliografia e citações, 91 | numeração automática de equações, figuras e capítulos, etc. 92 | 5. **Ciência aberta e reprodutível:** O que é ciência aberta e como as 93 | ferramentas ensinadas ajudam a garantir a reprodutibilidade dos seus 94 | resultados. 95 | 96 | O formato do curso conterá: 97 | 98 | * **Aulas expositivas:** Para ensinar uma ferramenta nova, o ministrante 99 | realizará uma demonstração ao vivo com os participantes seguindo em seus 100 | próprios computadores. 101 | * **Exercícios:** Intercalado com as aulas expositivas, os participantes 102 | receberão pequenos desafios e exercícios para serem realizados 103 | individualmente e em grupos. 104 | * **Aplicações:** Ao longo do curso, desenvolveremos um artigo científico ou 105 | relatório técnico utilizado as ferramentas ensinadas. Ao final, seremos 106 | capazes de baixar os dados, gerar os resultados e figuras, e produzir um PDF 107 | do nosso documento com um único comando. 108 | 109 | ## O material 110 | 111 | Cada dia do curso teremos alguns produtos que iremos construir passo-a-passo. 112 | Os códigos deste repositório são as versões finais do que iremos construir. 113 | Estão presentes aqui para termos uma referência que possa ser utilizada por 114 | quem precisar. 115 | 116 | Ao final do curso, todos terão gerado um repositório para um artigo que contém 117 | o código para análise dos dados, o código de um artigo LaTeX e um `Makefile` 118 | que coordenada todo o workflow. 119 | Um exemplo de tal repositório é: https://github.com/leouieda/kit-exemplo-2025-02 120 | 121 | Como exemplo, utilizamos dados de médias de temperatura média mensal para 122 | diversos países. Os dados estão disponíveis 123 | https://github.com/compgeolab/temperature-data sob uma licença CC-BY-NC. 124 | Estes dados foram derivados dos dados produzidos pelo 125 | [Berkeley Earth](https://berkeleyearth.org/) que também estão disponíveis sob 126 | a licença CC-BY-NC. 127 | 128 | ## Instalando os softwares no seu computador 129 | 130 | Caso queira utilizar seu próprio computador durante o curso, 131 | **siga as instruções em [INSTALL.md](INSTALL.md)** para instalar os softwares 132 | que utilizaremos durante o curso no seu computador pessoal. 133 | 134 | ## Cronograma 135 | 136 | > Este cronograma é o que seria ideal cobrir em cada dia do curso. Porém, 137 | > muitas vezes não é viável cobrir o conteúdo todo. Nesse caso, cortaremos 138 | > algumas coisas para ter mais tempo de cobrir o essencial da forma necessária. 139 | 140 | ### Dia 1 - O terminal e scripts em Bash 141 | 142 | * Introdução ao curso 143 | * O terminal e a linguagem Bash 144 | * Navegando pelo terminal: Diretórios, caminhos, e arquivos (comandos `cd`, `ls`, `pwd`) 145 | * Manipulando arquivos e diretórios (comandos `cp`, `mkdir`, `mv`, `rm` e uso de wildcards) 146 | * Redirecionamento de saída e entrada (comandos `cat`, `wc`, `head`, `sort`) 147 | * Exemplo: Calculando o número de arquivos de dados que temos. 148 | * Loops com `for` 149 | * Exemplo: Calculando o número de dados em cada arquivo. 150 | * Exemplo: Rodando a análise da variação de temperatura para cada arquivo. 151 | 152 | ### Dia 2 - Controle de versão com git e GitHub 153 | 154 | * Para que servem sistemas de controle de versão 155 | * Configurando o git (comando `git config`) 156 | * Criando um repositório (comando `git init`) 157 | * Populando o repositório e rastreando mudanças (comandos `git add`, `git 158 | status`, `git commit`) 159 | * Explorando o histórico de mudanças (comandos `git diff`, `git log`, `git 160 | checkout`) 161 | * Cópias remotas do repositório no GitHub (comandos `git remote`, `git push`, 162 | `git pull` e chaves SSH de acesso) 163 | * Adicionando arquivos `README.md` para documentar seu repositório 164 | * Exemplo: Criando um repositório para nosso artigo de variações de temperatura 165 | 166 | ### Dia 3 - Automatização de tarefas com GNU Make 167 | 168 | * O problema de dependências em fluxos de trabalho 169 | * A estrutura geram de um `Makefile`: alvo, requisitos e comandos 170 | * O que acontece quando requisitos são atualizados 171 | * Criando alvos "phony"/fictícios: `all`, `clean` 172 | * Exemplo: Criando alvos para nossa análise de temperaturas 173 | 174 | ### Dia 4 - Escrita científica com LaTeX 175 | 176 | * LaTeX vs Word, qual é a diferença? 177 | * Estrutura básica de um documento LaTeX: cabeçalho e corpo 178 | * Usando o comando `\documentclass` 179 | * Compilando um documento com o `tectonic` 180 | * Configurando o idioma com o pacote `babel` 181 | * Adicionando título e autores com `\title`, `\author` e `\maketitle` 182 | * Criando seções com `\section` 183 | * Adicionando citações com Bibtex e o pacote `natbib` 184 | * Obtendo referências em formato Bibtex com https://www.doi2bib.org 185 | * Incluindo figuras com o pacote `graphicx` 186 | * Criando variáveis com `\newcommand` e inserindo resultados no seu documento 187 | * Exemplo: Escrevendo um artigo sobre as mudanças de temperatura. 188 | 189 | ### Dia 5 - Ciência aberta e reprodutível 190 | 191 | * Explorando os conceitos de 192 | [ciência aberta](https://unesdoc.unesco.org/ark:/48223/pf0000379949_por) e 193 | reprodutibilidade de resultados científicos 194 | * Como as ferramentas ensinadas no curso possibilitam ciência aberta 195 | e reprodutível 196 | * Licenças abertas e como utilizá-las: 197 | [Creative Commons](https://creativecommons.org/) e 198 | [Open Source Initiative (OSI)](https://opensource.org/licenses) 199 | * Repositórios de dados: [Zenodo](https://zenodo.org/), [figshare](https://figshare.com/) 200 | * A importância da organização de dados e códigos para facilitar seu uso com 201 | ferramentas computacionais 202 | * Colaborando com outras pessoas utilizando o Git (comandos `git branch`, `git 203 | switch`, `git merge` + forks e pull requests) 204 | * Ambientes virtuais do `conda` para reproduzir seu o ambiente computacional em 205 | outros computadores 206 | * Exemplo: Adicionando licenças no repositório do artigo 207 | * Exemplo: Colaborando na escrita do artigo 208 | 209 | ## Bibliografia 210 | 211 | O material abaixo complementa e expande o que veremos em aula: 212 | 213 | > Recomendamos que todos leiam o material antes das aulas e que os estudem 214 | > a fundo depois das aulas para fixar o conteúdo. 215 | 216 | * [Lição de Bash do Software Carpentry](https://swcarpentry.github.io/shell-novice) 217 | * [Lição de Git do Software Carpentry](https://swcarpentry.github.io/git-novice) 218 | * [Lição de Make do Software Carpentry](https://swcarpentry.github.io/make-novice) 219 | * [Lição de Python do Software Carpentry](https://swcarpentry.github.io/python-novice-inflammation) 220 | * [Documentação de LaTeX do Overleaf](https://www.overleaf.com/learn) 221 | * [Recomendações da UNESCO sobre ciência aberta](https://unesdoc.unesco.org/ark:/48223/pf0000379949_por) 222 | 223 | Além disso, aqui estão mais alguns links para videos e exemplos que vão te 224 | ajudar no dia-a-dia de um cientista digital: 225 | 226 | * [How to name files - Jennifer Bryan](https://www.youtube.com/watch?v=ES1LTlnpLMk). 227 | Provavelmente o vídeo mais útil já feito para qualquer pessoa que trabalha 228 | com dados. Vários outros videos da [NormConf](https://www.youtube.com/@normconf) 229 | valem a pena também. 230 | * [Pooch](https://www.fatiando.org/pooch/latest/). Ferramenta em Python para 231 | baixar dados. Muito útil para lidar com workflows envolvendo dados públicos. 232 | * [Exemplo de artigo feito nos modelos do curso](https://github.com/compgeolab/euler-inversion). 233 | Infelizmente, esse artigo usava Jupyter notebooks e eles não funcionam bem 234 | com o Make (Leo: Sinceramente, provavelmente vou voltar para scripts `.py` no 235 | próximo artigo mesmo depois de 13 anos com o Jupyter). Feito com base no 236 | [template de artigos do CompGeoLab](https://github.com/compgeolab/paper-template). 237 | * [Exemplo de tese feita em LaTeX](https://github.com/santisoler/phd-thesis). 238 | Tese do [Santiago Soler](https://www.santisoler.com/) com ótimo design 239 | e várias boas práticas de LaTeX. 240 | * [Exemplo de memorial acadêmico para concurso feito em LaTeX](https://github.com/leouieda/memorial). 241 | Memorial escrito pelo Leo para o concurso de professor do IAG em 2023 e outros. 242 | Utiliza estilo customizado com detalhes gráficos. 243 | * [Exemplo de CV feito em LaTeX](https://github.com/leouieda/cv). 244 | Currículo resumido do Leo em formato relativamente simples e limpo. 245 | * [Template para projetos de pesquisa em LaTeX](https://github.com/compgeolab/grant-fapesp-template). 246 | Baseada no modelo de projetos da FAPESP mas pode ser adaptada para outras 247 | agências de fomento. 248 | * [Tutorial de como escolher o tamanho de figuras](https://duetosymmetry.com/code/latex-mpl-fig-tips/). 249 | Explica como calcular o tamanho da figura que é gerada pelo código para 250 | que a fonte da figura seja exatamente do mesmo tamanho que a fonte do 251 | texto quando inserida no LaTeX. 252 | 253 | Para os interessados e mais material tangencial ao curso: 254 | 255 | * [Python Challenge](http://www.pythonchallenge.com/). Teste suas habilidades 256 | e aprenda como fazer várias coisas com Python que são muito úteis quando 257 | lidamos com dados. 258 | * [Learn Vim Progressively](https://yannesposito.com/Scratch/en/blog/Learn-Vim-Progressively/). 259 | Guia de como aprender a usar o editor de texto Vim. Recomendo instalar 260 | o [NeoVim](https://neovim.io/) que é uma versão mais moderna e compatível com 261 | o Vim clássico. 262 | * [Choose a License](https://choosealicense.com/). Guia de como escolher e usar 263 | licenças abertas quando você compartilha código e material online. 264 | 265 | ## Licença 266 | 267 | O conteúdo deste curso pode ser livremente utilizado e adaptado dentro das 268 | restrições estabelecidas pelas licenças [MIT](LICENSE-MIT.md) 269 | e [CC-BY](LICENSE-CC-BY.md). Por favor, dê atribuição aos autores e inclua um 270 | link para esse repositório quando utilizar esse material. 271 | 272 | * O código fonte LaTeX, Python, Bash e Makefile são distribuídos segundo a 273 | licença de software livre [MIT](LICENSE-MIT.md). 274 | * O texto da fonte LaTeX e dos arquivos Markdown (`*.md`) são distribuídos 275 | segundo a licença [Creative Commons Attribution (CC-BY)](LICENSE-CC-BY.md). 276 | -------------------------------------------------------------------------------- /code/baixa_dados.py: -------------------------------------------------------------------------------- 1 | """ 2 | Baixa os dados de temperatura média mensal para diversos países. 3 | 4 | Recebe o nome da pasta onde os dados serão baixados pela linha de comando. 5 | 6 | O arquivo zip será baixado na pasta acima e deszipado em uma pasta 7 | "temperatura" dentro dessa mesma pasta. 8 | 9 | Os dados estão disponíveis em https://github.com/compgeolab/temperature-data 10 | sob uma licença CC-BY-NC. Estes dados foram derivados dos dados produzidos pelo 11 | Berkeley Earth (https://berkeleyearth.org/). 12 | 13 | Utiliza a biblioteca Pooch (https://www.fatiando.org/pooch) para baixar os 14 | dados. 15 | """ 16 | import sys 17 | import pooch 18 | 19 | 20 | destination = sys.argv[1] 21 | 22 | # A URL e o hash MD5 foram copiados do repositório de dados 23 | p = pooch.retrieve( 24 | url="https://github.com/compgeolab/temperature-data/releases/download/2025-02-11/temperature-data.zip", 25 | known_hash="md5:d102212049af1695b686c94ae1eea233", 26 | processor=pooch.Unzip(extract_dir="temperatura"), 27 | fname="temperature-data.zip", 28 | path=destination, 29 | ) 30 | -------------------------------------------------------------------------------- /code/conta_dados.sh: -------------------------------------------------------------------------------- 1 | # Conta o número de dados de cada arquivo 2 | # 3 | # Recebe o caminho até a pasta com os dados na linha de comando. Imprime os 4 | # resultados para a tela (STDOUT). 5 | 6 | # Para cada arquivo .csv na pasta data como argumento 7 | # As variáveis 1, 2, 3, ..., contem os argumentos passados na linha de comando 8 | # para o script. Nesse caso, "$1" é o primeiro argumento passado (a pasta onde 9 | # estão os dados). 10 | for arquivo in "$1"/*.csv 11 | do 12 | # O comando "echo" imprime algo na tela. 13 | # O que está entre $() é executado primeiro e o seu resultado é passado 14 | # como argumento do outro comando. No caso, o resultado do "tail ..." 15 | # é passado como o primeiro argumento do echo e o segundo é o nome do 16 | # arquivo, fazendo ele imprimir o número de dados seguidos do nome do 17 | # arquivo. Usa o tail para remover o cabeçalho dos arquivos. 18 | echo "$(tail -n +7 "$arquivo" | wc -l)" "$arquivo" 19 | done 20 | -------------------------------------------------------------------------------- /code/lista_paises.py: -------------------------------------------------------------------------------- 1 | # Cria uma lista dos países analisados definidos em uma variável do LaTeX 2 | # Recebe o caminho da pasta com os arquivos na linha de comando. 3 | # Imprime a definição da variável LaTeX. 4 | import sys 5 | import pathlib 6 | 7 | 8 | # Pega a pasta de dados da linha de comando 9 | data_folder = pathlib.Path(sys.argv[1]) 10 | # Acha todos os arquivos .csv da pasta 11 | data_files = data_folder.glob("*.csv") 12 | # Transforma os nomes dos arquivos em nomes dos países 13 | countries = sorted(f.stem.replace("-", " ").title() for f in data_files) 14 | # Gera uma string com a definição da variável 15 | # Para inserir o character {} numa f-string, usamos {{}} 16 | latex_variable = f"\\newcommand{{\\Paises}}{{{'; '.join(countries)}}}" 17 | # Imprime a definição da variável 18 | print(latex_variable) 19 | -------------------------------------------------------------------------------- /code/plota_dados.py: -------------------------------------------------------------------------------- 1 | """ 2 | Lê os arquivos e gera gráficos em barra das regiões com as cinco maiores e cinco 3 | menores variações de temperatura. 4 | 5 | O caminho até o arquivo com os dados em formato CSV deve ser o primeiro 6 | argumento da linha de comando. 7 | """ 8 | 9 | import sys 10 | import pathlib 11 | import pandas as pd 12 | import matplotlib.pyplot as plt 13 | import numpy as np 14 | 15 | 16 | # O caminho para o arquivo é recebido pela linha de comando 17 | file_path = pathlib.Path(sys.argv[1]) 18 | 19 | # O caminho do arquivo da figura é passado pela linha de comando 20 | fig_path = sys.argv[2] 21 | 22 | # Lê os dados do CSV 23 | data = pd.read_csv(file_path) 24 | 25 | # Ordena dados pela variação de temperatura 26 | data = data.sort_values(by="variacao_C_por_ano") 27 | 28 | # Criando dois subplots 29 | fig, axes = plt.subplots(2, 1, figsize=(5, 7), layout="constrained") 30 | 31 | # Set o label do eixo y, adiciona um grid e rotaciona os nomes dos países 32 | for ax in axes: 33 | ax.set_ylabel("Taxa de variação\nde temperatura (°C/ano)") 34 | ax.tick_params(axis='x', labelrotation=20) 35 | ax.grid(axis="y", linestyle="--") 36 | ax.set_axisbelow(True) 37 | 38 | # Plot do top 5 maiores variações de temperatura 39 | axes[0].bar(data["pais"].tail(5), data["variacao_C_por_ano"].tail(5), color="#666666") 40 | axes[0].set_title("Cinco maiores variações") 41 | 42 | # Plot do top 5 menores variações de temperatura 43 | axes[1].bar(data["pais"].head(5), data["variacao_C_por_ano"].head(5), color="#666666") 44 | axes[1].set_title("Cinco menores variações") 45 | 46 | # Armazena figura em diretório passado pela linha de comando 47 | plt.savefig(fig_path) 48 | -------------------------------------------------------------------------------- /code/variacao_temperatura.py: -------------------------------------------------------------------------------- 1 | """ 2 | Calcula a taxa de variação de temperatura dos últimos 5 anos para um determinado pais. 3 | 4 | O caminho até o arquivo com os dados em formato CSV deve ser o primeiro 5 | argumento da linha de comando. Os resultados são impressos no STDOUT. 6 | """ 7 | 8 | import sys 9 | import pathlib 10 | import pandas as pd 11 | import numpy as np 12 | 13 | 14 | # O caminho para o arquivo é recebido pela linha de comando 15 | file_path = pathlib.Path(sys.argv[1]) 16 | 17 | # Lê o csv ignorando comentários 18 | data = pd.read_csv(file_path, comment="#") 19 | 20 | # Filtra dados dos últimos cinco anos 21 | last_five_years = data[data.year_decimal > data.year_decimal.iloc[-1] - 5] 22 | 23 | # Regressão linear 24 | coefficients = np.polyfit( 25 | last_five_years.year_decimal, last_five_years.temperature_C, 1 26 | ) 27 | 28 | # Impressão de resultados 29 | print(f'{coefficients[0]:.3f},"{file_path.stem.replace("-", " ").title()}"') 30 | -------------------------------------------------------------------------------- /code/variacao_temperatura_todos.sh: -------------------------------------------------------------------------------- 1 | # Script que calcula a variação de temperatura para cada um dos países e os 2 | # colocar em um único arquivo CSV. 3 | # 4 | # O primeiro argumento deve ser a pasta onde estão os dados CSV. 5 | # O resultado será impresso na tela. 6 | 7 | # Inicializa a saída com o nome das colunas 8 | echo "variacao_C_por_ano,pais" 9 | 10 | # O comando entre $() é rodado primeiro. Ele lista os arquivos que terminam em 11 | # .csv na pasta dada (ls) e conta o número de linhas (wc) na resposta, dando 12 | # o número de arquivos. O >&2 significa redirecionar a saída para o canal de 13 | # erros. Assim essa mensagem não será adicionada ao arquivo quando 14 | # redirecionarmos a saída desse script. Isso normalmente é usado para imprimir 15 | # mensagens durante o processamento que não são parte do resultado do script. 16 | echo "Analisando $(ls "$1"/*.csv | wc -l) arquivos:" >&2 17 | 18 | # Para cada arquivo que termina em .csv, faça: 19 | for file in "$1"/*.csv; do 20 | echo -n " Processando $file ..." >&2 21 | 22 | # Roda o script Python com o arquivo. 23 | # O $(dirname $0) pega o diretório de desse script. Assim o script Python 24 | # é achado sempre, mesmo se rodarmos o script fora dessa pasta. 25 | python "$(dirname "$0")"/variacao_temperatura.py "$file" 26 | 27 | echo " feito!" >&2 28 | done 29 | echo "Processo terminado." >&2 30 | -------------------------------------------------------------------------------- /img/git-windows-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compgeolab/kit/baa851f4c2ce8bee6009afb4e1f2db93eb7b8951/img/git-windows-1.png -------------------------------------------------------------------------------- /img/git-windows-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compgeolab/kit/baa851f4c2ce8bee6009afb4e1f2db93eb7b8951/img/git-windows-2.png -------------------------------------------------------------------------------- /img/git-windows-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compgeolab/kit/baa851f4c2ce8bee6009afb4e1f2db93eb7b8951/img/git-windows-3.png -------------------------------------------------------------------------------- /img/miniforge-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/compgeolab/kit/baa851f4c2ce8bee6009afb4e1f2db93eb7b8951/img/miniforge-1.png -------------------------------------------------------------------------------- /paper/paper.tex: -------------------------------------------------------------------------------- 1 | % O tipo de documento e as opções de formatação da página 2 | \documentclass[twocolumn,A4]{article} 3 | 4 | % Pacotes que vamos utilizar (esses estão em quase todos os documentos) 5 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6 | % Para poder usar caracteres especiais e acentos 7 | \usepackage[utf8]{inputenc} 8 | \usepackage[TU]{fontenc} 9 | % Lingua utilizada para o documento 10 | %\usepackage[english]{babel} 11 | \usepackage[brazil]{babel} 12 | % Para mais funções de matemática 13 | \usepackage{amsmath} 14 | \usepackage{amssymb} 15 | % Para inserir figuras 16 | \usepackage{graphicx} 17 | % Para colocar links e metadados no PDF 18 | \usepackage{hyperref} 19 | % Para melhorar a distribuição de texto 20 | \usepackage{microtype} 21 | % Para citações 22 | \usepackage[round,authoryear,sort]{natbib} 23 | 24 | % Configurações de formato do documento (chama funções dos pacotes acima) 25 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 26 | % Configura os metadados do PDF 27 | \hypersetup{ 28 | % Links coloridos ao invés da caixa colorida 29 | colorlinks, 30 | % Cor dos links 31 | allcolors=blue, 32 | % Título que aparece nos metadados 33 | pdftitle={Mudança na temperatura média de países nos últimos cinco anos}, 34 | % Autor que aparece nos metadados 35 | pdfauthor={Leonardo Uieda, Yago M. Castro, Arthur S. Macêdo}, 36 | % Permite quebrar a linha no meio de links 37 | breaklinks=true, 38 | } 39 | 40 | % Incluir as variáveis geradas pelo cógido 41 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 42 | \input{variaveis/n_paises.tex} 43 | \input{variaveis/paises.tex} 44 | 45 | 46 | % Começa o documento em si 47 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 48 | \begin{document} 49 | 50 | \title{Mudança na temperatura média de países nos últimos cinco anos} 51 | \author{ 52 | Leonardo Uieda\textsuperscript{1,2}, 53 | Yago M. Castro\textsuperscript{1,2}, 54 | Arthur S. Macêdo\textsuperscript{1,2} 55 | \\[0.2cm] 56 | {\small 57 | \textsuperscript{1}Computer-Oriented Geoscience Lab; 58 | \textsuperscript{2}Universidade de São Paulo, Brasil 59 | } 60 | } 61 | \date{\today} 62 | 63 | \maketitle 64 | 65 | \begin{abstract} 66 | Mudanças climáticas estão afetando o mundo todo. 67 | Dados de temperatura na superfície da Terra são fundamentais para entendermos como este fenômeno impacta diferentes lugares do mundo. 68 | Analisamos séries temperais de temperatura média mensal de \NPaises{} países. 69 | Com essa análise, determinados quais são os países com maior variação de 70 | temperatura nos últimos cinco anos. 71 | \end{abstract} 72 | 73 | \section{Introdução} 74 | 75 | Sabemos que a temperatura média da Terra tem aumentado durante o Holoceno, com 76 | as mudanças mais recentes sendo consideradas anômalas \citet{Osman2021}. 77 | 78 | \section{Metodologia} 79 | 80 | Seja a taxa variação de temperatura $\alpha$ em graus Celsius por ano, 81 | assumimos uma variação linear da temperatura $T$ com o tempo $t$, 82 | 83 | \begin{equation} 84 | T(t) = t \alpha + \beta 85 | \label{eq:linear} 86 | \end{equation} 87 | 88 | \noindent 89 | em que $\beta$ é o coeficiente linear da reta. 90 | Podemos ajustar a equação \ref{eq:linear} aos dados dos últimos cinco anos 91 | e calcular a taxa de variação $\alpha$. 92 | 93 | \section{Resultados} 94 | 95 | Analisamos os dados de \NPaises{} países: \Paises{}. 96 | 97 | \begin{figure}[htb] 98 | \centering 99 | \includegraphics[width=\linewidth]{../figuras/taxas_variacao.png} 100 | \caption{ 101 | Cinco maiores e menores taxas de variação no nosso conjunto de dados. 102 | } 103 | \label{fig:variacao} 104 | \end{figure} 105 | 106 | Os resultados estão na figura \ref{fig:variacao}. 107 | 108 | \section{Conclusões} 109 | 110 | O mundo está pegando fogo e precisamos parar com a nossa dependência nos 111 | combustíveis fósseis. 112 | 113 | \section*{Agradecimentos} 114 | 115 | Agradecemos a todas as pessoas que dedicaram seu tempo à criação dos softwares 116 | livres dos quais dependemos para a criação desse artigo. 117 | 118 | \bibliographystyle{apalike} 119 | \bibliography{referencias} 120 | 121 | \end{document} 122 | -------------------------------------------------------------------------------- /paper/referencias.bib: -------------------------------------------------------------------------------- 1 | % Artigos usados nas referências 2 | % Melhor jeito de pegar o Bibtex de cada artigo é https://www.doi2bib.org 3 | 4 | @article{Osman2021, 5 | title = {Globally resolved surface temperatures since the Last Glacial Maximum}, 6 | volume = {599}, 7 | ISSN = {1476-4687}, 8 | url = {http://dx.doi.org/10.1038/s41586-021-03984-4}, 9 | DOI = {10.1038/s41586-021-03984-4}, 10 | number = {7884}, 11 | journal = {Nature}, 12 | publisher = {Springer Science and Business Media LLC}, 13 | author = {Osman, Matthew B. and Tierney, Jessica E. and Zhu, Jiang and Tardif, Robert and Hakim, Gregory J. and King, Jonathan and Poulsen, Christopher J.}, 14 | year = {2021}, 15 | month = nov, 16 | pages = {239–244} 17 | } 18 | --------------------------------------------------------------------------------