PythonicDISORT 1.3__tar.gz → 1.4__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.3
3
+ Version: 1.4
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
@@ -81,10 +81,10 @@ These notebooks double up as examples of how to use PythonicDISORT. The tests wh
81
81
  * Python 3.8+
82
82
  * `numpy >= 1.8.0`
83
83
  * `scipy >= 1.8.0`
84
+ * (OPTIONAL) `autograd >= 1.5`
84
85
  * (OPTIONAL) `pytest >= 6.2.5` (Required to use the command `pytest`, see *PyTest and examples of how to use PythonicDISORT*)
85
86
 
86
87
  ## (OPTIONAL) Additional requirements to run the Jupyter Notebook
87
- * `autograd >= 1.5`
88
88
  * `jupyter > 1.0.0`
89
89
  * `notebook > 6.5.2`
90
90
  * `matplotlib >= 3.6.0`
@@ -127,3 +127,4 @@ Science and Technology Center (STC) (Award #2019625) under which this package wa
127
127
  12) T. Nakajima and M. Tanaka. 1988. *Algorithms for radiative intensity calculations in moderately thick atmospheres using a truncation approximation.* https://www.sciencedirect.com/science/article/pii/0022407388900313.
128
128
 
129
129
  13) Connour, Kyle and Wolff, Michael. 2020. *pyRT_DISORT: A pre-processing front-end to help make DISORT simulations easier in Python.* https://github.com/kconnour/pyRT_DISORT.
130
+
@@ -60,10 +60,10 @@ These notebooks double up as examples of how to use PythonicDISORT. The tests wh
60
60
  * Python 3.8+
61
61
  * `numpy >= 1.8.0`
62
62
  * `scipy >= 1.8.0`
63
+ * (OPTIONAL) `autograd >= 1.5`
63
64
  * (OPTIONAL) `pytest >= 6.2.5` (Required to use the command `pytest`, see *PyTest and examples of how to use PythonicDISORT*)
64
65
 
65
66
  ## (OPTIONAL) Additional requirements to run the Jupyter Notebook
66
- * `autograd >= 1.5`
67
67
  * `jupyter > 1.0.0`
68
68
  * `notebook > 6.5.2`
69
69
  * `matplotlib >= 3.6.0`
@@ -106,3 +106,4 @@ Science and Technology Center (STC) (Award #2019625) under which this package wa
106
106
  12) T. Nakajima and M. Tanaka. 1988. *Algorithms for radiative intensity calculations in moderately thick atmospheres using a truncation approximation.* https://www.sciencedirect.com/science/article/pii/0022407388900313.
107
107
 
108
108
  13) Connour, Kyle and Wolff, Michael. 2020. *pyRT_DISORT: A pre-processing front-end to help make DISORT simulations easier in Python.* https://github.com/kconnour/pyRT_DISORT.
109
+
@@ -8,7 +8,7 @@ dependencies = [
8
8
  "scipy>=1.8.0",
9
9
  ]
10
10
  name = "PythonicDISORT"
11
- version = "1.3"
11
+ version = "1.4"
12
12
  authors = [
13
13
  { name="Dion HO Jia Xu", email="dh3065@columbia.edu" },
14
14
  ]
@@ -451,40 +451,33 @@ def pydisort(
451
451
 
452
452
  neg_scaled_tau_div_mu0 = -scaled_tau / mu0
453
453
  if is_antiderivative_wrt_tau:
454
-
455
- scale_tau_l = scale_tau[None, l_uniq]
454
+
455
+ scale_tau_l = scale_tau[l_uniq]
456
456
  neg_scale_tau_l_div_mu0 = -scale_tau_l / mu0
457
- scale_tau_l_div_mu_arr_pos = scale_tau_l / mu_arr_pos[:, None]
458
-
457
+ scale_tau_l_div_mu_arr_pos = scale_tau_l[None, :] / mu_arr_pos[:, None]
458
+
459
459
  TMS_correction_pos = (
460
- np.exp(neg_scaled_tau_div_mu0)[None, :] / neg_scale_tau_l_div_mu0[l_inv]
461
- - np.exp(
462
- (scaled_tau - scaled_tau_arr_l)[None, :] / mu_arr_pos[:, None]
463
- - scaled_tau_arr_l[None, :] / mu0
464
- ) / scale_tau_l_div_mu_arr_pos[l_inv]
465
- )
460
+ np.exp(neg_scaled_tau_div_mu0) / neg_scale_tau_l_div_mu0[l_inv]
461
+ )[None, :] - np.exp(
462
+ (scaled_tau - scaled_tau_arr_l)[None, :] / mu_arr_pos[:, None]
463
+ - scaled_tau_arr_l[None, :] / mu0
464
+ ) / scale_tau_l_div_mu_arr_pos[:, l_inv]
466
465
  TMS_correction_neg = (
467
- np.exp(neg_scaled_tau_div_mu0)[None, :] / neg_scale_tau_l_div_mu0[l_inv]
468
- + np.exp(
469
- (scaled_tau_arr_lm1 - scaled_tau)[None, :] / mu_arr_pos[:, None]
470
- - scaled_tau_arr_lm1[None, :] / mu0
471
- ) / scale_tau_l_div_mu_arr_pos[l_inv]
472
- )
466
+ np.exp(neg_scaled_tau_div_mu0) / neg_scale_tau_l_div_mu0[l_inv]
467
+ )[None, :] + np.exp(
468
+ (scaled_tau_arr_lm1 - scaled_tau)[None, :] / mu_arr_pos[:, None]
469
+ - scaled_tau_arr_lm1[None, :] / mu0
470
+ ) / scale_tau_l_div_mu_arr_pos[:, l_inv]
473
471
  else:
474
- TMS_correction_pos = (
475
- np.exp(neg_scaled_tau_div_mu0)[None, :]
476
- - np.exp(
477
- (scaled_tau - scaled_tau_arr_l)[None, :] / mu_arr_pos[:, None]
478
- - scaled_tau_arr_l[None, :] / mu0
479
- )
472
+ TMS_correction_pos = np.exp(neg_scaled_tau_div_mu0)[None, :] - np.exp(
473
+ (scaled_tau - scaled_tau_arr_l)[None, :] / mu_arr_pos[:, None]
474
+ - scaled_tau_arr_l[None, :] / mu0
480
475
  )
481
- TMS_correction_neg = (
482
- np.exp(neg_scaled_tau_div_mu0)[None, :]
483
- - np.exp(
484
- (scaled_tau_arr_lm1 - scaled_tau)[None, :] / mu_arr_pos[:, None]
485
- - scaled_tau_arr_lm1[None, :] / mu0
486
- )
476
+ TMS_correction_neg = np.exp(neg_scaled_tau_div_mu0)[None, :] - np.exp(
477
+ (scaled_tau_arr_lm1 - scaled_tau)[None, :] / mu_arr_pos[:, None]
478
+ - scaled_tau_arr_lm1[None, :] / mu0
487
479
  )
480
+
488
481
 
489
482
  ## Contribution from other layers
490
483
  # --------------------------------------------------------------------------------------------------------------------------
@@ -525,13 +518,13 @@ def pydisort(
525
518
  # POS: pre-accumulate "contribution from below" sums Rpos[N, l, Nphi]
526
519
  # ====================================================================
527
520
  if any_pos:
528
- # fac_pos = 1 - exp(-scaled_thickness_arr*(1/mu + 1/mu0)) = -expm1(-thickness_pos)
529
521
  thickness_pos = scaled_thickness_arr[None, :] * (M_inv + mu0_inv)[:, None] # (N, NLayers); always > 0
530
- fac_pos = -np.expm1(-thickness_pos) # (N, NLayers)
522
+ # em1_pos = 1 - exp(-scaled_thickness_arr*(1/mu + 1/mu0)) = -expm1(-thickness_pos)
523
+ em1_pos = -np.expm1(-thickness_pos) # (N, NLayers)
531
524
  if is_antiderivative_wrt_tau:
532
- fac_pos = fac_pos * integration_factor
525
+ em1_pos = integration_factor * em1_pos
533
526
 
534
- layer_term_pos = fac_pos * exp_taufront_mu0_inv[None, :] # (N, NLayers)
527
+ layer_term_pos = em1_pos * exp_taufront_mu0_inv[None, :] # (N, NLayers)
535
528
 
536
529
  # Reverse-scan via cumsum:
537
530
  # Rpos[l] = (1/decay_prod[l+1]) * sum_{r=l+1..} (layer_term_pos[r] * decay_prod[r])
@@ -566,12 +559,12 @@ def pydisort(
566
559
  exp_x0 = decay * exp_taufront_mu0_inv[None, :] # (N, NLayers)
567
560
 
568
561
  # Let a = |thickness_neg| >= 0. Then expm1(-a) uses only non-positive inputs.
569
- em1 = np.expm1(-np.abs(thickness_neg)) # (N, NLayers)
562
+ em1_neg = np.expm1(-np.abs(thickness_neg)) # (N, NLayers)
570
563
 
571
- # thickness_neg>=0: exp_x1 * (1 - exp(-a)) = exp_x1 * (-expm1(-a)) = exp_x1 * (-em1)
572
- # thickness_neg<0 : exp_x0 * (exp(-a) - 1) = exp_x0 * expm1(-a) = exp_x0 * ( em1)
573
- layer_term_negthick = em1 * exp_x0 # (N, NLayers)
574
- layer_term_posthick = -em1 * exp_x1 # (N, NLayers)
564
+ # thickness_neg>=0: exp_x1 * (1 - exp(-a)) = exp_x1 * (-expm1(-a)) = exp_x1 * (-em1_neg)
565
+ # thickness_neg<0 : exp_x0 * (exp(-a) - 1) = exp_x0 * expm1(-a) = exp_x0 * ( em1_neg)
566
+ layer_term_negthick = em1_neg * exp_x0 # (N, NLayers)
567
+ layer_term_posthick = -em1_neg * exp_x1 # (N, NLayers)
575
568
  layer_term_neg = layer_term_posthick * mask + layer_term_negthick * (~mask) # (N, NLayers)
576
569
 
577
570
  if is_antiderivative_wrt_tau:
@@ -489,8 +489,8 @@ def generate_emissivity_from_BDRF(N, zeroth_BDRF_Fourier_mode):
489
489
 
490
490
  def cache_BDRF_Fourier_modes(N, BDRF_Fourier_modes, mu0=0):
491
491
  """If the same BDRF and number of streams will be used repeatedly,
492
- consider using this function to cache ``BDRF_Fourier_modes`` and instead input
493
- ``cached_BDRF_Fourier_modes`` into ``pydisort``. It is also possible
492
+ consider using this function to cache ``BDRF_Fourier_modes`` and pass
493
+ ``cached_BDRF_Fourier_modes`` to ``pydisort``. It is also possible
494
494
  to cache ``BDRF_Fourier_modes`` with respect to a fixed ``mu0``.
495
495
 
496
496
  Parameters
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PythonicDISORT
3
- Version: 1.3
3
+ Version: 1.4
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
@@ -81,10 +81,10 @@ These notebooks double up as examples of how to use PythonicDISORT. The tests wh
81
81
  * Python 3.8+
82
82
  * `numpy >= 1.8.0`
83
83
  * `scipy >= 1.8.0`
84
+ * (OPTIONAL) `autograd >= 1.5`
84
85
  * (OPTIONAL) `pytest >= 6.2.5` (Required to use the command `pytest`, see *PyTest and examples of how to use PythonicDISORT*)
85
86
 
86
87
  ## (OPTIONAL) Additional requirements to run the Jupyter Notebook
87
- * `autograd >= 1.5`
88
88
  * `jupyter > 1.0.0`
89
89
  * `notebook > 6.5.2`
90
90
  * `matplotlib >= 3.6.0`
@@ -127,3 +127,4 @@ Science and Technology Center (STC) (Award #2019625) under which this package wa
127
127
  12) T. Nakajima and M. Tanaka. 1988. *Algorithms for radiative intensity calculations in moderately thick atmospheres using a truncation approximation.* https://www.sciencedirect.com/science/article/pii/0022407388900313.
128
128
 
129
129
  13) Connour, Kyle and Wolff, Michael. 2020. *pyRT_DISORT: A pre-processing front-end to help make DISORT simulations easier in Python.* https://github.com/kconnour/pyRT_DISORT.
130
+
File without changes
File without changes