Skip to content

Commit

Permalink
Merge pull request #11 from 0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q/fix/base…
Browse files Browse the repository at this point in the history
…line_specific_FE_differentiation

Fix Non-Differentiated Industry Specific FE Demand
  • Loading branch information
0UmfHxcvx5J7JoaOhFSs5mncnisTJJ6q authored Nov 19, 2024
2 parents 74ffa70 + f561c17 commit 9280f3a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '841386'
ValidationKey: '8599325045'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
4 changes: 2 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'mrindustry: input data generation for the REMIND industry module'
version: 0.4.2
date-released: '2024-11-06'
version: 0.4.2.9001
date-released: '2024-11-18'
abstract: The mrindustry packages contains data preprocessing for the REMIND model.
authors:
- family-names: Benke
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Type: Package
Package: mrindustry
Title: input data generation for the REMIND industry module
Version: 0.4.2
Date: 2024-11-06
Version: 0.4.2.9001
Date: 2024-11-18
Authors@R: c(
person(given = "Falk", family = "Benke", email = "[email protected]",
role = c("aut", "cre")),
Expand Down
14 changes: 4 additions & 10 deletions R/calcFeDemandIndustry.R
Original file line number Diff line number Diff line change
Expand Up @@ -1465,10 +1465,12 @@ calcFeDemandIndustry <- function(use_ODYM_RECC = FALSE,
# default scenario values are calculated from the last year of empirical
# data on
filter('gdp_SSP2' == .data$scenario) %>% # TODO: define default scenario
select(-'scenario') %>%
inner_join(
industry_subsectors_specific_FE,

c("scenario", "region", "subsector")
by = c("region", "subsector"),
relationship = 'many-to-many' # rhs: many years, lhs: many scenarios
) %>%
inner_join(specific_FE_limits, "subsector") %>%
# allow for year-specific decreases
Expand All @@ -1483,15 +1485,7 @@ calcFeDemandIndustry <- function(use_ODYM_RECC = FALSE,
assert(not_na, 'fixing_year',
description = 'missing fixing_year for scenario in specific_FE') %>%
decrease_specific_energy_by_alpha(year = last_empirical_year) %>%
# extend to non-default scenarios
# TODO: this overrides scenario differences present in upstream
# industry_subsectors_specific_energy data. But those are faulty in any
# case, as they relate to historical data, and limited to the SDP scenarios.
# So the upstream differentiation by scenario should be removed.
expand(nesting(!!!syms(setdiff(colnames(.), 'scenario'))),
scenario = unique(industry_subsectors_specific_energy$scenario)) %>%
decrease_specific_energy_by_alpha(exclude_scenario = 'gdp_SSP2') %>%
select("scenario", "region", "year", "subsector", "specific.energy")
select("scenario", "region", "year", "subsector", "specific.energy")

### converge subsector en shares to global value ----
# calculate global shares, weighted by subsector activity
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# input data generation for the REMIND industry module

R package **mrindustry**, version **0.4.2**
R package **mrindustry**, version **0.4.2.9001**

[![CRAN status](https://www.r-pkg.org/badges/version/mrindustry)](https://cran.r-project.org/package=mrindustry) [![R build status](https://github.com/pik-piam/mrindustry/workflows/check/badge.svg)](https://github.com/pik-piam/mrindustry/actions) [![codecov](https://codecov.io/gh/pik-piam/mrindustry/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrindustry)
[![CRAN status](https://www.r-pkg.org/badges/version/mrindustry)](https://cran.r-project.org/package=mrindustry) [![R build status](https://github.com/pik-piam/mrindustry/workflows/check/badge.svg)](https://github.com/pik-piam/mrindustry/actions) [![codecov](https://codecov.io/gh/pik-piam/mrindustry/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/mrindustry) [![r-universe](https://pik-piam.r-universe.dev/badges/mrindustry)](https://pik-piam.r-universe.dev/builds)

## Purpose and Functionality

Expand Down Expand Up @@ -39,7 +39,7 @@ In case of questions / problems please contact Falk Benke <[email protected]>

To cite package **mrindustry** in publications use:

Benke F, Dürrwächter J, Rodrigues R, Moreno-Leiva S, Baumstark L, Pehl M (2024). _mrindustry: input data generation for the REMIND industry module_. R package version 0.4.2, <https://github.com/pik-piam/mrindustry>.
Benke F, Dürrwächter J, Rodrigues R, Moreno-Leiva S, Baumstark L, Pehl M (2024). _mrindustry: input data generation for the REMIND industry module_. R package version 0.4.2.9001, <https://github.com/pik-piam/mrindustry>.

A BibTeX entry for LaTeX users is

Expand All @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is
title = {mrindustry: input data generation for the REMIND industry module},
author = {Falk Benke and Jakob Dürrwächter and Renato Rodrigues and Simón Moreno-Leiva and Lavinia Baumstark and Michaja Pehl},
year = {2024},
note = {R package version 0.4.2},
note = {R package version 0.4.2.9001},
url = {https://github.com/pik-piam/mrindustry},
}
```

0 comments on commit 9280f3a

Please sign in to comment.