JGCRI / gcam-core

GCAM -- The Global Change Analysis Model
http://jgcri.github.io/gcam-doc/
Other
288 stars 168 forks source link

Developing Regionally Aggregated Queries (Global North vs Global South) #464

Open ipimenta opened 1 month ago

ipimenta commented 1 month ago

Hi all, I am struggling to write a query that calls & sums energy data by a user-defined aggregate region. In my case, the user-defined aggregate region would be the Global North or the Global South. Specifically, I am interested in modifying the energy->end use sectors->transport->"transport final energy by tech and fuel."

I started by looking at a potentially applicable queryGroup example in energy->end use sectors->aggregated GCAM-USA. The "transport final energy by tech and fuel" query was of particular interest, as it would effectively be doing exactly what I need just for GCAM-USA. However, the only difference I found between the normal query and the "aggregated GCAM-USA" version was the inclusion of a labelRewriteList section. When I added that section in, (replacing the US states with GCAM regions (mapped to either the GN or GS) and replaced "USA" with Global North or Global South), I found that the resulting query would change the region name, but the data was not aggregated (it would still be for whatever country was clicked on). This makes sense as I didn't modify anything in the query like the "group" or "sumAll" parameters. So I tried modifying those, and also tried changing the axis1 to region, but I can't quite seem to get the right combination. Any advice would be greatly appreciated!

ssmithClimate commented 1 month ago

In general, I think what folks tend to do in these cases is get the query data as a .csv, then do the aggregation and analysis in R. It's probably more straightforward than trying to work with the query syntax.

pkyle commented 1 month ago

I agree with Steve and I also have never tried this from the model interface, but if you highlight the Global region only and run the query, does it still leave each region as its own line item?

ipimenta commented 1 month ago

Ok sounds good! Thanks for the info, I can go ahead and do this in R.

I did indeed try the query with the Global Region selected and the output is split into the global north and south, but it loses the tech & fuel resolution. So it's just total transport final energy - Global North vs South.