JGCRI / gcam-core

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

Shareweights in GCAM Water #344

Closed Zaid2995 closed 1 year ago

Zaid2995 commented 1 year ago

Hey everyone, I hope you are doing well!

Just as we have share-weight queries for the energy module, I am trying to add in a share-weight query for the water module, which will allow me to see any changes I make to the share-weights at the basin level, but I am unable to create a query that displays the share-weights. Currently, the query I generated 'returns no results'. I would like to know if someone has experimented with this and was able to create a share-weight query for the Water module.

pkyle commented 1 year ago

I don't know exactly what you're trying to do, but this one is reasonably comprehensive. You can just copy the text block below, and paste it into your "Queries" window of an open model database. Then File -> Save will add it to the queries file so it's always available when you open a database. `

subsector
<axis2 name="Year">share-weight</axis2>
<xPath buildList="true" dataName="price" group="false" sumAll="false">*[@type='sector' and contains(@name,'water')]/
           *[@type='subsector']/
           share-weight/text()</xPath>
<comments/>

`

Zaid2995 commented 1 year ago

Thanks @pkyle for your swift response!

To provide you with some context, I am trying to change the shareweights of water_td_elec which are assigned to basins in India for future years. Currently, they have a fixed shareweight of 1 through 2100, resulting in an equal share of water withdrawals across basins for electricity generation. I want to change that, especially for developing countries where it might not be true. Some basins are already stressed out, and this might impact new power plant installations. I want to explore such scenarios, and for that, I will change the shareweights. I also want to see the changes reflected in the model to confirm (even though the water_td XML also reflects them). Therefore, I am creating a new query.

In terms of the query, earlier, I was typing in 'water_td_elec' instead of 'water'. But correcting for that also 'returns no results'. Any reason you think that might be happening?

pkyle commented 1 year ago

The query I sent just uses string matching. The sector for power sector withdrawals is called water_td_elec_W, but as long as you're using the XPATH function contains(@name, "") (rather than and (@name="")), you should be able to get it from water_td_elec. But it sounds like you really want to use and (@name='water_td_elec_W'). Also just to be clear the model uses calibration-derived share-weights, passed forward to future years using fixed share-weight interpolation. So you don't see the share-weight values in the input XML file water_td.xml, but they're not all equal to 1 (unless you've over-ridden the default behavior).

Zaid2995 commented 1 year ago

Thank you for the response; it worked. Unknowingly, I was typing just 'water_td_elec', whereas I should have been typing in water_td_elec_W, as suggested by you, with the correct XPATH function. Yup, I am aware the model uses calibration-derived share-weights as a default, and I will change those to reflect some of the scenarios I want. This was really helpful, thanks once again.