Skip to content

MODIS cloud_top_pressure: bottom layer silently truncated by array-length mismatch (nLevels+1 actual vs nLevels dummy) #160

Open

Description

@duncanwp

While building a JAX translation of COSP (jax-cosp) we found that the MODIS CO2-slicing cloud-top-pressure integral never sees the bottom model layer.

Location: src/simulator/MODIS_simulator/modis_simulator.F90 (master 5eb05e5), line 177:

retrievedCloudTopPressure(i) = cloud_top_pressure(nLevels,(/ 0._wp, optical_thickness(i,1:nLevels) /), &

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions