bopen / xarray-sentinel

Xarray backend to Copernicus Sentinel-1 satellite data products
Apache License 2.0
219 stars 22 forks source link

Improve orbit vector definition #53

Closed alexamici closed 3 years ago

alexamici commented 3 years ago

ATM vectors coordinates are different variables the orbit dataset.

I argue that vectors will be more useful if distributed as a single variable with "x", "y" and "z" (or 0, 1, and 2) as a coordinate dimension:

<xarray.Dataset>
Dimensions:       (azimuth_time: 17, i: 3)
Coordinates:
  * azimuth_time  (azimuth_time) datetime64[ns] 2020-03-15T17:04:38.537823 .....
  * i                        (i) int64 0 1 2
Data variables:
    position             (azimuth_time, i) float64 5.659e+06 5.618e+06 ... 4.926e+06
    velocity             (azimuth_time, i) float64 -4.072e+03 -4.138e+03 ... -5.078e+03
Attributes:
    reference_system:  Earth Fixed
    Conventions:       CF-1.7
    title:             Orbit information used by the IPF during processing
    comment:           The dataset contains a sets of orbit state vectors tha...
    history:           created by xarray_sentinel-0.1.2.dev55+gb940721.d20210508

This way vectors can be passed around like xr.DataArray and operations like the dot products are trivial: (p1 * p2).sum("i")