PythonicDISORT 1.0.1__tar.gz → 1.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PythonicDISORT
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Discrete Ordinates Solver for the (1D) Radiative Transfer Equation in a single or multi-layer atmosphere.
5
5
  Author-email: Dion HO Jia Xu <dh3065@columbia.edu>
6
6
  Project-URL: Homepage, https://github.com/LDEO-CREW/Pythonic-DISORT
@@ -8,7 +8,7 @@ dependencies = [
8
8
  "scipy>=1.8.0",
9
9
  ]
10
10
  name = "PythonicDISORT"
11
- version = "1.0.1"
11
+ version = "1.0.3"
12
12
  authors = [
13
13
  { name="Dion HO Jia Xu", email="dh3065@columbia.edu" },
14
14
  ]
@@ -98,13 +98,19 @@ def _solve_for_coeffs(
98
98
  # Just for this part, refer to section 3.4.2 of the Comprehensive Documentation
99
99
  # --------------------------------------------------------------------------------------------------------------------------
100
100
  if there_is_BDRF_mode:
101
- mathscr_D_neg = (1 + m_equals_0 * 1) * BDRF_Fourier_modes[m](mu_arr_pos, mu_arr_pos)
102
- R = mathscr_D_neg * mu_arr_pos_times_W[None, :]
103
-
104
- if there_is_beam_source:
105
- mathscr_X_pos = (mu0 * I0 / pi) * BDRF_Fourier_modes[m](
106
- mu_arr_pos, np.array([mu0])
107
- )[:, 0]
101
+ BDRF_Fourier_modes_m = BDRF_Fourier_modes[m]
102
+ if np.isscalar(BDRF_Fourier_modes_m):
103
+ mathscr_D_neg = (1 + m_equals_0 * 1) * BDRF_Fourier_modes_m
104
+ R = mathscr_D_neg * mu_arr_pos_times_W[None, :]
105
+ if there_is_beam_source:
106
+ mathscr_X_pos = (mu0 * I0 / pi) * BDRF_Fourier_modes_m
107
+ else:
108
+ mathscr_D_neg = (1 + m_equals_0 * 1) * BDRF_Fourier_modes_m(mu_arr_pos, mu_arr_pos)
109
+ R = mathscr_D_neg * mu_arr_pos_times_W[None, :]
110
+ if there_is_beam_source:
111
+ mathscr_X_pos = (mu0 * I0 / pi) * BDRF_Fourier_modes_m(
112
+ mu_arr_pos, np.array([mu0])
113
+ )[:, 0]
108
114
  # --------------------------------------------------------------------------------------------------------------------------
109
115
 
110
116
  # Assemble RHS
@@ -76,8 +76,8 @@ def pydisort(
76
76
  NT_cor : optional, bool
77
77
  Perform Nakajima-Tanaka intensity corrections?
78
78
  BDRF_Fourier_modes : optional, list of functions
79
- BDRF Fourier modes, each a function with arguments ``mu, -mu_p`` of type array
80
- and which output has the same dimensions as the outer product of the two arrays.
79
+ BDRF Fourier modes, each a scalar, or a function with arguments ``mu, -mu_p`` of type array
80
+ which output has the same dimensions as the outer product of the two arrays.
81
81
  s_poly_coeffs : optional, array
82
82
  Polynomial coefficients of isotropic internal sources.
83
83
  Each row pertains to an atmospheric layer (from top to bottom).
@@ -458,29 +458,41 @@ def cache_BDRF_Fourier_modes(N, mu0, BDRF_Fourier_modes):
458
458
  mu0 : float
459
459
  Cosine of polar angle of the incident beam.
460
460
  BDRF_Fourier_modes : list of functions
461
- BDRF Fourier modes, each a function with arguments ``mu, -mu_p`` of type array
462
- and which output has the same dimensions as the outer product of the two arrays.
461
+ BDRF Fourier modes, each a scalar, or a function with arguments ``mu, -mu_p`` of type array
462
+ which output has the same dimensions as the outer product of the two arrays.
463
463
 
464
464
  Returns
465
465
  -------
466
466
  cached_BDRF_Fourier_modes : list of functions
467
467
  Cached BDRF Fourier modes, each a function with arguments ``mu, -mu_p`` of type array
468
- and which output has the same dimensions as the outer product of the two arrays.
468
+ and which output is a scalar (if the Fourier mode was a scalar)
469
+ or has the same dimensions as the outer product of the two arrays.
469
470
  """
470
471
  NBDRF = len(BDRF_Fourier_modes)
471
472
  mu_arr_pos = Gauss_Legendre_quad(N)[0]
472
473
 
473
474
  BDRF_Fourier_modes_evaluated = [
474
- BDRF_Fourier_modes[m](mu_arr_pos, np.append(mu_arr_pos, mu0)) for m in range(NBDRF)
475
+ (
476
+ None
477
+ if np.isscalar(BDRF_Fourier_modes[m])
478
+ else BDRF_Fourier_modes[m](mu_arr_pos, np.append(mu_arr_pos, mu0))
479
+ )
480
+ for m in range(NBDRF)
475
481
  ]
482
+
476
483
  cached_BDRF_Fourier_modes = [
477
484
  (
478
- lambda mu, neg_mup, m=m: BDRF_Fourier_modes_evaluated[m][:, [-1]]
479
- if len(neg_mup) == 1
480
- else BDRF_Fourier_modes_evaluated[m][:, :-1]
485
+ lambda mu, neg_mup, m=m: BDRF_Fourier_modes[m]
486
+ if np.isscalar(BDRF_Fourier_modes[m])
487
+ else (
488
+ BDRF_Fourier_modes_evaluated[m][:, [-1]]
489
+ if len(neg_mup) == 1
490
+ else BDRF_Fourier_modes_evaluated[m][:, :-1]
491
+ )
481
492
  )
482
493
  for m in range(NBDRF)
483
494
  ]
495
+
484
496
  return cached_BDRF_Fourier_modes
485
497
 
486
498
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PythonicDISORT
3
- Version: 1.0.1
3
+ Version: 1.0.3
4
4
  Summary: Discrete Ordinates Solver for the (1D) Radiative Transfer Equation in a single or multi-layer atmosphere.
5
5
  Author-email: Dion HO Jia Xu <dh3065@columbia.edu>
6
6
  Project-URL: Homepage, https://github.com/LDEO-CREW/Pythonic-DISORT
File without changes
File without changes