Skip to content

Commit 78f0da7

Browse files
committed
Add front-page readme.
1 parent 4af7a2a commit 78f0da7

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

README.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# gcammaptools
2+
3+
## Overview
4+
5+
The gcammaptools package provides functions for plotting GCAM data on
6+
world or regional maps. This includes functions for parsing the
7+
output of the GCAM ModelInterface, as well as functions for making the
8+
plots, and default projection and theme settings that provide a house
9+
style for GCAM plots.
10+
11+
## Installation
12+
13+
This package must be installed from the github repository using
14+
`install_github`. You will need to install `devtools` first if you
15+
don't have it already.
16+
17+
``` r
18+
install.packages('devtools') # if you don't have it already
19+
devtools::install_github('JGCRI/gcammaptools')
20+
21+
```
22+
23+
## Usage
24+
25+
### Reading GCAM data
26+
27+
You read the data in three stages:
28+
* Parse the output from the ModelInterface.
29+
* Extract the query you want to plot.
30+
* Translate the region names to a numerical ID.
31+
32+
In operation it looks like this:
33+
``` r
34+
tables <- parse_mi_output(fn = 'batch-output.csv')
35+
oil.cons <- process_batch_q(tables, 'primary_energy',
36+
'Reference', c(fuel='a oil'))
37+
oil.cons <- addRegionID(primary.energy, lookupfile=rgn32, drops=rgn32)
38+
```
39+
40+
### Plotting maps
41+
42+
The main plotting function is `plot_GCAM`. You can supply your own
43+
map of region boundaries, but most of the time you will want to use
44+
the ones supplied with the package. You start by merging your data
45+
frame with the map structure, and then passing the result to
46+
`plot_GCAM`:
47+
``` r
48+
data(map.rgn32)
49+
map.oil <- merge(map.rgn32, oil.cons, by='id')
50+
plot_GCAM(map.pe, col='X2050', title='Oil Consumption (2050)', legend=TRUE)
51+
```

0 commit comments

Comments
 (0)