Commit 0e592828 authored by Fabian Kovac's avatar Fabian Kovac
Browse files

[i] 1/tan faster than cos/sin

parent 91636621
......@@ -189,10 +189,10 @@ def utm_to_lambert(lon: np.array, lat: np.array) -> tuple:
# lambert conformal conic projection:
# --> see https://mathworld.wolfram.com/LambertConformalConicProjection.html
n = np.log(np.cos(lat1) * (1 / np.cos(lat2))) / np.log(np.tan(np.pi/4 + lat2/2) * (np.cos(np.pi/4 + lat1/2) / np.sin(np.pi/4 + lat1/2)))
n = np.log(np.cos(lat1) * (1 / np.cos(lat2))) / np.log(np.tan(np.pi/4 + lat2/2) * (1 / np.tan(np.pi/4 + lat1/2)))
F = (np.cos(lat1) * np.tan(np.pi/4 + lat1/2)**n) / n
p = R * F * (np.cos(np.pi/4 + lat/2) / np.sin(np.pi/4 + lat/2))**n
p0 = R * F * (np.cos(np.pi/4 + lat0/2) / np.sin(np.pi/4 + lat0/2))**n
p = R * F * (1 / np.tan(np.pi/4 + lat/2))**n
p0 = R * F * (1 / np.tan(np.pi/4 + lat0/2))**n
# calculate lambert conic conformal x and y
x = p * np.sin(n * (lon - lon0)) + x0
......@@ -386,6 +386,11 @@ def prep() -> None:
_log('Converted BEGINTIME to UTC')
# only use transmissions with begintime matching INCA date
date_inca = np.datetime64(f'{str(dir_inca.stem)[0:4]}-{str(dir_inca.stem)[-4:-2]}-{str(dir_inca.stem)[-2:]}')
df_link = df_link[df_link['BEGINTIME'].dt.date == date_inca]
_log('Filtered transmissions to match BEGINTIME with INCA date')
# copy REMOTERXLEVEL to PMIN and PMAX (for aggregation in 15min window conversion)
df_link['PMIN'] = df_link['REMOTERXLEVEL']
df_link['PMAX'] = df_link['REMOTERXLEVEL']
......@@ -457,7 +462,7 @@ def prep() -> None:
# load inca data
inca_data = load_inca_data(dir_inca)
_log(f'Loaded INCA data from {str(dir_inca).split("/")[-1]}')
_log(f'Loaded INCA data from {str(dir_inca).split("/")[-1]} with shape {inca_data.shape}')
# set INCA RR data based on datetime and coordinates
df_link['RRStart'] = get_inca_data(inca_data, df_link['DateTime'], df_link['XStart'], df_link['YStart'])
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment