Skip to content

Clarify inconsistent pressure units in QuickBeam gases and quickbeam_optics #166

Open

Description

@cflsepyt

Description

The documented pressure units for the QuickBeam gases function are inconsistent with both its implementation and its COSPv2 caller. The current COSPv2 driver passes pressure in Pa, and the implementation converts Pa to kPa correctly. However, the function documents its input as hPa. A caller following that documentation would calculate pressures 100 times too small.

Relevant code

1. gases documents pressure as hPa

In quickbeam_optics.F90:1050

! [PRES_mb]   pressure (mb) (hPa)

The argument declaration repeats that unit at quickbeam_optics.F90

PRES_mb,           & ! Pressure (mb) (hPa)

2. The implementation treats the input as Pa

At quickbeam_optics.F90:1171-1177:

e = SH*PRES_mb/(SH+0.622_wp)/1000._wp !kPa
p = PRES_mb/1000._wp-e                 ! kPa

Division by 1000 converts Pa to kPa. If PRES_mb were actually supplied in hPa, the correct conversion to kPa would be division by 10.

3. The COSPv2 driver supplies pressure in Pa

The driver assigns pfull in Pa in cosp2_test.F90

cospstateIN%pfull = p(start_idx:end_idx,Nlevels:1:-1) ! Pa

It then passes pfull directly to gases at cosp2_test.F90:1049:

g_vol(i,j) = gases(
    cospstateIN%pfull(i,j),
    cospstateIN%at(i,j),
    cospstateIN%qv(i,j),
    rcfg_cloudsat%freq
)

Therefore, the current driver path is consistent with a Pa input, despite the function documenting hPa.

4. Related inconsistency in quickbeam_optics

p_matrix is also documented as hPa:

p_matrix, & ! Pressure profile (hPa)

However, it is used directly to calculate air density at quickbeam_optics.F90:156 :

rho_a = p_matrix(pr,k)/(287._wp*t_kelvin)

This calculation requires pressure in Pa, which is also what the driver supplies.

Impact

The standard COSPv2 driver currently produces the intended pressure scaling because it passes Pa. However:

  • the interface is misleading
  • callers following the documented hPa convention would obtain pressures and gaseous attenuation that are underestimated

Proposed fix

Use Pa consistently and preserve the current numerical behavior. However if kPa is intended for gaseous attenuation, then the pressure conversion factors should be modified.

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