-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regions don't work with sliced Datasets #115
Comments
If the regions are specified along the The only disadvantage I can think of that approach would be if you wanted |
Yes, naming the coordinates It would be nice to have the indices count just 'real' grid cells, but in practice I would start the coordinates from 0 in the boundary cells. Otherwise it's implied that the coordinate |
I think this is an argument for not renaming dimensions at all. There isn't a penalty to carrying around multiple coordinates, so I think There might be one or two functions in xarray which should accept 1D non-dimension coordinates but currently would refuse to, but the neatest solution to that would just be to generalise upstream (I've submitted at least one PR doing that before). |
I guess the biggest one would be: can you |
No you can't. That makes some sense though - You should be able to do |
dimensions with the same names as coordinates seem a bit confusing in general... especially since BOUT++ uses x/y/z both as coordinates (with spacing dx/dy/dz) and often (in the code) as indices. dx, dy and dz are available in the Dataset, so setting y to be a grid-cell-number coordinate is arguably just as confusing as |
Question: what should we name the dimensions and grid-cell-index coordinates in xBOUT? |
|
|
|
|
|
|
|
|
I'd be happy with any variation on Can I veto any variation that uses
|
@ZedThree sorry, was writing the above a bit too late... The 'psi/theta/zeta' options would depend on the geometry chosen by the user. At the moment if you pass |
Ah! In that case, definitely the |
Just came back to look at this issue again. It's what prevents plotting selections of the poloidal plane from working. The problems discussed above I think are now mostly resolved, since we added Fixing this now needs a bit of extra work to:
|
The regions introduced in #107 are based on slicing the Dataset with global indices. The indices stored in
Region
objects will not be correct if the Dataset is sliced for some reason, e.g.ds = ds.isel(x=slice(20, None)
.One way to resolve this might be to add global index coordinates, e.g. for a dataset with dimensions
{'x', 'theta', 'zeta'}
have some coordinates{'x_ind', 'theta_ind', 'zeta_ind'}
that give global integer indices. Then we could use this inRegion.getSlices()
(which might need an extraDataset or DataArray
argument to get the coordinates from) to get offset. E.g. if the passed-in DataArray hasx_ind
that does not start from0
, can subtract theda[x_ind][0]
fromRegion.xinner_ind
, and check thatRegion.xinner_ind
is within the bounds ofx_ind
.The text was updated successfully, but these errors were encountered: