shxarray.core.sh_indexing#
- class shxarray.core.sh_indexing.SHindexBase#
Bases:
object- static mi_fromarrays(nm)#
Generate a MultiIndex of degree and order from an array of degree and order [[n..],[..m]]
In the case of real spherical harmonic, orders m < 0 denote Sine coefficients
- Parameters:
nm (array-like) – An array which hold a vector of degrees and orders
- Returns:
A MultiIndex with degrees “n” and orders “m”
- Return type:
pandas.MultiIndex
- static mi_fromtuples(nm, suf='')#
Generate a MultiIndex of degree and order from a list of (degree,order) tuples
In the case of real spherical harmonic, orders m < 0 denote Sine coefficients
- Parameters:
nm (list) – A list of tuples with degree and order
- Returns:
A MultiIndex with degrees “n” and orders “m”
- Return type:
pandas.MultiIndex
- static mi_toggle(mi, ending='')#
Rename the levels of a (nm)-multindex so that they can be use as alternative coordinates (e.g. transposed versions)
The levels will be swicthed back and fort between the following formats oldname <-> oldname_[ending]
- Parameters:
mi (pandas.MultiIndex) – A MultiIndex with degree and orders
ending (str, optional) – A string which can be additionally appended
- Returns:
A MultiIndex with renamed levels
- Return type:
pandas.MultiIndex
- name = 'nm'#
- name_t = 'nm_'#
- static nm(nmax, nmin=0)#
Convenience function which returns a dictionary which can be used as input for xarray constructors
- Parameters:
nmax (int) – maximum spherical harmonic degree
nmin (int, optional) – minimum spherical harmonic degree
- Returns:
A dictionary specifying the degree and orders and corresponding dimension names in the form of {dim:(dim,nm)}
- Return type:
dictionary
- static nm_mi(nmax, nmin=0)#
Generate a MultiIndex of degree and order which span a spherical harmonic degree range
In the case of real spherical harmonic, orders m < 0 denote Sine coefficients
- Parameters:
nmax (int) – maximum spherical harmonic degree
nmin (int, optional) – minimum spherical harmonic degree
- Returns:
A MultiIndex with degrees “n” and orders “m”
- Return type:
pandas.MultiIndex
- static nsh(nmax, nmin=0, squeeze=True)#
Compute the total amount of spherical harmonic coefficients for a given range
- Parameters:
nmax (int) – maximum spherical harmonic degree
nmin (int, optional) – minimum spherical harmonic degree
squeeze (bool,optional) – Legacy option used when Sine coefficients which have m=0 need to be included
- Returns:
The amount of spherical harmonic coefficients in this range
- Return type:
int