Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions src/gemini3d/particles/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
from .core import get_times
from .grid import precip_grid

# OUTPUT ARGUMENT NEEDS TO BE MADE OPTIONAL TO RUN 'OLD' EXAMPLES!!!!!

# this is loaded dynamically via str2func
from .gaussian2d import gaussian2d

Expand Down Expand Up @@ -52,17 +54,25 @@ def particles_BCs(cfg: dict[str, T.Any], xg: dict[str, T.Any]):
else:
Qfunc = str2func("gemini3d.particles.gaussian2d")

Qtmp = Qfunc(pg, cfg["Qprecip"], cfg["Qprecip_background"])

Qtmp, E0_temp = Qfunc(pg, cfg["Qprecip"], cfg["Qprecip_background"])
print("i_on: ", i_on)
print("i_off: ", i_off)
print("Qtmp shape: ", Qtmp.shape)
print("E0tmp shape: ", E0_temp.shape)

for i in range(i_on, i_off):
if Qtmp.ndim == 3:
pg["Q"][i, :, :] = Qtmp[i, :, :]
pg["Q"][i, :, :] = Qtmp[i, :, :] # time, lon, lat
else:
pg["Q"][i, :, :] = Qtmp
pg["E0"][i, :, :] = cfg["E0precip"]
pg["E0"][i, :, :] = E0_temp

assert np.isfinite(pg["Q"]).all(), "Q flux must be finite"
assert (pg["Q"] >= 0).all(), "Q flux must be non-negative"
if E0 > 0
assert (pg["E0"] >=0).all(), "E0 characteristic energy must be non-negative"
else
continue

# %% CONVERT THE ENERGY TO EV
# E0 = max(E0,0.100);
Expand Down
4 changes: 3 additions & 1 deletion src/gemini3d/particles/gaussian2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ def gaussian2d(pg, Qpeak: float, Qbackground: float):
raise LookupError("precipation must be defined in latitude, longitude or both")

Q[Q < Qbackground] = Qbackground

E0 = cfg["E0precip"]

return Q
return Q, E0