Passed
Push — master ( 861427...2a29b5 )
by Stefan
01:38
created

eppaurora.recombination.alpha_ssusi()   A

Complexity

Conditions 2

Size

Total Lines 34
Code Lines 7

Duplication

Lines 34
Ratio 100 %

Importance

Changes 0
Metric Value
eloc 7
dl 34
loc 34
rs 10
c 0
b 0
f 0
cc 2
nop 5
1
# coding: utf-8
2
# Copyright (c) 2020 Stefan Bender
3
#
4
# This file is part of pyeppaurora.
5
# pyeppaurora is free software: you can redistribute it or modify
6
# it under the terms of the GNU General Public License as published
7
# by the Free Software Foundation, version 2.
8
# See accompanying LICENSE file or http://www.gnu.org/licenses/gpl-2.0.html.
9
"""Atmospheric recombination rate parametrizations
10
"""
11
12
import numpy as np
13
14
15
def alpha_vickrey1982(h):
16
	""" Vickrey et al. 1982 """
17
	return 2.5e-6 * np.exp(-h / 51.2)
18
19
20
def alpha_gledhill1986_aurora(h):
21
	""" Gledhill 1986, Aurora parameterization"""
22
	return 4.3e-6 * np.exp(-2.42e-2 * h) + 8.16e12 * np.exp(-0.524 * h)
23
24
25
def alpha_gledhill1986_day(h):
26
	""" Gledhill 1986, day-time parameterization"""
27
	return 0.501 * np.exp(-0.165 * h)
28
29
30
def alpha_gledhill1986_night(h):
31
	""" Gledhill 1986, night-time parameterization"""
32
	return 652 * np.exp(-0.234 * h)
33
34
35 View Code Duplication
def alpha_ssusi(z, alpha0=4.2e-7, scaleh=28.9, z0=108., z1=None):
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
36
	"""
37
	Implements section 2.6.2.15 in [2]_.
38
39
	Parameters
40
	----------
41
	z: float, array_like
42
		Profile altitude [km].
43
	alpha0: float, optional
44
		Predetermined peak effective recombination coefficient.
45
		Default: 4.2e-7
46
	scaleh: float, optional
47
		Predetermined scale height [km] of the effective recombination coefficient.
48
		Default: 28.9.
49
	z0: float, optional
50
		Predetermined altitude [km] of the peak effective recombination coefficient.
51
		Default: 108.
52
	z1: float, optional
53
		Use :func:`alpha_vickrey1982()` above z1 [km].
54
		Default: None
55
56
	References
57
	----------
58
	.. [1] https://ssusi.jhuapl.edu/data_algorithms
59
	.. [2] https://ssusi.jhuapl.edu/docs/algorithms/Aurora_LID_c_Version_2.0.pdf
60
	.. [3] https://ssusi.jhuapl.edu/docs/algorithms/SSUSI_DataProductAlgorithms_V1_13.doc
61
	"""
62
	alpha = np.zeros_like(z)
63
	alpha[z < z0] = alpha0
64
	alpha[z >= z0] = alpha0 * np.exp(-(z[z >= z0] - z0) / scaleh)
65
	if z1 is not None:
66
		# use Vickrey et al. above z1
67
		alpha[z >= z1] = 2.5e-6 * np.exp(-z[z >= z1] / 51.2)
68
	return alpha
69