What happened?
Related to
The spatial averaging API assumes a fixed order and number of dimensions while handling bounds. For example, for lat_bnds, it assumes (lat, bnds).
This assumption can possibly presents issues if the order of dims are different or there are more dimensions. We assume fixed order of dimensions using positional indexing in spatial.py here:
|
pm_cells = np.where(domain_bounds[:, 1] - domain_bounds[:, 0] < 0)[0] |
|
return np.abs(domain_bounds[:, 1] - domain_bounds[:, 0]) |
|
if r_bounds[1] >= r_bounds[0]: |
|
# Case 1 (simple case): not wrapping around prime meridian (or |
|
# latitude axis). |
|
# Adjustments for above / right of region. |
|
d_bounds[d_bounds[:, 0] > r_bounds[1], 0] = r_bounds[1] |
|
d_bounds[d_bounds[:, 1] > r_bounds[1], 1] = r_bounds[1] |
|
# Adjustments for below / left of region. |
|
d_bounds[d_bounds[:, 0] < r_bounds[0], 0] = r_bounds[0] |
|
d_bounds[d_bounds[:, 1] < r_bounds[0], 1] = r_bounds[0] |
|
|
|
else: |
|
# Case 2: wrapping around prime meridian [for longitude only] |
|
domain_lowers = d_bounds[:, 0] |
|
domain_uppers = d_bounds[:, 1] |
|
region_lower, region_upper = r_bounds |
What did you expect to happen? Are there are possible answers you came across?
Dynamically handle bounds and their dimensions successfully
Minimal Complete Verifiable Example (MVCE)
Relevant log output
Anything else we need to know?
No response
Environment
Latest main and xCDAT <=0.8.0
What happened?
Related to
The spatial averaging API assumes a fixed order and number of dimensions while handling bounds. For example, for
lat_bnds, it assumes(lat, bnds).This assumption can possibly presents issues if the order of dims are different or there are more dimensions. We assume fixed order of dimensions using positional indexing in
spatial.pyhere:xcdat/xcdat/spatial.py
Line 424 in c198620
xcdat/xcdat/spatial.py
Line 496 in c198620
xcdat/xcdat/spatial.py
Lines 587 to 601 in c198620
What did you expect to happen? Are there are possible answers you came across?
Dynamically handle bounds and their dimensions successfully
Minimal Complete Verifiable Example (MVCE)
Relevant log output
Anything else we need to know?
No response
Environment
Latest
mainand xCDAT <=0.8.0