JGCRI / gcam-core

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

Querying nesting-subsector technologies #372

Open brinday opened 5 months ago

brinday commented 5 months ago

Yang and I just noticed that technologies with nesting subsector (e.g. regional natural gas) do not show up in inputs by tech and outputs by tech queries. I think it should be an easy fix but I am not sure of the correct syntax for the XML query.

ssmithClimate commented 5 months ago

I believe you just add an extra "/" to the query where the nesting subsector is in the XML hierarchy.

pkyle commented 5 months ago

Unfortunately this isn't as easy as we'd like it to be...what Steve wrote is correct, and you can see it in the example queries for the electric power sector in GCAM-USA at the bottom of Main_queries.xml. *[@type='sector' ]//*[@type='subsector']//*[@type='technology'] However I don't know that there's a single query that one can write that will return the desired information (1) across all levels of nesting (i.e., for sectors with one and with two levels of subsectors), and (2) in all platforms. That query might return the full set of results in the ModelInterface GUI, with the second subsector just returning missing values in the sectors that don't have two levels of subsectors, but then you might get just the results with two levels of subsectors in rgcam. I think I've even seen queries fail to run that have this issue. I generally use multiple queries for this, where the one with two slashes is targeted to the sectors that have multiple levels of subsectors.