Skip to content

quickbeam_subcolumn: hydrometeor attenuation at gate 2 (d_gate=1) neither accumulates gate 1 nor uses its own layer spacing #163

Open

Description

@duncanwp

Location: src/simulator/quickbeam.F90, quickbeam_subcolumn, hydrometeor-attenuation accumulation for the d_gate==1 direction (master 5eb05e5, lines ~122–130):

if(d_gate==1) then
   ! dheight calcuations assumes hgt_matrix points are the cell mid-points.
   if (k>2) then
      ! add to previous value to half of above layer + half of current layer
      a_to_vol(pr,k)=  a_to_vol(pr,k-1) + &
           (kr_vol(pr,k-1)+kr_vol(pr,k))*(hgt_matrix(pr,k-1)-hgt_matrix(pr,k))
   else
      a_to_vol(pr,k)=  kr_vol(pr,k)*(hgt_matrix(pr,k)-hgt_matrix(pr,k+1))
   endif

For k = 2 the else branch executes, so gate 2's attenuation

  1. does not accumulate gate 1's a_to_vol(pr,1), and
  2. uses the layer spacing below it, hgt(2)-hgt(3), instead of hgt(1)-hgt(2).

This is inconsistent with (a) the trapezoid recurrence used for k>2, (b) the gas-attenuation sum immediately below, which special-cases only k=1 (if (k>1) accumulates from gate 2 onward), and (c) the d_gate==-1 branch, which also special-cases only the single starting gate (k<ngate accumulates). The expected value is

a_to_vol(pr,2) = a_to_vol(pr,1) + (kr_vol(pr,1)+kr_vol(pr,2))*(hgt_matrix(pr,1)-hgt_matrix(pr,2))

Impact: for a spaceborne radar with TOA-first input the first two gates are near the model top where hydrometeor attenuation is ~0, so the error is usually negligible in CloudSat products — but the offset it introduces propagates unchanged to every gate below whenever the top two layers do attenuate, and the surface-radar direction does not have the equivalent behaviour, so the two orientations are inconsistent.

Found while building a JAX translation of COSP (jax-cosp), whose default accumulates gate 2 with the trapezoid rule (a legacy switch reproduces the current behaviour for regression comparison).

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