PythonicDISORT 0.1.1__py3-none-any.whl → 0.2.0__py3-none-any.whl
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.
- PythonicDISORT/_loop_and_assemble_results.py +41 -9
- PythonicDISORT/pydisort.py +19 -11
- {PythonicDISORT-0.1.1.dist-info → PythonicDISORT-0.2.0.dist-info}/METADATA +6 -5
- PythonicDISORT-0.2.0.dist-info/RECORD +9 -0
- PythonicDISORT-0.1.1.dist-info/RECORD +0 -9
- {PythonicDISORT-0.1.1.dist-info → PythonicDISORT-0.2.0.dist-info}/WHEEL +0 -0
- {PythonicDISORT-0.1.1.dist-info → PythonicDISORT-0.2.0.dist-info}/top_level.txt +0 -0
|
@@ -23,7 +23,8 @@ def _loop_and_assemble_results(
|
|
|
23
23
|
Nscoeffs,
|
|
24
24
|
scale_tau,
|
|
25
25
|
only_flux,
|
|
26
|
-
use_sparse_NLayers
|
|
26
|
+
use_sparse_NLayers,
|
|
27
|
+
n_jobs
|
|
27
28
|
):
|
|
28
29
|
"""This function is wrapped by the `pydisort` function.
|
|
29
30
|
It should be called through `pydisort` and never directly.
|
|
@@ -77,10 +78,35 @@ def _loop_and_assemble_results(
|
|
|
77
78
|
if I0 > 0:
|
|
78
79
|
B_collect = np.empty((NLoops, NLayers, NQuad))
|
|
79
80
|
B_collect[0, :, :] = B_collect_0
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
|
|
82
|
+
if n_jobs == 1:
|
|
83
|
+
for m in range(1, NLoops):
|
|
84
|
+
outputs = _one_Fourier_mode(
|
|
85
|
+
m,
|
|
86
|
+
scaled_omega_arr,
|
|
87
|
+
tau_arr,
|
|
88
|
+
scaled_tau_arr_with_0,
|
|
89
|
+
mu_arr_pos, mu_arr,
|
|
90
|
+
M_inv, W,
|
|
91
|
+
N, NQuad, NLeg,
|
|
92
|
+
NLayers, NBDRF,
|
|
93
|
+
weighted_scaled_Leg_coeffs,
|
|
94
|
+
weighted_Leg_coeffs_BDRF,
|
|
95
|
+
mu0, I0,
|
|
96
|
+
b_pos, b_neg,
|
|
97
|
+
scalar_b_pos, scalar_b_neg,
|
|
98
|
+
s_poly_coeffs,
|
|
99
|
+
Nscoeffs,
|
|
100
|
+
use_sparse_NLayers
|
|
101
|
+
)
|
|
102
|
+
if I0 > 0:
|
|
103
|
+
GC_collect[m, :, :, :], K_collect[m, :, :], B_collect[m, :, :] = outputs
|
|
104
|
+
else:
|
|
105
|
+
GC_collect[m, :, :, :], K_collect[m, :, :] = outputs
|
|
106
|
+
else:
|
|
107
|
+
from joblib import Parallel, delayed
|
|
108
|
+
|
|
109
|
+
_one_Fourier_mode_m = lambda m: _one_Fourier_mode(
|
|
84
110
|
m,
|
|
85
111
|
scaled_omega_arr,
|
|
86
112
|
tau_arr,
|
|
@@ -98,10 +124,16 @@ def _loop_and_assemble_results(
|
|
|
98
124
|
Nscoeffs,
|
|
99
125
|
use_sparse_NLayers
|
|
100
126
|
)
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
127
|
+
outputs = Parallel(n_jobs=n_jobs)(
|
|
128
|
+
delayed(_one_Fourier_mode_m)(m) for m in range(1, NLoops)
|
|
129
|
+
)
|
|
130
|
+
|
|
131
|
+
for m in range(1, NLoops):
|
|
132
|
+
outputs_m = outputs[m - 1]
|
|
133
|
+
GC_collect[m, :, :, :] = outputs_m[0]
|
|
134
|
+
K_collect[m, :, :] = outputs_m[1]
|
|
135
|
+
if I0 > 0:
|
|
136
|
+
B_collect[m, :, :] = outputs_m[2]
|
|
105
137
|
|
|
106
138
|
# --------------------------------------------------------------------------------------------------------------------------
|
|
107
139
|
|
PythonicDISORT/pydisort.py
CHANGED
|
@@ -24,7 +24,8 @@ def pydisort(
|
|
|
24
24
|
NT_cor=False,
|
|
25
25
|
Leg_coeffs_BDRF=np.array([]),
|
|
26
26
|
s_poly_coeffs=np.array([[]]),
|
|
27
|
-
use_sparse_NLayers=6
|
|
27
|
+
use_sparse_NLayers=6,
|
|
28
|
+
n_jobs=1
|
|
28
29
|
):
|
|
29
30
|
"""Solves the 1D RTE for the fluxes, and optionally intensity,
|
|
30
31
|
of a multi-layer atmosphere with the specified optical properties, boundary conditions
|
|
@@ -73,6 +74,11 @@ def pydisort(
|
|
|
73
74
|
Arrange coefficients from lowest order term to highest.
|
|
74
75
|
use_sparse_NLayers : optional, int
|
|
75
76
|
At or above how many atmospheric layers should SciPy's sparse matrix framework be used?
|
|
77
|
+
n_jobs: optional, int
|
|
78
|
+
Maximum number of concurrently running jobs during parallelization.
|
|
79
|
+
This is exactly the `n_jobs` argument in `joblib.Parallel`, see
|
|
80
|
+
https://joblib.readthedocs.io/en/stable/generated/joblib.Parallel.html
|
|
81
|
+
and https://joblib.readthedocs.io/en/stable/parallel.html.
|
|
76
82
|
|
|
77
83
|
Returns
|
|
78
84
|
-------
|
|
@@ -224,7 +230,8 @@ def pydisort(
|
|
|
224
230
|
Nscoeffs,
|
|
225
231
|
scale_tau,
|
|
226
232
|
False,
|
|
227
|
-
use_sparse_NLayers
|
|
233
|
+
use_sparse_NLayers,
|
|
234
|
+
n_jobs
|
|
228
235
|
)
|
|
229
236
|
|
|
230
237
|
# TMS correction
|
|
@@ -297,12 +304,12 @@ def pydisort(
|
|
|
297
304
|
|
|
298
305
|
def Contribution_from_layer(j):
|
|
299
306
|
contribution = np.zeros((NQuad, Ntau, Nphi))
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
scaled_tau_l_pos = scaled_tau[None,
|
|
303
|
-
scaled_tau_l_neg = scaled_tau[None,
|
|
304
|
-
if np.any(
|
|
305
|
-
contribution[:N,
|
|
307
|
+
pos_contribution_mask = l < j
|
|
308
|
+
neg_contribution_mask = l > j
|
|
309
|
+
scaled_tau_l_pos = scaled_tau[None, pos_contribution_mask]
|
|
310
|
+
scaled_tau_l_neg = scaled_tau[None, neg_contribution_mask]
|
|
311
|
+
if np.any(pos_contribution_mask):
|
|
312
|
+
contribution[:N, pos_contribution_mask, :] = (
|
|
306
313
|
mathscr_B_pos[:, [j], :]
|
|
307
314
|
* (
|
|
308
315
|
np.exp(
|
|
@@ -317,8 +324,8 @@ def pydisort(
|
|
|
317
324
|
)
|
|
318
325
|
)[:, :, None]
|
|
319
326
|
)
|
|
320
|
-
if np.any(
|
|
321
|
-
contribution[N:,
|
|
327
|
+
if np.any(neg_contribution_mask):
|
|
328
|
+
contribution[N:, neg_contribution_mask, :] = (
|
|
322
329
|
mathscr_B_neg[:, [j], :]
|
|
323
330
|
* (
|
|
324
331
|
np.exp(
|
|
@@ -433,5 +440,6 @@ def pydisort(
|
|
|
433
440
|
Nscoeffs,
|
|
434
441
|
scale_tau,
|
|
435
442
|
only_flux,
|
|
436
|
-
use_sparse_NLayers
|
|
443
|
+
use_sparse_NLayers,
|
|
444
|
+
n_jobs
|
|
437
445
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: PythonicDISORT
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
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/PythonicDISORT
|
|
@@ -11,11 +11,12 @@ Requires-Python: >=3.8
|
|
|
11
11
|
Description-Content-Type: text/markdown
|
|
12
12
|
Requires-Dist: numpy (>=1.17.3)
|
|
13
13
|
Requires-Dist: scipy (>=1.8.0)
|
|
14
|
+
Provides-Extra: joblib
|
|
15
|
+
Requires-Dist: joblib (>=1.0.0) ; extra == 'joblib'
|
|
14
16
|
Provides-Extra: notebook_dependencies
|
|
15
17
|
Requires-Dist: autograd (>=1.5) ; extra == 'notebook_dependencies'
|
|
16
18
|
Requires-Dist: jupyter (>1.0.0) ; extra == 'notebook_dependencies'
|
|
17
19
|
Requires-Dist: notebook (>6.5.2) ; extra == 'notebook_dependencies'
|
|
18
|
-
Requires-Dist: ipympl (>=0.8.8) ; extra == 'notebook_dependencies'
|
|
19
20
|
Provides-Extra: pytest
|
|
20
21
|
Requires-Dist: pytest (>=6.2.5) ; extra == 'pytest'
|
|
21
22
|
|
|
@@ -41,7 +42,7 @@ We highly recommend reading the non-optional parts of sections 1 and 2 before us
|
|
|
41
42
|
|
|
42
43
|
## PyTest
|
|
43
44
|
|
|
44
|
-
Separate from the
|
|
45
|
+
Separate from the verification tests in the Jupyter Notebook, we used PyTest to recreate most of the test problems from Stamnes et. al.'s `disotest.f90`.
|
|
45
46
|
With PyTest installed, execute the console command `pytest` in the `pydisotest` directory to run these tests.
|
|
46
47
|
|
|
47
48
|
# Installation
|
|
@@ -54,13 +55,13 @@ With PyTest installed, execute the console command `pytest` in the `pydisotest`
|
|
|
54
55
|
* Python 3.8+
|
|
55
56
|
* `numpy >= 1.17.3`
|
|
56
57
|
* `scipy >= 1.8.0`
|
|
57
|
-
* (OPTIONAL) `
|
|
58
|
+
* (OPTIONAL) `joblib >= 1.0.0` (Required for parallelization)
|
|
59
|
+
* (OPTIONAL) `pytest >= 6.2.5` (Required for non-Notebook tests)
|
|
58
60
|
|
|
59
61
|
## Additional requirements to run the Jupyter Notebook
|
|
60
62
|
* `autograd >= 1.5`
|
|
61
63
|
* `jupyter > 1.0.0`
|
|
62
64
|
* `notebook > 6.5.2`
|
|
63
|
-
* (OPTIONAL) `ipympl >= 0.8.8`
|
|
64
65
|
|
|
65
66
|
In addition, our F2PY-wrapped Stamnes' DISORT (in the `disort4.0.99_f2py` directory) must be set up to run the last section (section 6).
|
|
66
67
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
PythonicDISORT/__init__.py,sha256=V1obNzaFgqInxqYJ5h_r6JHbZRxx4VM5VgzCIS6EEzI,84
|
|
2
|
+
PythonicDISORT/_loop_and_assemble_results.py,sha256=qzgVrVULUhFVZx2wXo3lgzmJmICoQ4RG7UrAVqhl1TQ,13382
|
|
3
|
+
PythonicDISORT/_one_Fourier_mode.py,sha256=OWvrwL5T8I9Xc9bps1FZSCgn3RPV7PfdIHapdqqv5Rw,15022
|
|
4
|
+
PythonicDISORT/pydisort.py,sha256=x7bgPV5Fueoi1d1j2_ULGytTOg4oeG7pmCluCHuZJMw,20502
|
|
5
|
+
PythonicDISORT/subroutines.py,sha256=AyBZz24nuZaK89ShI1Z5-YmTUgNmNsp-JSV7VImngtE,10195
|
|
6
|
+
PythonicDISORT-0.2.0.dist-info/METADATA,sha256=zvYRkIt99k7lX1eLwIa1jl9UHGe2nA0tLEbTCNPrb0o,5844
|
|
7
|
+
PythonicDISORT-0.2.0.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
8
|
+
PythonicDISORT-0.2.0.dist-info/top_level.txt,sha256=aX6kCeI1E7naZz3xfw4_mIbWh5KBh9dmF3FIvgP5m3Y,15
|
|
9
|
+
PythonicDISORT-0.2.0.dist-info/RECORD,,
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
PythonicDISORT/__init__.py,sha256=V1obNzaFgqInxqYJ5h_r6JHbZRxx4VM5VgzCIS6EEzI,84
|
|
2
|
-
PythonicDISORT/_loop_and_assemble_results.py,sha256=nmTyxSmoraSED8SnWuczegr2rY9iNIZMiiGUael2bWQ,12306
|
|
3
|
-
PythonicDISORT/_one_Fourier_mode.py,sha256=OWvrwL5T8I9Xc9bps1FZSCgn3RPV7PfdIHapdqqv5Rw,15022
|
|
4
|
-
PythonicDISORT/pydisort.py,sha256=9J2GkRs7YoRt3m9i9CXUvDCq7zgx0NuMcHZfBmslvkU,20127
|
|
5
|
-
PythonicDISORT/subroutines.py,sha256=AyBZz24nuZaK89ShI1Z5-YmTUgNmNsp-JSV7VImngtE,10195
|
|
6
|
-
PythonicDISORT-0.1.1.dist-info/METADATA,sha256=WEF4IDFTkdb2lwI6beGPWOY5m6G20e1wZ_kV0rMpuPo,5756
|
|
7
|
-
PythonicDISORT-0.1.1.dist-info/WHEEL,sha256=pkctZYzUS4AYVn6dJ-7367OJZivF2e8RA9b_ZBjif18,92
|
|
8
|
-
PythonicDISORT-0.1.1.dist-info/top_level.txt,sha256=aX6kCeI1E7naZz3xfw4_mIbWh5KBh9dmF3FIvgP5m3Y,15
|
|
9
|
-
PythonicDISORT-0.1.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|