-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add new data source: Ember #327
Conversation
Thanks! I'm sorry I didn't fully understand your question though.. I thought the logic is like one does the read and convert function based on sources (BP, Ember..), then this is called in something like calcCapacity and calcSE, where many sources can be converted and read in. Tagging @Renato-Rodrigues for a second opinion |
Yes, that's the ideal. My point is, for some sources this isn't very practical because they have data for all variables and it would require a lot of repeated code in many functions. A "lighter" and quicker approach is to only have one calc-function for that source (which is what Falk and I and maybe also others did in the past...). Definitely curious about @Renato-Rodrigues opinion as well, thanks! |
I am not sure I am following 100% the discussion, but if it helps I always follow these principles when delaing wiht REMIND input data:
So, I would approach this in a different way.
|
Thanks for the input, I will do it the way you proposed! Somehow, I wasn't aware that the mapping step can be in the convert function, but it does make a lot of sense for me. This also means, that all of the steps to bring the data in the right format so that it can be used in the historical.mif needs to be moved from the calcOutput function to the convert function. In this case, I don't see a problem here but am not sure if this is the "madrat-way" to do things? |
I am not sure what I wrote is 100% compatible with the "madrat way", but this was always my work flow for dealing with input data that can be used in the model. |
Hi, in most parts @Renato-Rodrigues explained the madrat way. The only part which is a bit different is where teh mapping to REMIND-specific variables is happening. Mostly, we recommend adjusting only the spatial dimension in a convert* function (providing information for all ISO countries). The mapping (which can also include some calculations) should happen in a calc* funciton. If you do not want to repeat it in many other calc* functions using the same source, you can write a calc* function only for mapping variable names. This "intermediate" calc* function can than be used by all following calc* functions. |
I changed the structure of the functions and use a 'calcEmber()' with subtypes now. Is this more or less what you imagined @LaviniaBaumstark ? |
|
||
if (subtype == "capacity") { | ||
# choose only capacity variables | ||
x <- x[, , "GW"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do you need to treat "capacity" and "generation" special here and cannot always read in all?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah this is already the calc-function - got it
#' | ||
#' @export | ||
|
||
calcEmber <- function(subtype = "all") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe another name would help understanding, what is happening, e.g. calcEmberCleaned ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, I didn't plan to use another calc function for "Ember" but would just call calcOutput("Ember", subtype = "capacity")
in calcCapacity()
for example. The only thing left to do there would be to convert to TW.
Includes new
readSource()
andconvert()
function for the yearly electricity data set from Ember:https://ember-climate.org/data-catalogue/yearly-electricity-data/
The Ember data includes
calcCapacity(subtype = "ember")
,calcSE()
andIn this case, I tried to follow the madrat etiquette in dividing the Ember data set into the respective
calcOutput()
functions of the "category" of variables that are present (capacities, SE). However, other data sets contain a much wider range of variables making this approach very tedious and the code repetitive. In some of these case we created acalcOutput()
function per source rather than per variable category (BP, HRE, ...).Any ideas how to organize this in the future?