Open prayner opened 2 weeks ago
@prayner I think I understand the problem.
Perhaps we need to understand how the "national emissions" we're referencing determine the boundaries or inclusions in their data set. Let's discuss in person next week.
A little more detail on the solution: The key problem is how we calculate the sum of a proxy over a domain which is (1) consistent with the national inventory, i.e Australia and (2) consistent with the land mask if it is a masked field. Here is a proposed algorithm:
Consequences:
Some requirements:
Questions:
Some small extra thoughts: I would name this new mask something like inventory_mask. Remember that it has to be attached to a national domain, potentially with a different extent and resolution than the subdomain we are using. I suggest adding a attribute inventory_domain_ds to the configuration and populating it as we do domain_ds. If we don't find an inventory_mask field in the inventory_domain we should create it (see prev post). This needs a function read_or_create_inventory_mask acting on the config. For testing I suggest replacing this with a stub that just copies the land_mask. This will already change results since we will be summing only over the land_mask. Once that's working we implement the algorithm for defining the inventory_mask.
The problem
Versions of the prior which scale a national emission by a spatial proxy are failing because the spatial sum of the proxy over the domain does not match the denominator in the scaling equation local-emission = national-emission times proxy /proxy.sum() where proxy is a 2d field. This is wrong but not simply a code bug. In the first place we should not expect it to work for domains less than national. That is dealt with by the CI tests running on the national domain. But secondly because of the different projections of the proxy and the OM domain there are always significant parts of the proxy lying outside the OM domain. There may also be parts of the OM domain lying outside Australia (e.g. parts of PNG and Indonesia) and these should not be included. Thus we will need to integrate any proxy over an entity we can define as Australia. We will need this even for subdomains since the above spatial-emission equation needs proxy.sum() for Australia, not tjust the chosen domain.
Definition of "done"
Tests are passed and the spatial-emission equation is calculated correctly for national and subdomains. We will need:
Additional context
A possible route is the landuse data file already provided since it is naturally limited to Australia. It is an inefficient way of calculating inclusion though, especially at the high resolution of some of the proxies.