Skip to content

Check for point source release#600

Merged
smaticka merged 10 commits into
mainfrom
cdr_plotting
May 11, 2026
Merged

Check for point source release#600
smaticka merged 10 commits into
mainfrom
cdr_plotting

Conversation

@smaticka
Copy link
Copy Markdown
Contributor

@smaticka smaticka commented May 4, 2026

Some plotting near the coasts shows up all gray when using cdr_forcing.plot_distribution(). When the release will be treated as a point source in ROMS, it causes issues when trying to visualize. Two issues are addressed and changed as follows:

Currently, RT considers cells with > 1e-3 a fraction of the total. If the all cell fractions are < 1e-3, the integral of the field sums to 0. This results in a distribution of all nans (when all values are normalized by the integral - in this case, divided by 0). This PR checks if any cells have fraction > 1e-3, if none, then the release is treated as a point source.

If hsc (horizont scaling for the gaussian) is too low, the function fcn = np.exp(-((dist / hsc)^2)) evaluates to 0. for values of dist/hsc >=28 fcn evaluates to 0 in python. A check is added to treat cases like this as a point source.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.39%. Comparing base (fcc9a32) to head (ea2b2cb).

Files with missing lines Patch % Lines
roms_tools/setup/cdr_forcing.py 50.00% 4 Missing and 2 partials ⚠️
@@            Coverage Diff             @@
##             main     #600      +/-   ##
==========================================
- Coverage   89.47%   89.39%   -0.08%     
==========================================
  Files          28       28              
  Lines        6130     6141      +11     
  Branches     1093     1096       +3     
==========================================
+ Hits         5485     5490       +5     
- Misses        365      369       +4     
- Partials      280      282       +2     
Flag Coverage Δ
glorys-regional-invariance 36.15% <0.00%> (-0.07%) ⬇️
with-dask-1 80.32% <0.00%> (-0.15%) ⬇️
with-dask-2 51.81% <0.00%> (-0.10%) ⬇️
with-dask-and-xesmf-1 85.01% <50.00%> (-0.08%) ⬇️
with-dask-and-xesmf-2 55.31% <0.00%> (-0.10%) ⬇️
without-dask 84.04% <0.00%> (-0.16%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
roms_tools/setup/cdr_forcing.py 87.53% <50.00%> (-1.19%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@smaticka smaticka marked this pull request as ready for review May 7, 2026 21:03
@smaticka smaticka changed the title add lower tolerance Check for point source release May 7, 2026
@smaticka smaticka requested a review from ScottEilerman May 7, 2026 21:28
@smaticka smaticka merged commit d613adf into main May 11, 2026
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Plotting CDR release near coast shows blank

1 participant