Skip to content

Commit

Permalink
Add function los_projection()
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexeyPechnikov committed Aug 7, 2023
1 parent e35eb56 commit d203869
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions pygmtsar/pygmtsar/SBAS_incidence.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,30 @@

class SBAS_incidence(SBAS_geocode):

def los_projection(self, data, lon=None, lat=None):
"""
Calculate LOS projection for vector defined by its dx, dy, dz components
Note: the function is not optimized for delayed execution.
Examples
-------
Calculate tidal LOS projection in millimeters for vector (dx, dy, dz) defined in meters
coords = sbas.solid_tide(sbas.df.index, coords=[lon, lat])[:,-3:]
1000*sbas.los_projection(coords.T, lon, lat)
"""
sat_look = self.get_sat_look()

if lat is not None and lon is not None:
sat_look = sat_look.sel(lat=lat, lon=lon, method='nearest')
else:
print ('NOTE: estimation using central point satellite look vector')
sat_look = sat_look.isel(lat=sat_look.lat.size//2, lon=sat_look.lon.size//2)

dx, dy, dz = data
return dx * sat_look.look_E.values + dy * sat_look.look_N.values + dz * sat_look.look_U.values


def get_sat_look(self, chunksize=None):
"""
Return satellite look vectors in geographic coordinates as Xarray Dataset.
Expand Down

0 comments on commit d203869

Please sign in to comment.