geofunctions
Function definitions for operations on the WGS84 projection and transformations to other projections.
- geofunctions.bistatic_angle(rx_pos, tx_pos, tgt_pos)
calculates bistatic_angle [rad] given rx, tx and tgt positions
- geofunctions.burstvincentydistance(pnt, dist_km, brng)
! returns the destination [lat/lon] point at distance dist_km[km] and at bearing brng[deg] from point pnt[lat/lon]; default uses the geodesic distance; but also the great-circle distance can be used, see: https://geopy.readthedocs.io/en/stable/
- geofunctions.calculate_bistatic_doppler(rx, tgt, tx)
calculates bistatic Doppler in Hz for given Tx, Rx and Target input Tx: lat, lon, alt[masl], antenna height [magl] input Rx: lat, lon, alt[masl], antenna height [magl] input tgt: lat, lon, alt[masl] returns Doppler shift in [Hz]
The bistatic Doppler shift is computed from the rate of change (R_t + R_r) divided by the wavelength of tx signal
The returned bistatic Doppler [Hz] value can be negative, depending on the velocity vector of the target
- geofunctions.calculate_bistatic_doppler_cartesian(rx, tgt, tx)
calculates bistatic Doppler in Hz for given Tx, Rx and Target input Tx: lat, lon, alt[masl], antenna height [magl] input Rx: lat, lon, alt[masl], antenna height [magl] input tgt: lat, lon, alt[masl] returns Doppler shift in [Hz]
The bistatic Doppler shift is computed from the rate of change (R_t + R_r) divided by the wavelength of tx signal
The returned bistatic Doppler [Hz] value can be negative, depending on the velocity vector of the target
- geofunctions.calculate_initial_compass_bearing(pointA, pointB)
! calculates bearing between two points: https://gist.github.com/jeromer/2005586
- geofunctions.calculate_std_devs_for_bistatic_detection(rx_pos, tx_pos, tgt_pos, snr_db, tx_freq_hz, tx_bw_hz, t_obs_s)
calculates range and vel std deviations of bistatic range and velocity calculations input rx_pos: rx position input tx_pos: tx position input tgt_pos: target position input snr_db: SNR of detection input tx_frq_hz: Tx freq [Hz] tx_bw_hz: signal bandwidth [Hz] t_obs_s: coherent integration time [s]
returns: sigma_rho : standard deviation of bistatic range sigma_v: standard deviation of bistatic radial velocity
- geofunctions.compute_freespace_loss(freq, dist_meters)
! returns free space loss in dB given frequency and distance in meters (same computation as SPLAT)
- geofunctions.convert_cartesian_to_geodetic(x, y, z)
Function to convert Cartesian coordinates to Geodetic
- geofunctions.convert_geodetic_to_cartesian(lat, lon, alt)
convert from Geodetic coordinates to Cartesian coordinates
- geofunctions.create_range_by_nbr_points(min_pt, max_pt, nbr_pts)
creates a range of points by given number of points
- geofunctions.create_range_by_nbr_points_latlon(min_lat, max_lat, amt_pts_y, min_lon, max_lon, amt_pts_x)
creates a range of points by lat/lon resolution
- geofunctions.create_range_by_res(min_pt, max_pt, res)
creates a range of points, such that res is the resolution/spacing between the points. min_pt and max_pt are definitively included in the result, however if (max_pt-min_pt)%res != 0, the first entry of the result will be lower than min_pt, as the last entry will be larger than max_pt. Thus max_x and min_y need updating hereafter
- geofunctions.create_range_by_res_height(min_z, max_z, res_z)
creates a range of points by height resolution
- geofunctions.create_range_rcs_gridpoints(rcs_gridparams)
creates a grid given the parameters
- geofunctions.get_2d_distance_between_locs(lat1, lon1, lat2, lon2)
calculates the 2D distance between two lat/lon values
- Parameters:
lat1 (position 1)
lon1 (position 1)
lat2 (position 2)
lon2 (position 2)
- Return type:
haversine between to points
- geofunctions.get_2d_distance_between_locs_heights(lat1, lon1, h1, lat2, lon2, h2)
returns distance in kilometers between two lat lons and heights using the haversine formula geopy.distance does NOT consider altitude!! the solution below with haversine formula compared to geopy.distance without height are at 220km are identical upto a difference below 50m the solution here is not exactly correct, but good enough for our purposes for large geodesic distances (ie large distance on the ellipsoid surface) the difference is less than a few hundred meters assuming Earth’s mean radius 6,371 km, adding 10 km to that adds about 0.16% to the geometric distance at 10 km altitude, ie about 300m see e.g. http://cosinekitty.com/compass.html h1, h2: meters
- geofunctions.get_2d_distance_between_locs_heights_ecef(lat1, lon1, h1, lat2, lon2, h2)
returns distance in kilometers between two lat lons and heights using ecef cartesian transformation h1, h2: meters
- geofunctions.get_azimuth_between_locs(lat1, lon1, lat2, lon2)
returns azimuth (clockwise from north between point1 and point2 given in lat lon) in radians The shortest path between two points on the ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two end points. (The azimuth is the heading measured clockwise from north. azi2 is the “forward” azimuth, i.e., the heading that takes you beyond point 2 not back to point 1.)
- Parameters:
lat1 (source position)
lon1 (source position)
lat2 (destination position)
lon2 (destination position)
- Return type:
tmp : azimuth in degrees
References
- geofunctions.get_bistatic_range(tx_latlonalt, rx_latlonalt, tgt_latlonalt)
returns bistatic range [km], tgt_rx_range [km], tgt_tx_range [km], baseline_range [km]) for given Tx, Rx and Target input Tx: lat, lon, alt[masl] + antenna height [magl] input Rx: lat, lon, alt[masl] + antenna height [magl] input tgt: lat, lon, alt[masl] definition bistatic range [km] = distance(Tx -> Tgt -> Rx ) - distance(Rx->Tx)
- geofunctions.get_ch_from_deg(lat, lon)
! reads in lat/lon and returns CH1903 coordinates in y,x
- geofunctions.get_chf_from_deg(lat, lon)
! reads in lat/lon and returns CH1903 coordinates in y,x
- geofunctions.get_clear_sky_attenuation(transmitter_freq)
returns the clear sky atmospheric one-way attenuation in dB/km for Radar Windows, given the transmitter_freq in MHz
Clear Sky weather values from Barton book: ‘Modern Radar System Analysis’
- geofunctions.get_deg_from_ch(y, x)
returns lon, lat from Swissgrid coordinates
- geofunctions.get_dest_loc_from_dist_and_angle(theta, dist)
returns destination location (lat/lon) from distance and angle from global origin
- geofunctions.get_ecef_cartesian_from_lat_lon_height(lat_deg, lon_deg, h)
see standard conversion using pyproj function: convert_geodetic_to_cartesian Author: Sacha Schär WGS84 to ECEF cooordinates returns cartesian coordinates given lat, lon and height using ecef cartesian transformation h: height in meters
- geofunctions.get_elev_angle(tgt_z, antenna_z, dist_tgt_antenna)
calculates the elevation angle given a target height, antenna height and distance from target to antenna
- Parameters:
tgt_z (z position of target)
antenna_z (z position of antenna)
dist_tgt_antenna (distance between target and antenna on XY plane)
- Returns:
returned in radians
- Return type:
elev_angle
- geofunctions.get_latlon_box_for_midpoint(origin, max_distance, quadrant)
returns a lat/lon box end points given an origin and maximum distance
- geofunctions.get_terrain_height(splat, p_lat, p_lon)
returns terrain height in [masl] for a given lat lon
- geofunctions.monostatic_doppler(freq, rad_lat, rad_lon, rad_alt, tgt_lat, tgt_lon, tgt_alt, tgt_vx, tgt_vy, tgt_vz)
computes Doppler shift in Hz from target motion as seen at ground stationary radar freq given in MHz, alts given in masl. returns None if tgt V == 0. tgt_V is given as m/s along the lon/lat/z axis see Class Target definition
- geofunctions.read_pet_antenna_diags(_, h_filename, v_filename)
! will read antenna diagramms for H and V for PET or Richtstrahl from files and return them h_filename and v_filename are full filenames for the h and v gain files antenna diags are given for angles 0 to 360 for V and H in separate files in dB, assumed is max ERP at 0 degrees assumption: the file are given in angels -180 to 180, we need to convert it to 0..360 degrees
- geofunctions.tabulate(orig, x, y, f)
! Return a table of f(x, y).