Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
flohump committed Aug 11, 2023
1 parent dee9442 commit 90e48e7
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '26687540'
ValidationKey: '26707120'
AutocreateReadme: yes
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'mrmagpie: madrat based MAgPIE Input Data Library'
version: 1.36.3
version: 1.36.4
date-released: '2023-08-11'
abstract: Provides functions for MAgPIE country and cellular input data generation.
authors:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: mrmagpie
Title: madrat based MAgPIE Input Data Library
Version: 1.36.3
Version: 1.36.4
Date: 2023-08-11
Authors@R: c(
person("Kristine", "Karstens", , "[email protected]", role = c("aut", "cre")),
Expand Down
25 changes: 17 additions & 8 deletions R/readGPM2.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,23 @@ readGPM2 <- function() {
todisk = TRUE, memfrac = 0.5)
withr::defer(terra::terraOptions(tempdir = tempdir()))

# read-in file
r <- terra::rast("peatMAY22_1x1_mw_RUS30.tif")

# 0.5 deg raster object
r05 <- terra::rast(res = 0.5)

# project r to 0.5 deg raster
r2 <- terra::project(r, r05, method = "sum")
# Note: terra::project(r, r05, method = "sum") is currently not working on the cluster.
# Therefore, the object r2 has been pre-calculated and stored as peatMAY22_05deg_mw_RUS30.tif
if (file.exists("peatMAY22_05deg_mw_RUS30.tif")) {
r2 <- terra::rast("peatMAY22_05deg_mw_RUS30.tif")
} else {
# read-in file
r <- terra::rast("peatMAY22_1x1_mw_RUS30.tif")

# 0.5 deg raster object
r05 <- terra::rast(res = 0.5)

# project r to 0.5 deg raster
r2 <- terra::project(r, r05, method = "sum")

# save
terra::writeRaster(r2, "peatMAY22_05deg_mw_RUS30.tif", overwrite = TRUE)
}

# get cell area
a <- terra::cellSize(r2[[1]], unit = "ha", mask = TRUE) * 1e-6
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# madrat based MAgPIE Input Data Library

R package **mrmagpie**, version **1.36.3**
R package **mrmagpie**, version **1.36.4**

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

Expand Down Expand Up @@ -39,7 +39,7 @@ In case of questions / problems please contact Kristine Karstens <karstens@pik-p

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

Karstens K, Dietrich J, Chen D, Windisch M, Alves M, Beier F, v. Jeetze P, Mishra A, Humpenoeder F, Führlich P (2023). _mrmagpie: madrat based MAgPIE Input Data Library_. doi:10.5281/zenodo.4319612 <https://doi.org/10.5281/zenodo.4319612>, R package version 1.36.3, <https://github.com/pik-piam/mrmagpie>.
Karstens K, Dietrich J, Chen D, Windisch M, Alves M, Beier F, v. Jeetze P, Mishra A, Humpenoeder F, Führlich P (2023). _mrmagpie: madrat based MAgPIE Input Data Library_. doi:10.5281/zenodo.4319612 <https://doi.org/10.5281/zenodo.4319612>, R package version 1.36.4, <https://github.com/pik-piam/mrmagpie>.

A BibTeX entry for LaTeX users is

Expand All @@ -48,7 +48,7 @@ A BibTeX entry for LaTeX users is
title = {mrmagpie: madrat based MAgPIE Input Data Library},
author = {Kristine Karstens and Jan Philipp Dietrich and David Chen and Michael Windisch and Marcos Alves and Felicitas Beier and Patrick {v. Jeetze} and Abhijeet Mishra and Florian Humpenoeder and Pascal Führlich},
year = {2023},
note = {R package version 1.36.3},
note = {R package version 1.36.4},
doi = {10.5281/zenodo.4319612},
url = {https://github.com/pik-piam/mrmagpie},
}
Expand Down

0 comments on commit 90e48e7

Please sign in to comment.