Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/gcamwrapper.R
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ get_data <- function(gcam, query, query_params = list()) {

#' Get the last run GCAM model period
#' @param gcam (gcam) An initialized GCAM instance
#' @return (integer) The last period used in `run_to_period` wheter it succeeded or failed
#' @return (integer) The last period used in `run_period` whether it succeeded or failed
#' @export
get_current_period <- function(gcam) {
gcam$get_current_period()
}

#' Get the last run GCAM model year
#' @param gcam (gcam) An initialized GCAM instance
#' @return (integer) The last period used in `run_to_period` wheter it
#' @return (integer) The last period used in `run_period` whether it
#" succeeded or failed but converted to year
#' @export
get_current_year <- function(gcam) {
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ library(ggplot2)
# appropriate working directory
g <- create_and_initialize("configuration_ref.xml", "/Users/pralitp/model/gcam-core-git/exe")
# Run the model up to period 5, the year 2020
run_to_period(g, 5L)
run_period(g, 5L)

# Do a simple experiment: see how CO2 emissions change after arbitrarily changing
# the GDP
Expand Down Expand Up @@ -213,7 +213,7 @@ double_check <- get_data(g, labor_prod_query, list("region", "year" = c("=", 202

# we have only set the parameters at this point, to see how it effects
# results we must re-run period 5
run_to_period(g, 5L)
run_period(g, 5L)

# Get the CO2 emissions again and see how they have changed
co2_change <- get_data(g, co2_query, query_params)
Expand Down Expand Up @@ -290,7 +290,7 @@ import gcamwrapper
# appropriate working directory
g = gcamwrapper.Gcam("configuration_ref.xml", "C:/GCAM/gcam-core/exe")
# Run the model up to period 5, the year 2020
g.run_to_period(5)
g.run_period(5)

# Do a simple experiment: see how CO2 emissions change after arbitrarily changing
# the GDP
Expand Down Expand Up @@ -363,7 +363,7 @@ double_check = g.get_data(labor_prod_query, "region", "year"=["=", 2020])

# we have only set the parameters at this point, to see how it effects
# results we must re-run period 5
g.run_to_period(5)
g.run_period(5)

# Get the CO2 emissions again and see how they have changed
co2_change = g.get_data(co2_query, **query_params)
Expand Down
4 changes: 2 additions & 2 deletions gcamwrapper/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,15 +176,15 @@ def set_data_fast(self, data_df, query, *args, **kwargs):
def get_current_period(self):
"""Get the last run GCAM model period

:returns: The last period used in `run_to_period` wheter it succeeded or failed
:returns: The last period used in `run_period` whether it succeeded or failed
"""

return super(Gcam, self).get_current_period()

def get_current_year(self):
"""Get the last run GCAM model year

:returns: The last period used in `run_to_period` wheter it succeeded or failed but converted to year
:returns: The last period used in `run_period` whether it succeeded or failed but converted to year
"""

return self.convert_period_to_year(self.get_current_period())
Expand Down
2 changes: 1 addition & 1 deletion man/get_current_period.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/get_current_year.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.