UT-Covid / episimlab

Framework for development of epidemiological models
https://ut-covid.github.io/episimlab/
BSD 3-Clause "New" or "Revised" License
3 stars 1 forks source link

phi group dimensions appear in output Dataset #4

Closed ethho closed 3 years ago

ethho commented 3 years ago

Output dataset should not contain phi_grp dimensions:

<xarray.Dataset>
Dimensions:                     (age_group: 5, compartment: 16, phi_grp1: 30, phi_grp2: 30, risk_group: 2, step: 121, vertex: 3)
Coordinates:
  * age_group                   (age_group) <U5 '0-4' '5-17' ... '50-64' '65+'
  * compartment                 (compartment) <U5 'S' 'E' 'Pa' ... 'Iy2Ih' 'H2D'
  * phi_grp1                    (phi_grp1) int64 1 0 5 4 3 2 ... 22 27 26 29 28
  * phi_grp2                    (phi_grp2) int64 1 0 5 4 3 2 ... 22 27 26 29 28
  * risk_group                  (risk_group) <U4 'low' 'high'
  * step                        (step) datetime64[ns] 2020-02-01 ... 2020-04-01
  * vertex                      (vertex) int64 0 1 2
Data variables:
    apply_counts_delta__counts  (step, vertex, age_group, risk_group, compartment) float64 ...
    foi__beta                   float64 0.035
    read_config__config_fp      <U83 '/Users/TASethanho/tacc/projects/meyers/...

Likely due to use of global_name in InitPhiGrpMapping: https://github.com/eho-tacc/episimlab/blob/a78732e95593e474fce596ab421c6bef6d5fb317/episimlab/setup/phi.py#L20 (introduced in https://github.com/xarray-contrib/xarray-simlab/pull/160).

ethho commented 3 years ago

Looks like it's actually intended behavior for xsimlab, and my misusage of xs.index, which will always put a dim in the ouput Dataset. Other global refs like phi_grp_mapping do not appear in output DS: https://github.com/eho-tacc/episimlab/blob/a78732e95593e474fce596ab421c6bef6d5fb317/episimlab/setup/phi.py#L22