watex.utils.get_azimuth#

watex.utils.get_azimuth(xlon, ylat, *, data=None, utm_zone=None, projection='ll', isdeg=True, mode='soft', extrapolate=Ellipsis, view=Ellipsis)[source]#

Compute azimuth from coordinate locations ( latitude, longitude).

If easting and northing are given rather than longitude and latitude, the projection should explicitely set to UTM to perform the ideal conversion. However if mode is set to soft (default), the type of projection is automatically detected . Note that when UTM coordinates are provided, xlon and ylat fit easting and northing respectively.

Parameters
  • xlon (Arraylike 1d or str, str) – ArrayLike of easting/longitude and arraylike of nothing/latitude. They should be one dimensional. In principle if data is supplied, they must be series. If xlon and ylat are given as string values, the data must be supplied. xlon and ylat names must be included in the dataframe otherwise an error raises.

  • ylat (Arraylike 1d or str, str) – ArrayLike of easting/longitude and arraylike of nothing/latitude. They should be one dimensional. In principle if data is supplied, they must be series. If xlon and ylat are given as string values, the data must be supplied. xlon and ylat names must be included in the dataframe otherwise an error raises.

  • data (pd.DataFrame,) – Data containing x and y names. Need to be supplied when x and y are given as string names.

  • utm_zone (Optional, string) – zone number and ‘S’ or ‘N’ e.g. ‘55S’. Default to the centre point of coordinates points in the survey area. It should be a string (##N or ##S) in the form of number and North or South hemisphere, 10S or 03N

  • projection (str, ['utm'|'ll']) – The coordinate system in which the data points for the profile is collected. when mode=’soft’, the auto-detection will be triggered and find the suitable coordinate system. However, it is recommended to explicitly provide projection when data is in UTM coordinates. Note that if x and y are composed of value greater than 180 degrees for longitude and 90 degrees for latitude, and method is still in the soft` mode, it should be considered as  longitude-latitude ``UTM coordinates system.

  • isdeg (bool, default=True) – By default xlon and xlat are in degree coordinates. If both arguments are given in radians, set to False instead.

  • mode (str , ['soft'|'strict']) – strict mode does not convert any coordinates system to other at least it is explicitly set to projection whereas the soft does.

  • extrapolate (bool, default=False) – In principle, the azimuth is compute between two points. Thus, the number of values computed for \(N\) stations should be \(N-1\). To fit values to match the number of size of the array, extrapolate should be True. In that case, the first station holds a <<fake>> azimuth as the closer value computed from interpolation of all azimuths.

  • view (bool, default=False,) – Quick view of the azimuth. It is usefull especially when extrapolate is set to True.

Returns

azim – Azimuth computed from locations.

Return type

ArrayLike

Examples

>>> import watex as wx
>>> from watex.utils.exmath import get_azimuth
>>> # generate a data from ERP
>>> data = wx.make_erp (n_stations =7 ).frame
>>> get_azimuth ( data.longitude, data.latitude)
array([54.575, 54.575, 54.575, 54.575, 54.575, 54.575])
>>> get_azimuth ( data.longitude, data.latitude, view =True, extrapolate=True)
array([54.57500007, 54.575     , 54.575     , 54.575     , 54.575     ,
       54.575     , 54.575     ])