airmosaic-ai

GCAM BaseX XML/XPath Structure

Based on a typical GCAM-China output database (database_basexdb).

1. Top Level

collection()
  -> scenario
      @name: scenario identifier
      @date: run timestamp
      model-version: text value
      world:
        -> region
            @type = "region"
            @name = "AH" / "BJ" / ... / "China"
            supplysector or pass-through-sector
            resource / renewresource / unlimited-resource
            final-demand
            demographics
            nationalAccount
            gcam-consumer

The most common XPath start for exploratory queries:

collection()/scenario/world/*[@type="region"]

To target only one province:

collection()/scenario/world/*[@type="region" and @name="AH"]

To target the China aggregate node:

collection()/scenario/world/*[@type="region" and @name="China"]

2. Main Child Nodes Under a Province Region

Chinese provinces are identified by GCAM_name from a province code mapping file. Typical region-level children:

child_type xml_node description
sector supplysector main supply/demand sector; most commonly queried
sector pass-through-sector pass-through sector for intermediate energy distribution
resource resource conventional resource
resource renewresource renewable resource
resource unlimited-resource unlimited supply resource
final-demand energy-final-demand final energy demand
(none) demographics population
(none) nationalAccount national accounts / macro
(none) gcam-consumer consumer node

List all top-level sectors in province AH:

for $s in collection()/scenario
for $sec in $s/world/*[@type="region" and @name="AH"]/*[@type="sector"]
return concat($s/@name, ",", $sec/@name)

3. Typical Sector Internal Structure

An industrial sector typically looks like:

region
  -> sector / supplysector
      @type = "sector"
      @name = "cement" / "iron and steel" / ...
      cost:
          @year
          @unit
          text() = price or cost value
      -> subsector
          @type = "subsector"
          @name
          cost / share-weight / ...
          -> technology
              @type = "technology"
              @name
              -> output-primary or output
                  -> physical-output
                      @vintage
                      @unit
                      text() = physical output value
              -> input
                  -> demand-physical
                      @vintage
                      @unit
                      text() = physical input demand

Key points:

4. How sector/cost Is Formed

sector/cost in BaseX output is NOT a copy of any input CSV value. It is the model-solved sector service price or generalized cost, influenced by:

Consequence: Even if all technology input costs are constant, sector/cost varies across years and provinces because energy prices, carbon prices, technology shares, and demand levels change. Do not expect sector/cost to match any single input CSV value.

5. Common Industrial Sector Sub-sector/Technology Examples

cement

iron and steel

chemical

other industry

ammonia

Not all provinces have all sectors. For example, aluminum, paper, and food processing may exist at national level but not always at provincial level in some GCAM-China versions.

6. Province-Level Region Names

Province codes in GCAM-China are standard abbreviations: AH, BJ, CQ, FJ, GS, GD, GX, GZ, HI, HE, HL, HA, HB, HN, NM, JS, JX, JL, LN, NX, QH, SN, SD, SH, SX, SC, TJ, XZ, XJ, YN, ZJ.

The China node is the national aggregate, not a province. See province-region-mapping.md for the full mapping table and aggregation conventions.

7. Marketplace Structure

The Marketplace section records inter-sectoral transactions:

scenario/world/Marketplace/
  -> market
      @type = "market"
      @name = "ChinaCO2" / sector-market names
      @year
      MarketRegion: region name
      MarketGoodOrFuel: good being traded
      price: equilibrium price
      supply: quantity supplied
      -> Info
          -> Pair[Key = "output-unit"]/Value
          -> Pair[Key = "price-unit"]/Value

Marketplace prices are equilibrium transaction prices, distinct from sector costs. For sectors where price-unit and output-unit are incompatible (e.g., iron and steel with 1975$/GJ price and Mt output), marketplace prices may provide a more interpretable price signal — but always verify marketplace price-unit before use.