|
33 | 33 | change_reference, |
34 | 34 | change_tide_system, |
35 | 35 | normal_zonal_correction, |
| 36 | + sh_to_deflection_of_vertical, |
| 37 | + sh_to_gravity_disturbance, |
| 38 | + sh_to_potential_partial_derivative_longitude, |
36 | 39 | ) |
37 | 40 | from lenapy.utils.harmo import * |
38 | 41 | from lenapy.writers.gravi_writer import dataset_to_gfc |
@@ -135,12 +138,12 @@ def _apply_operator(self, op, other): |
135 | 138 | self.ds = self._obj.sel(l=common_l, m=common_m) |
136 | 139 |
|
137 | 140 | # case where other does not have a time dimension |
138 | | - if "time" not in other.coords: |
| 141 | + if "time" not in other.dims: |
139 | 142 | self.ds["clm"] = op(self.ds.clm, other.clm.sel(l=common_l, m=common_m)) |
140 | 143 | self.ds["slm"] = op(self.ds.slm, other.slm.sel(l=common_l, m=common_m)) |
141 | 144 |
|
142 | 145 | elif ( |
143 | | - "time" not in self._obj.coords |
| 146 | + "time" not in self._obj.dims |
144 | 147 | ): # if the previous test, other has time dimension |
145 | 148 | raise AssertionError( |
146 | 149 | "Cannot operate on a HarmoSet with time dimension to a Harmoset without it. " |
@@ -234,6 +237,59 @@ def to_grid(self, **kwargs) -> xr.DataArray: |
234 | 237 | """ |
235 | 238 | return sh_to_grid(self._obj, **kwargs) |
236 | 239 |
|
| 240 | + def to_gravity_disturbance(self, **kwargs) -> xr.DataArray: |
| 241 | + """ |
| 242 | + Transform Spherical Harmonics (SH) dataset into gravity disturbance spatial DataArray. |
| 243 | + For details on the function, see :func:`lenapy.utils.gravity.sh_to_gravity_disturbance` documentation. |
| 244 | +
|
| 245 | + Parameters |
| 246 | + ---------- |
| 247 | + **kwargs : |
| 248 | + Supplementary parameters used by the function sh_to_gravity_disturbance() for conversion |
| 249 | +
|
| 250 | + Returns |
| 251 | + ------- |
| 252 | + xr.DataArray |
| 253 | + The spatial grid gravity disturbance representation of the spherical harmonics dataset. |
| 254 | + """ |
| 255 | + return sh_to_gravity_disturbance(self._obj, **kwargs) |
| 256 | + |
| 257 | + def to_potential_partial_derivative_longitude(self, **kwargs) -> xr.DataArray: |
| 258 | + """ |
| 259 | + Transform Spherical Harmonics (SH) dataset into the partial derivative of the potential regarding the longitude |
| 260 | + spatial DataArray. |
| 261 | + For details on the function, see :func:`lenapy.utils.gravity.sh_to_potential_partial_derivative_longitude` |
| 262 | + documentation. |
| 263 | +
|
| 264 | + Parameters |
| 265 | + ---------- |
| 266 | + **kwargs : |
| 267 | + Supplementary parameters used by the function sh_to_potential_partial_derivative_longitude() for conversion |
| 268 | +
|
| 269 | + Returns |
| 270 | + ------- |
| 271 | + xr.DataArray |
| 272 | + The spatial grid partial derivative representation of the spherical harmonics dataset. |
| 273 | + """ |
| 274 | + return sh_to_potential_partial_derivative_longitude(self._obj, **kwargs) |
| 275 | + |
| 276 | + def to_deflection_of_vertical(self, **kwargs) -> xr.Dataset: |
| 277 | + """ |
| 278 | + Transform Spherical Harmonics (SH) dataset into deflection of the vertical spatial DataArray. |
| 279 | + For details on the function, see :func:`lenapy.utils.gravity.sh_to_deflection_of_vertical` documentation. |
| 280 | +
|
| 281 | + Parameters |
| 282 | + ---------- |
| 283 | + **kwargs : |
| 284 | + Supplementary parameters used by the function sh_to_deflection_of_vertical() for conversion |
| 285 | +
|
| 286 | + Returns |
| 287 | + ------- |
| 288 | + xr.Dataset |
| 289 | + The spatial grids deflection of vertical representation of the spherical harmonics dataset. |
| 290 | + """ |
| 291 | + return sh_to_deflection_of_vertical(self._obj, **kwargs) |
| 292 | + |
237 | 293 | def change_reference( |
238 | 294 | self, |
239 | 295 | new_radius: float, |
|
0 commit comments