NCAR / NCAR/DART

quad_utils_mod regional grids that cross 0 longitude.

Open
#1,124 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug interpolation quad_utils
Dominant language
Fortran
Stars
263
Forks
182
Avg merge
11d 12h
Merged PRs (30d)
7

Description

☠️ skeleton.

quad_utils_mod for regional grids that cross 0 longitude I do not think is correct.

https://github.com/NCAR/DART/blob/890a3beec7cde2099218ea30efa7c2b268be968d/models/utilities/quad_utils_mod.f90#L764-L785

For lon -10 to 10 (350, 10]

max_lon = 350, min_lon = 10

h%ii%min_lon = minval(h%ii%lons_2d)
h%ii%max_lon = maxval(h%ii%lons_2d)
h%ii%lon_width = h%ii%max_lon - h%ii%min_lon 

lon_width = 350 - 10 = 340 rather than 20 ( -10 to 10 )

spans_lon_zero is being used as equivalent to cyclic which it is not.
spans_lon_zero is being used to find the pole (even if there is no pole), then fail boxes that go through the "pole" (not a pole).

https://github.com/NCAR/DART/blob/890a3beec7cde2099218ea30efa7c2b268be968d/models/utilities/quad_utils_mod.f90#L753-L755

https://github.com/NCAR/DART/blob/890a3beec7cde2099218ea30efa7c2b268be968d/models/utilities/quad_utils_mod.f90#L787-L812

Which is then used to fail if "point is in one of the U boxes that go through the pole".

https://github.com/NCAR/DART/blob/890a3beec7cde2099218ea30efa7c2b268be968d/models/utilities/quad_utils_mod.f90#L1432-L1438

Note I think there is some confusion in the code with u & t grids looks like used to deal with both. I think T (scalar) interpolation is being skipped at the pole in the above code. I will probably put this in as a separate issue since it affects global as well as regional grids.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in models/utilities/quad_utils_mod.f90 at lines 753-812, then inspect the point-in-box logic around lines 1432-1438. Reproduce the longitude-width calculation for a regional grid spanning -10 to 10 and trace how spans_lon_zero affects pole handling. Done means crossing zero longitude is treated as a narrow regional span without incorrectly applying pole or cyclic-grid behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.