You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MODIS cloud_top_pressure: bottom layer silently truncated by array-length mismatch (nLevels+1 actual vs nLevels dummy) #160
The array constructor (/ 0., optical_thickness(i,1:nLevels) /) has nLevels+1 elements, but the dummy tauIncrement (line 483) is dimension(nLevels), so the last element — the bottom layer's optical thickness — is silently truncated (the same happens to the pressure argument's last edge). The loop do i = 2, size(tauIncrement) then integrates layers 1..nLevels-1 only.
Consequences:
A cloud confined entirely to the bottom model layer is retrieved with cloud_top_pressure = 0 (the integral never accumulates any tau), which also makes it escape the ISCCP low-cloud substitution (retrievedCloudTopPressure > 700 hPa test fails for 0), so it keeps CTP = 0 Pa in the outputs.
More generally, for any column whose tau=1 integration depth reaches the bottom layer, the retrieved CTP is biased toward the layer above.
Suggested fix: size the dummy as dimension(nLevels+1) (and the loop bound accordingly), or drop the prepended zero and pass optical_thickness(i,1:nLevels) with the loop starting at 1.
Two smaller retrieval edge cases in the same file, mentioned for completeness rather than separate issues:
interpolate_to_min requires a strictly negative bracket product (if(yScaled(lowerBound) * yScaled(upperBound) < 0)), so a trial radius whose predicted reflectance matches the observation exactly returns re_fill (-999) instead of that radius.
modis_column's mean cloud-top pressure divides by max(1, count(...)), so a sunlit but cloud-free point reports mean CTP = 0 Pa rather than the fill value used by every other mean in the routine.
Found during systematic validation of the JAX port; happy to open PRs.
Activity