Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 12 additions & 17 deletions MCEq/geometry/density_profiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -1034,8 +1034,9 @@ def __init__(self, location, season):
# Allow for upgoing zenith angles
self.max_theta = 180.0

def latitude(self, det_zenith_deg):
"""Returns the geographic latitude of the shower impact point.
def depth_correction(self, det_zenith_deg):
"""Returns the geographic latitude (plus 90 deg.) of the
shower impact point.

Assumes a spherical earth. The detector is 1948m under the
surface.
Expand All @@ -1049,7 +1050,7 @@ def latitude(self, det_zenith_deg):
float: latitude of the impact point in degrees
"""
r = self.geom.r_E
d = 1948 # m
d = 1948 * 1e2 # cm (same as r_E)

theta_rad = det_zenith_deg / 180.0 * np.pi

Expand All @@ -1058,31 +1059,25 @@ def latitude(self, det_zenith_deg):
) * np.cos(theta_rad)

return (
-90.0
+ np.arctan2(x * np.sin(theta_rad), r - d + x * np.cos(theta_rad))
np.arctan2(x * np.sin(theta_rad), r - d + x * np.cos(theta_rad))
/ np.pi
* 180.0
)

def set_theta(self, theta_deg):

self._msis.set_location_coord(longitude=0.0, latitude=self.latitude(theta_deg))
alpha_deg = self.depth_correction(theta_deg)
theta_deg = theta_deg-alpha_deg

self._msis.set_location_coord(longitude=0.0, latitude=alpha_deg-90.0)
info(
1,
"latitude = {0:5.2f} for zenith angle = {1:5.2f}".format(
self.latitude(theta_deg), theta_deg
alpha_deg-90.0, theta_deg
),
)
downgoing_theta_deg = theta_deg
if theta_deg > 90.0:
downgoing_theta_deg = 180.0 - theta_deg
info(
1,
"theta = {0:5.2f} below horizon. using theta = {1:5.2f}".format(
theta_deg, downgoing_theta_deg
),
)
MSIS00Atmosphere.set_theta(self, downgoing_theta_deg)

MSIS00Atmosphere.set_theta(self, theta_deg)

self.theta_deg = theta_deg

Expand Down