Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
robinhasse committed May 3, 2023
0 parents commit 1db1f1b
Show file tree
Hide file tree
Showing 38 changed files with 2,214 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.buildlibrary$
^\.pre-commit-config\.yaml$
^Makefile$
^workflow$
7 changes: 7 additions & 0 deletions .buildlibrary
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ValidationKey: 0.0
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
AcceptedNotes: ~
allowLinterWarnings: no
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
output/*
40 changes: 40 additions & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Type: Package
Package: brick
Title: Building sector model with heterogeuous renovation and construction of
the stock
Version: 0.0.1
Date: 2023-02-03
Authors@R:
person("Robin", "Hasse", , "[email protected]",
role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-1818-3186"))
Description: This building stock model represents residential and commercial
buildings at customisable regional and temporal resolution. The building
stock is quantified in floor area and distinuished by building type
(SFH/MFH) and location (rural/urban). In each building category,
construction cohorts are tracked explicitly. This allows to characterise
buildings specifically for each of subset of buildings. The evolution of the
building stock follows from the flows of constructed, renovated and
demolished buildings and is optimised under cost minimisation with a benefit
for heterogeneity in the choice of construction and renovation alternatives.
This benefit captures heterogeneity in the preferences of the aganets and
the building structure.
License: LGPL-3
URL: https://github.com/pik-piam/brick
Depends:
madrat,
magclass,
mredgebuildings,
mrdrivers,
mrremind
Imports:
dplyr,
gamstransfer,
gdxrrw,
quitte,
tidyr,
yaml
Suggests:
testthat
Encoding: UTF-8
RoxygenNote: 7.2.2
52 changes: 52 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Generated by roxygen2: do not edit by hand

export(arrayToGdx)
export(createInputData)
export(createRunFolder)
export(dfToGdx)
export(listToGdx)
export(readConfig)
export(runGams)
export(startModel)
export(toolMakeHandle)
import(madrat)
import(magclass)
import(mrdrivers)
import(mredgebuildings)
import(mrremind)
importFrom(dplyr,"%>%")
importFrom(dplyr,.data)
importFrom(dplyr,across)
importFrom(dplyr,all_of)
importFrom(dplyr,arrange)
importFrom(dplyr,filter)
importFrom(dplyr,group_by)
importFrom(dplyr,lag)
importFrom(dplyr,left_join)
importFrom(dplyr,mutate)
importFrom(dplyr,rename)
importFrom(dplyr,rename_with)
importFrom(dplyr,right_join)
importFrom(dplyr,select)
importFrom(dplyr,summarise)
importFrom(dplyr,sym)
importFrom(dplyr,ungroup)
importFrom(gamstransfer,Container)
importFrom(gdxrrw,igdx)
importFrom(gdxrrw,wgdx)
importFrom(madrat,calcOutput)
importFrom(madrat,readSource)
importFrom(magclass,"getItems<-")
importFrom(magclass,add_dimension)
importFrom(magclass,collapseDim)
importFrom(magclass,getItems)
importFrom(magclass,getYears)
importFrom(magclass,mbind)
importFrom(magclass,mselect)
importFrom(quitte,as.quitte)
importFrom(quitte,calc_addVariable)
importFrom(quitte,inline.data.frame)
importFrom(quitte,interpolate_missing_periods)
importFrom(quitte,revalue.levels)
importFrom(tidyr,complete)
importFrom(yaml,read_yaml)
24 changes: 24 additions & 0 deletions R/arrayToGdx.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#' Prepare data frame for GDX
#'
#' Create an object that can be handled by [gdxrrw::wgdx()] to write the data
#' frame as a gams parameter into a gdx file.
#'
#' This function takes an array and creates a list ready to be written into a
#' gdx file. It will currently always create an output for a gams parameter.
#'
#' @author Robin Hasse
#'
#' @param a array with factor columns for gams dimensions and one value
#' column.
#' @param name character, object name
#' @returns A list with a particular structure required by [gdxrrw::wgdx()].
#' @export
#'
arrayToGdx <- function(a, name) {
list(name = name,
val = a,
uels = dimnames(a),
dim = length(dim(a)),
form = "full",
type = "parameter")
}
4 changes: 4 additions & 0 deletions R/brick-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# The package documentation is defined in this file.
# You can get it via `library(<package>); ?<package>`.
#' @docType package
"_PACKAGE"
Loading

0 comments on commit 1db1f1b

Please sign in to comment.