Skip to content

Commit

Permalink
bugfix missing raster import levels
Browse files Browse the repository at this point in the history
  • Loading branch information
k4rst3ns committed Dec 12, 2020
1 parent 137b322 commit 0797bb7
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '5396320'
ValidationKey: '5415219'
AcceptedWarnings:
- 'Warning: package ''.*'' was built under R version'
- 'Warning: namespace ''.*'' is not available and has been replaced'
Expand Down
2 changes: 1 addition & 1 deletion .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "mrmagpie: madrat based MAgPIE Input Data Library",
"version": "0.29.0",
"version": "0.29.1",
"description": "<p>Provides functions for MAgPIE country and cellular input data generation.<\/p>",
"creators": [
{
Expand Down
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: mrmagpie
Type: Package
Title: madrat based MAgPIE Input Data Library
Version: 0.29.0
Date: 2020-12-12
Version: 0.29.1
Date: 2020-12-13
Authors@R: c(person("Kristine", "Karstens", email = "[email protected]", role = c("aut","cre")),
person("Jan Philipp", "Dietrich", email = "[email protected]", role = "aut"),
person("David", "Chen", role = "aut"),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ importFrom(raster,as.matrix)
importFrom(raster,brick)
importFrom(raster,extent)
importFrom(raster,extract)
importFrom(raster,levels)
importFrom(raster,projectRaster)
importFrom(raster,raster)
importFrom(raster,rasterToPoints)
Expand Down
6 changes: 3 additions & 3 deletions R/readIPCCClimate.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@
#' readSource("IPCCClimate", convert="onlycorrect")
#' }
#'
#' @importFrom raster raster aggregate extract
#' @importFrom raster raster aggregate extract levels

readIPCCClimate <- function(){

raster_1d12 <- raster("CLIMATE_ZONE.rst")
zone_names <- as.character(levels(raster_1d12)[[1]]$Class_name)
raster_1d2 <- aggregate(raster_1d12, fact=6, fun=max) # to avoid gaps (since 0 is NA)
raster_1d2 <- raster::aggregate(raster_1d12, fact=6, fun=max) # to avoid gaps (since 0 is NA)

map <- as.data.frame(magpie_coord)
mag <- clean_magpie(as.magpie(extract(raster_1d2,map), spatial=1))
mag <- clean_magpie(as.magpie(raster::extract(raster_1d2,map), spatial=1))
#map[mag==0] <- 6
cellNames <- toolMappingFile(type="cell",name="CountryToCellMapping.csv",readcsv=TRUE)$celliso
getNames(mag) <- "NA"
Expand Down
8 changes: 4 additions & 4 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 **0.29.0**
R package **mrmagpie**, version **0.29.1**



Expand Down Expand Up @@ -38,8 +38,8 @@ 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 (2020). _mrmagpie: madrat
based MAgPIE Input Data Library_. R package version 0.29.0.
Karstens K, Dietrich J, Chen D, Windisch M, Alves M, Beier F, v. Jeetze P, Mishra A, Humpenoeder F (2020). _mrmagpie: madrat based
MAgPIE Input Data Library_. R package version 0.29.1.

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},
year = {2020},
note = {R package version 0.29.0},
note = {R package version 0.29.1},
}
```

0 comments on commit 0797bb7

Please sign in to comment.