Skip to content

Commit

Permalink
Update to code in replication package
Browse files Browse the repository at this point in the history
  • Loading branch information
bbrunckh committed Sep 13, 2024
1 parent dcb2d38 commit e3a59c4
Show file tree
Hide file tree
Showing 205 changed files with 44,821 additions and 7,335 deletions.
226 changes: 131 additions & 95 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,95 +1,131 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# DotEnv configuration
.env

# Database
*.db
*.rdb

# Pycharm
.idea

# VS Code
.vscode/

# Spyder
.spyproject/

# Jupyter NB Checkpoints
.ipynb_checkpoints/

# Mac OS-specific storage files
.DS_Store

# vim
*.swp
*.swo

# Mypy cache
.mypy_cache/

# Jupyter Book
_build/

# python-dotenv
.env

# setuptools-scm/
src/*/_version.py
########################################################################
#
# Based on DIME .gitignore template version 2.0
#
########################################################################

#######################
# Start by ignoring everything, and below we are explicitly saying
# what to not ignore
*

#######################
# List of files with GitHub functionality anywhere in the repo
# that we do not want to ignore

# These files include GitHub settings
!.gitignore
!.gitattributes
!.env.example

!.reproducibility_report_RR_2024_WLD_175-v02.pdf

# Git placeholder file (to commit empty folders)
!/**/*.gitkeep

# Keep markdown files used for documentation on GitHub
!README.md
!CONTRIBUTING.md
!LICENSE*

* Unignore reproot files - see https://dime-worldbank.github.io/repkit/articles/reproot-files.html
!reproot*.yaml

#######################
# For performance reasons, if a folder is already ignored, then
# GitHub does not check the content for that folder for matches
# with additional rules. The line below includes folder in the
# top folder (but not their content), so that anything matching
# the rules below will still not be ignored.
!*/

#######################
# The following file types are code that should always be
# included no matter where in the repository folder they are
# located unless you explicitly ignore that folder

# Stata
!/**/*.do
!/**/*.ado
!/**/*.sthlp
!/**/*.smcl

# R
!/**/*.R
!/**/*.Rmd
!/**/*.Rproj
!/**/*.qmd
!/**/*.Rprofile
!/**/renv/

# Still ignore user file for R projects
.Rproj.user

# LaTeX
!/**/*.tex
!/**/*.bib

# Python
!/**/*.py
!/**/*.ipynb
!/**/requirements.txt
!/**/Pipfile
!/**/Pipfile.lock
!/**/*.toml
# Still ignore .ipynb files in checkpoint folders
.ipynb_checkpoints

# Matlab
!/**/*.m

# Markdown
!/**/*.md

# Julia
!/**/*.jl

#Files to create custom layout and functionality
# in dashboards, markdown notebooks, bookdown etc.
!/**/*.css
!/**/*.js
!/**/*.json

#Bash scripts
!/**/*.sh

# Citations
!/**/*.cff

# .yml and .yaml files
# These files sometimes have credentials, so only unignore these lines by removing
# the "#" below after you checked your .yml/.yaml files for sensitive content
!/**/*.yml
!/**/*.yaml

#######################
# Include some additional file formats in any output folder. You might have
# to change the name of the Output folder to whatever it is called in your
# project, but we strongly recommend that you only include these files in
# a subset of the folders where you are certain no private data is ever stored.
!/**/Output/**/*.txt
!/**/Output/**/*.csv
!/**/Output/**/*.xml
!/**/images/**/*.eps
!/**/images/**/*.svg
!/**/images/**/*.png
!/**/images/**/*.ico

#######################
# Include all the files with passwords or tokens here. All files named
# password or passwords are with this template ignored no matter which
# format you are using. Additionally, all content in any folder called
# password or passwords are also ignored. NOTE that your project might be
# using different names and then you must edit the lines below accordingly.
password.*
passwords.*
password/
passwords/
token.*
tokens.*
token/
tokens/
1 change: 0 additions & 1 deletion 01.code/R/.Rprofile

This file was deleted.

52 changes: 26 additions & 26 deletions 01.code/R/00_MASTER.R
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
#------------------------------------------------------------------------------#
# Population at high-risk from climate related hazards #
# R master script #
#------------------------------------------------------------------------------#

# install packages using renv
renv::restore()

# set directory to root replication folder
setwd("../../")

# run from intermediate data?
from_intermediate = TRUE

# !!! Running the MASTER R script from source data is not recommended !!! #
# !!! (~1 TB storage required, > 14 days run time) !!! #

# run scripts
if (from_intermediate) {
source("01.code/R/10_extract_exposed_pop.R")
source("01.code/R/11_clean_exposed_pop.R")
} else {
script_list <- list.files("01.code/R", ".R$", full.names = TRUE)
for (code in setdiff(script_list, "01.code/R/00_MASTER.R")) {
source(code)
}
#------------------------------------------------------------------------------#
# Population at high-risk from climate related hazards #
# R master script #
#------------------------------------------------------------------------------#

# install packages using renv
# just the first time you run the package
renv::restore()

setwd("C:/Temp/08.replication package/")

# run from intermediate data?
from_intermediate = TRUE

# !!! Running the MASTER R script from source data is not recommended !!! #
# !!! (~1 TB storage required, > 14 days run time) !!! #

# run scripts
if (from_intermediate) {
source("01.code/R/10_extract_exposed_pop.R")
source("01.code/R/11_clean_exposed_pop.R")
} else {
script_list <- list.files("01.code/R", ".R$", full.names = TRUE)
for (code in setdiff(script_list, "01.code/R/00_MASTER.R")) {
source(code)
}
}
Empty file modified 01.code/R/01_prep_flood_fathom.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/02_prep_flood_deltares.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/03_prep_flood_combine.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/04_prep_cyclone_drought_heatwave.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/05_prep_degurban.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/06_prep_rai.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/07_classify_hazards.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/08_combine_hazards.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/09_combine_hazards_degurban.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/10_extract_exposed_pop.R
100644 → 100755
Empty file.
Empty file modified 01.code/R/11_clean_exposed_pop.R
100644 → 100755
Empty file.
Loading

0 comments on commit e3a59c4

Please sign in to comment.