Convert Data Formats¶
cs2sc(field)
¶
converts the square (L+1)x(L+1) matrix 'field', containing spherical harmonics coefficients in |C\S| storage format into a rectangular (L+1)x(2L+1) matrix in /S|C\ format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
ndarray
|
the square (L+1)x(L+1) numpy matrix field , containing spherical harmonics coefficients in |C\S| storage format |
required |
Returns:
Type | Description |
---|---|
numpy.ndarray: Rectangular (L+1)x(2L+1) numpy matrix in /S|C\ format |
Raises:
Type | Description |
---|---|
TypeError
|
Input neither in cs nor in sc format |
Todo
- Rather use TypeError instead of base Exception
Examples:
>>> sc_shcoeff = cs2sc(cs_shcoeff)
TO DO: write the output
Source code in pyshbundle/cs2sc.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
sc2cs(field)
¶
converts the rectangular \((L+1) imes (2L+1)\) matrix FIELD, containing spherical harmonics coefficients in /S|C\ storage format into a square (L+1)x(L+1) matrix in |C\S| format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
ndarray
|
the rectangular (L+1)x(2L+1) matrix FIELD, containing spherical harmonics coefficients in /S|C\ storage format |
required |
Returns:
Name | Type | Description |
---|---|---|
cs |
ndarray
|
square (L+1)x(L+1) matrix in |C\S| format |
References
See the SHBundle docs or PySHBundle docs for more info about SH coeff. storage and retrival formats being implementd.
Examples:
>>> cs_fmt = sc2cs(field)
TO DO: show suitable output
Source code in pyshbundle/sc2cs.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
|
clm2cs(data_mat, lmax, sigma_flag=False)
¶
Converts the format from CLM to |C\S|
Under the hood uses the clm2sc
and sc2cs
function
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_mat |
ndarray
|
list containing [degree; order; clm; slm; delta clm; delta slm; start data; end date] |
required |
lmax |
int
|
Max Degree of the spherical harmonic expansion |
required |
sigma_flag |
boolean
|
Flag to return the standard deviation data in |C\S| format or not. Defaults to False |
False
|
Returns:
Type | Description |
---|---|
numpy.ndarray: Spherical Harmonic Coefficients in |C\S| format |
Source code in pyshbundle/clm2cs.py
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
clm2sc(data_mat, lmax, sigma_flag=False)
¶
Converts the spherical harmonic coefficients from clm format to /S|C\ format
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_mat |
ndarray
|
list containing [degree; order; clm; slm; delta clm; delta slm; start data; end date] |
required |
lmax |
int
|
Max Degree of the spherical harmonic expansion |
required |
sigma_flag |
boolean
|
Flag to return the standard deviation data in /S|C\ format or not. Defaults to False |
False
|
Returns:
Type | Description |
---|---|
numpy.ndarray: Spherical Harmonic Coefficients in /S|C\ format |
References
Refer to the SHBundle or PySHBundle docs for the different data storage and retrival formats.
Source code in pyshbundle/clm2sc.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
klm2sc(data)
¶
Converts the spherical harmonic coefficients from klm format to /S|C\ format
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
list
|
list containing [degree; order; clm; slm; delta clm; delta slm; start data; end date] |
required |
Returns:
Type | Description |
---|---|
np.ndarray: Spherical Harmonic Coefficients in /S|C\ format [[files or months]; [2-D matrix of /S|C\ format]] |
|
np.ndarray: Standard Deviations of correcponding Spherical Harmonic Coefficients in /S|C\ format [[files or months]; [2-D matrix of /S|C\ format]] |
Source code in pyshbundle/klm2sc.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
|
klm2sc_new(data_mat, lmax, sigma_flag=False)
¶
Converts the spherical harmonic coefficients from klm format to /S|C\ format
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_mat |
ndarray
|
A 2-D matrix(numpy ndarray) |
required |
lmax |
int
|
maximum degree of spherical harmonic expansion |
required |
sigma_flag |
bool
|
Flag to return the associated standard deviation values. Defaults to False. |
False
|
Returns:
Type | Description |
---|---|
np.ndarray: Spherical Harmonic Coefficients or/and associated standard deviations in /S|C\ format |
Source code in pyshbundle/klm2sc.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
|
Reference¶
- Nico Sneeuw, Matthias Weigelt, Markus Antoni, Matthias Roth, Balaji Devaraju, et. al. (2021). SHBUNDLE 2021. http://www.gis.uni-stuttgart.de/research/projects/Bundles.