PythonicDISORT 0.9.2__py3-none-any.whl → 0.9.4__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.
@@ -370,14 +370,14 @@ def _assemble_intensity_and_fluxes(
370
370
  + (B_collect_0.T / (-scale_tau / mu0)[None, :])[:, l]
371
371
  * np.exp(-scaled_tau / mu0)[None, :]
372
372
  )
373
- if is_antiderivative_wrt_tau and not there_is_beam_source:
373
+ elif is_antiderivative_wrt_tau and not there_is_beam_source:
374
374
  u0 = np.einsum(
375
375
  "tij, tj -> it",
376
376
  GC_collect_0[l, :, :],
377
377
  np.exp(exponent) / (scale_tau[:, None] * K_collect_0)[l, :],
378
378
  optimize=True,
379
379
  )
380
- if not is_antiderivative_wrt_tau and there_is_beam_source:
380
+ elif not is_antiderivative_wrt_tau and there_is_beam_source:
381
381
  u0 = np.einsum(
382
382
  "tij, tj -> it", GC_collect_0[l, :, :], np.exp(exponent), optimize=True
383
383
  ) + B_collect_0.T[:, l] * np.exp(-scaled_tau / mu0)[None, :]
@@ -589,6 +589,6 @@ def _assemble_intensity_and_fluxes(
589
589
  # --------------------------------------------------------------------------------------------------------------------------
590
590
 
591
591
  if only_flux:
592
- return flux_up, flux_down, u0, G_collect_0, K_collect_0 # TODO: Remove the temporary G_collect_0, K_collect_0
592
+ return flux_up, flux_down, u0, GC_collect_0, K_collect_0
593
593
  else:
594
594
  return flux_up, flux_down, u0, u
@@ -23,8 +23,8 @@ def pydisort(
23
23
  NT_cor=False,
24
24
  BDRF_Fourier_modes=[],
25
25
  s_poly_coeffs=np.array([[]]),
26
- use_banded_solver_NLayers=13,
27
- autograd_compatible = False,
26
+ use_banded_solver_NLayers=10,
27
+ autograd_compatible=False,
28
28
  ):
29
29
  """Solves the 1D RTE for the fluxes, and optionally intensity,
30
30
  of a multi-layer atmosphere with the specified optical properties, boundary conditions
@@ -299,14 +299,15 @@ def interpolate(u):
299
299
 
300
300
  Parameters
301
301
  ----------
302
- u : function
302
+ u or u0 : function
303
303
  Non-interpolated intensity function as given by ``pydisort``.
304
304
 
305
305
  Returns
306
306
  -------
307
307
  u_interpol : function
308
- Intensity function with arguments ``(mu, tau, phi)`` each of type array or float.
309
- Returns an ndarray with axes corresponding to variation with ``mu, tau, phi`` respectively.
308
+ Intensity function with arguments ``(mu, tau, phi)`` (for ``u``)
309
+ or ``(mu, tau)`` (for ``u0``) each of type array or float.
310
+ Returns an ndarray with axes corresponding to variation with each argument in the same order.
310
311
  Pass ``is_antiderivative_wrt_tau = True`` (defaults to ``False``)
311
312
  to switch to an antiderivative of the function with respect to ``tau``.
312
313
  Pass ``return_Fourier_error = True`` (defaults to ``False``) to return the
@@ -319,38 +320,69 @@ def interpolate(u):
319
320
 
320
321
  u_pos_interpol = sc.interpolate.BarycentricInterpolator(mu_arr_pos)
321
322
  u_neg_interpol = sc.interpolate.BarycentricInterpolator(-mu_arr_pos)
322
-
323
- def u_interpol(mu, tau, phi, is_antiderivative_wrt_tau=False, return_Fourier_error=False, return_tau_arr=False):
324
- if not np.all(np.abs(mu) <= 1):
325
- raise ValueError("mu values must be between -1 and 1.")
326
-
327
- mu = np.atleast_1d(mu)
328
-
329
- if return_Fourier_error or return_tau_arr:
330
- u_outputs = u(tau, phi, is_antiderivative_wrt_tau, return_Fourier_error, return_tau_arr)
331
- u_cache = u_outputs[0]
332
- else:
333
- u_cache = u(tau, phi, is_antiderivative_wrt_tau)
334
-
335
- results = np.empty((len(mu),) + np.shape(u_cache)[1:])
336
- mask_pos = mu > 0
337
- mask_else = ~mask_pos
338
-
339
- if np.any(mask_pos):
340
- u_pos_interpol.set_yi(u_cache[:N])
341
- results[mask_pos] = u_pos_interpol(mu[mask_pos])
342
- if np.any(mask_else):
343
- u_neg_interpol.set_yi(u_cache[N:])
344
- results[mask_else] = u_neg_interpol(mu[mask_else])
345
-
346
- if return_Fourier_error or return_tau_arr:
347
- return (np.squeeze(results)[()],) + u_outputs[1:]
348
- else:
349
- return np.squeeze(results)[()]
350
-
323
+
324
+ if u.__code__.co_argcount == 5: # Function is u instead of u0
325
+ def u_interpol(mu, tau, phi, is_antiderivative_wrt_tau=False, return_Fourier_error=False, return_tau_arr=False):
326
+ if not np.all(np.abs(mu) <= 1):
327
+ raise ValueError("mu values must be between -1 and 1.")
328
+
329
+ mu = np.atleast_1d(mu)
330
+
331
+ if return_Fourier_error or return_tau_arr:
332
+ u_outputs = u(tau, phi, is_antiderivative_wrt_tau, return_Fourier_error, return_tau_arr)
333
+ u_cache = u_outputs[0]
334
+ else:
335
+ u_cache = u(tau, phi, is_antiderivative_wrt_tau)
336
+
337
+ results = np.empty((len(mu),) + np.shape(u_cache)[1:])
338
+ mask_pos = mu > 0
339
+ mask_else = ~mask_pos
340
+
341
+ if np.any(mask_pos):
342
+ u_pos_interpol.set_yi(u_cache[:N])
343
+ results[mask_pos] = u_pos_interpol(mu[mask_pos])
344
+ if np.any(mask_else):
345
+ u_neg_interpol.set_yi(u_cache[N:])
346
+ results[mask_else] = u_neg_interpol(mu[mask_else])
347
+
348
+ if return_Fourier_error or return_tau_arr:
349
+ return (np.squeeze(results)[()],) + u_outputs[1:]
350
+ else:
351
+ return np.squeeze(results)[()]
352
+
353
+ elif u.__code__.co_argcount == 4: # Function is u0 instead of u
354
+ def u_interpol(mu, tau, is_antiderivative_wrt_tau=False, return_Fourier_error=False, return_tau_arr=False):
355
+ if not np.all(np.abs(mu) <= 1):
356
+ raise ValueError("mu values must be between -1 and 1.")
357
+
358
+ mu = np.atleast_1d(mu)
359
+
360
+ if return_Fourier_error or return_tau_arr:
361
+ u_outputs = u(tau, is_antiderivative_wrt_tau, return_Fourier_error, return_tau_arr)
362
+ u_cache = u_outputs[0]
363
+ else:
364
+ u_cache = u(tau, is_antiderivative_wrt_tau)
365
+
366
+ results = np.empty((len(mu),) + np.shape(u_cache)[1:])
367
+ mask_pos = mu > 0
368
+ mask_else = ~mask_pos
369
+
370
+ if np.any(mask_pos):
371
+ u_pos_interpol.set_yi(u_cache[:N])
372
+ results[mask_pos] = u_pos_interpol(mu[mask_pos])
373
+ if np.any(mask_else):
374
+ u_neg_interpol.set_yi(u_cache[N:])
375
+ results[mask_else] = u_neg_interpol(mu[mask_else])
376
+
377
+ if return_Fourier_error or return_tau_arr:
378
+ return (np.squeeze(results)[()],) + u_outputs[1:]
379
+ else:
380
+ return np.squeeze(results)[()]
381
+ else:
382
+ raise ValueError("This subroutine can only interpolate u or u0")
383
+
351
384
  return u_interpol
352
385
 
353
-
354
386
 
355
387
  def to_diag_ordered_form(A, sym_offset):
356
388
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: PythonicDISORT
3
- Version: 0.9.2
3
+ Version: 0.9.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
@@ -28,9 +28,9 @@ On the other hand, PythonicDISORT should be easier to install, use, and modify t
28
28
 
29
29
  PythonicDISORT is based on Stamnes' FORTRAN DISORT (see References, in particular [2, 3, 8]) and has its main features: multi-layer solver,
30
30
  delta-M scaling, Nakajima-Tanaka (NT) corrections, only flux option, direct beam source, isotropic internal source (blackbody emission),
31
- Dirichlet boundary conditions (diffuse flux boundary sources), Bi-Directional Reflectance Function (BDRF) for surface reflection,
32
- interpolation with respect to polar angle and more.
33
- In addition, we added a subroutine to calculate actinic fluxes to satisfy a user request, and integration with respect to tau was also added.
31
+ Dirichlet boundary conditions (diffuse flux boundary sources), Bi-Directional Reflectance Function (BDRF) for surface reflection,
32
+ and interpolation with respect to polar angle.
33
+ In addition, we added a subroutine to compute actinic fluxes to satisfy a user request, and integration with respect to optical depth was also added.
34
34
  Further feature requests as well as feedback are welcome.
35
35
 
36
36
  You may contact me, Dion, through dh3065@columbia.edu.
@@ -0,0 +1,11 @@
1
+ PythonicDISORT/__init__.py,sha256=V1obNzaFgqInxqYJ5h_r6JHbZRxx4VM5VgzCIS6EEzI,84
2
+ PythonicDISORT/_assemble_intensity_and_fluxes.py,sha256=AVDjKtUXEzKadxp1stP3ZrZFxq6W6-qA0L5lahBqpbM,29165
3
+ PythonicDISORT/_solve_for_coeffs.py,sha256=8xnjR6fenaTiPXXzxvtXmETFZRnwOnGkHIuuOFpz7Lc,15402
4
+ PythonicDISORT/_solve_for_gen_and_part_sols.py,sha256=1IvyEZrcqLcafAQgAFpXtJ2H6hCvIM11OgBHF3KqmGc,12960
5
+ PythonicDISORT/pydisort.py,sha256=Y8Smva-DM7uF8vVbC67Y8Taicvr6BAfRHav7LAy5ksw,37037
6
+ PythonicDISORT/subroutines.py,sha256=MhVwT3C5iwoDr0M51jnsvqkEFk1nfm7L_0svaQ5NOSE,22937
7
+ PythonicDISORT-0.9.4.dist-info/LICENSE.md,sha256=q1i1QVh0OLzK0fj6kaNRNWsM_KZca66JwWgWwbuCPlA,1092
8
+ PythonicDISORT-0.9.4.dist-info/METADATA,sha256=dEJZtjHl9h2Rh1d2T2oy3fjJSdQDkXVSvEenYIca9J8,7104
9
+ PythonicDISORT-0.9.4.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
10
+ PythonicDISORT-0.9.4.dist-info/top_level.txt,sha256=aX6kCeI1E7naZz3xfw4_mIbWh5KBh9dmF3FIvgP5m3Y,15
11
+ PythonicDISORT-0.9.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.1.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,11 +0,0 @@
1
- PythonicDISORT/__init__.py,sha256=V1obNzaFgqInxqYJ5h_r6JHbZRxx4VM5VgzCIS6EEzI,84
2
- PythonicDISORT/_assemble_intensity_and_fluxes.py,sha256=ZxL5TCjgjTOoqPSfXYJJLeTBddhRdouFRQwJO1_qww0,29214
3
- PythonicDISORT/_solve_for_coeffs.py,sha256=8xnjR6fenaTiPXXzxvtXmETFZRnwOnGkHIuuOFpz7Lc,15402
4
- PythonicDISORT/_solve_for_gen_and_part_sols.py,sha256=1IvyEZrcqLcafAQgAFpXtJ2H6hCvIM11OgBHF3KqmGc,12960
5
- PythonicDISORT/pydisort.py,sha256=AZmhV2niPW_XK5cGi_tMSgQQemBtApQB1sKLbEQXqLY,37039
6
- PythonicDISORT/subroutines.py,sha256=tq9_m4iXE8zLE8hh69aWh4wNfRHyCkgZFxZI48DRNE0,21312
7
- PythonicDISORT-0.9.2.dist-info/LICENSE.md,sha256=q1i1QVh0OLzK0fj6kaNRNWsM_KZca66JwWgWwbuCPlA,1092
8
- PythonicDISORT-0.9.2.dist-info/METADATA,sha256=3vtpGDGl8fxkY-BS-nui3gOzg2UR-_dK963j5NrvcvM,7102
9
- PythonicDISORT-0.9.2.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
10
- PythonicDISORT-0.9.2.dist-info/top_level.txt,sha256=aX6kCeI1E7naZz3xfw4_mIbWh5KBh9dmF3FIvgP5m3Y,15
11
- PythonicDISORT-0.9.2.dist-info/RECORD,,