Skip to content

Commit

Permalink
Added sect on setting the path to MAGICC config files
Browse files Browse the repository at this point in the history
  • Loading branch information
PIKACCOUNTS\tonnru committed Dec 12, 2023
1 parent 561a7c1 commit b5e587c
Showing 1 changed file with 22 additions and 25 deletions.
47 changes: 22 additions & 25 deletions tutorials/02a_RunningREMINDLocally.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,50 +74,47 @@ REMIND_repos_scp_key="/home/myusername/.ssh/id_ed25519"

Make sure to use your username on the cluster and the correct path to your private ssh key (might also be named `id_rsa` or something similar starting with `id_`).

## Start a run
### Tell REMIND where to find MAGICC

In a terminal session change directory to the location where REMIND was cloned via `cd <REMIND_DIR>` and start a run as you would do on the cluster. As a linux user, type
REMIND needs to be told where to find the configuration files of the 'Model for the Assessment of Greenhouse Gas Induced Climate Change' ([MAGICC](https://magicc.org/)). The config files all come with REMIND, so we just need to set the appropriate location in the REMIND default config file at `<REMIND_DIR>/config/default.cfg`. Open the file with a text editor of your choice and locate the variable `magicc_template`. In the `default.cfg` file, the corresponding section will look like

```bash
Rscript start.R
```R
cfg$magicc_template <- "/p/projects/rd3mod/magicc/"
```

or as a Windows user, type
Change it to the fully qualified file path (i.e. a file path without double points `..` or the tilde `~`) of the MAGICC configuration files. These are located at `<REMIND_DIR>/core/magicc`. The resulting line should look like:

```PowerShell
Rscript.exe .\start.R
```R
cfg$magicc_template <- "<REMIND_DIR>/core/magicc/"
```

## Known Issues & Further Debugging
On Linux the fully qualified file path will look similar to:

### MAGCFG_STORE File Path Resolution Fails in `prepare.R`
```R
cfg$magicc_template <- "/home/<YOUR USERNAME>/REMIND/core/magicc"
```

*Telltale sign* Function `prepare()` in `prepare.R` is unable to resolve the file path to `MAGCFG_STORE`, ie. the location where MAGICC configurations are stored. The error message reads:
On Windows remember to also escape the backslashes:

```
Error in prepare() :
ERROR in MAGGICC configuration: Could not find file ./core/magicc/MAGCFG_STORE/MAGCFG_USER_OLDDEFAULT.CFG
```R
cfg$magicc_template <- "C:\\Users\\<YOUR USERNAME>\\REMIND\\core\\magicc"
```

This bug might be specific to Windows systems and is still under investigation. However, there is a
## Start a run

*Solution* Locate lines
In a terminal session change directory to the location where REMIND was cloned via `cd <REMIND_DIR>` and start a run as you would do on the cluster. As a linux user, type

```R
magcfgFile = paste0('./magicc/MAGCFG_STORE/','MAGCFG_USER_',toupper(cfg$gms$cm_magicc_config),'.CFG')
[...]
system(paste0('cp ',magcfgFile,' ','./magicc/MAGCFG_USER.CFG'))
```bash
Rscript start.R
```

in file `<REMIND_DIR>/scripts/start/prepare.R` (around line numbers 680ff). Replace them with
or as a Windows user, type

```R
magcfgFile = normalizePath(paste0('../../core/magicc/MAGCFG_STORE/','MAGCFG_USER_',toupper(cfg$gms$cm_magicc_config),'.CFG'))
[...]
system(paste0('cp ',magcfgFile,' ','../../core/magicc/MAGCFG_USER.CFG'))
```PowerShell
Rscript.exe .\start.R
```

and then restart your run.
## Known Issues & Further Debugging

### `renv` Confuses Itself

Expand Down

0 comments on commit b5e587c

Please sign in to comment.