Skip to content

Commit

Permalink
Final edits before merge
Browse files Browse the repository at this point in the history
1. Adding netcdf4 as requirement
2.  Adding additional instructions for Rdemeter
  • Loading branch information
kanishkan91 committed Aug 22, 2023
1 parent 7b41a5f commit 8de9509
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
32 changes: 31 additions & 1 deletion R_interface/README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,32 @@
# Rdemeter
This is an R interface for demeter.

This is an R interface for demeter.

To use the R functionality, please use the code below by activating the R proj file.

User will first have to ensure that the python version of demeter is installed.

After that, user can run the below to intialize Rdemeter. Note that the user will need to install the `reticulate` R
package.

```R

devtools::load_all(.)
Rdemeter <- port_model_to_R(model_name="demeter",
path_to_python="where python for demeter is installed")
```

After this, the user can access any function from demeter in the `Rdemeter` object, by using `Rdemeter$function_name`.
User can also make use of the convenience function below to pass a demeter config file from R-

```R

run_demeter_R(path_to_inputs=" Add path to config here",
write_outputs=TRUE)

```





5 changes: 3 additions & 2 deletions processing_scripts/demeter_post_process_example.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from demeter.post_process import demeter_plotter as plotter
from demeter.post_process import Post_process_results as proc

# Example on how to run post process results
Expand All @@ -12,8 +11,10 @@

# Example on how to run plotter
folder_path = "C:/Projects/demeter_EPPA/outputs/*"
PFT_name = "PFT9"
PFT_name = "PFT1"
region_id = 0
out_path = "C:/Projects/EPPA_plots/"

from demeter.post_process import demeter_plotter as plotter

plotter = plotter.LandCoverPlotter(folder_path, PFT_name, region_id, out_path)
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def readme():
'scipy >=1.6.3',
'requests>=2.20.0',
'gcamreader>=1.2.5',
'xarray >= 0.20.2'],
'xarray >= 0.20.2',
'netcdf4>= 1.6.4'],
include_package_data=True
)

0 comments on commit 8de9509

Please sign in to comment.