xarray_gamera_eggify
- PlasmaCalcs.hookups.mage.gamera.gamera_egg_loader.xarray_gamera_eggify(array, Nk=None, *, Nj=None, squeeze=True, is_full=False, nok_ok=False)
eggify gamera array by stiching together the top (k<Nk//2) and bottom (k>=Nk//2) halves,
connecting them at constant azimuth mod pi, attaching more j values appropriately.array: xarray.DataArray or Dataset with ‘j’ and ‘k’ dimsMust have k symmetric around Nk//2,i.e. for all k0<Nk//2 in array[‘k’], k0+Nk//2 in array as well.Nk: int or Nonefull size of k dimension in original grid (array might be only a slice of grid).if None and is_full=True, infer from array.sizes[‘k’].Nj: int or Nonefull size of j dimension in original grid (array might be only a slice of grid)if None and is_full=True, infer from array.sizes[‘j’].squeeze: boolwhether to squeeze k dimension (isel(k=0)) if there is only 1 k value in result.is_full: boolwhether to infer Nk and Nj from array[‘k’] and array[‘j’] sizes, respectively.if False, Nk and Nj must be provided explicitly.(Only use is_full=True if you know array contains the full, unsliced grid.)nok_ok: boolwhether it is okay if array has no ‘k’ dim.(If array has no ‘k’ dim, then just do the j and eggY processing.)More detailed explanation:————————–“Egg” is a cute name for the full grid shape in x, y, z coords.At fixed k (fixed azimuth) it looks like half an egg in the x-y and x-z planes too.(in x-y it looks more circular, since that is looking at the nose.)For k < Nk//2, it is the “top half”, and for k >= Nk//2 it is the “bottom half”.That is because the azimuth was varied from -pi to pi,instead of being limited to [0, pi].(Nk == self.maindims_full_sizes[‘k’])So, eggifying just means stiching together the top and bottom halves,i.e. the k < Nk//2 and k >= Nk//2 regions,and connecting them in the j axis instead of the k axis.(result k values will all be k < Nk//2.)Note: probably avoid using y and z coordinates when plotting egg data;instead strongly consider putting the eggY coordinate as the y axis.eggY will be set to eggY = sign * rcyl, wherercyl = cylidrical radius (sqrt(y^2 + z^2))sign = +1 for points originally from the “top half”, -1 otherwise.Note that sign(eggY) does not always equal sign(y)!The full result has:- half as many points in k, and twice as many points in j.- (bottom_half_region j values) == 2 * Nj - (top_half_region j values)(this makes sense when input grid j increases from nose to tailin both top and bottom regions. For continuity, after stitching,we want j to increase from nose to tail (top half) thenj in bottom half should go from tail to nose.)- coordinate ‘eggzimuth’, renamed from ‘azimuth’ if it existed,with values converted to be between 0 and pi (“top half region”).- coordinate ‘eggY’ if coordinate ‘rcyl’ exists and does not depend on k.to show image of egg, it is good to use x for x axis, eggY for y axis.