Skip to content

ground_surface: outgoingLongwave_calc modifies the caller's sunwall grid, intended? #139

Description

@songololo

Hello, one small observation in outgoingLongwave_calc in ground_surface.py, independent of the physics.

# Copy of the sunlit wall grid and replacement of the wall height with 1 if sunlit
sunlitwall = sunwall
sunlitwall[sunlitwall > 0] = 1

The comment says copy, but no copy is made, so the caller's wallsun grid (wall heights on sunlit walls) is overwritten with a 0/1 mask. In Solweig_2026a_calc this is currently harmless because the shadowing function regenerates wallsun each timestep and nothing reads it after this call. It would only bite a future consumer of wallsun downstream (POI output, the wall surface temperature scheme, diagnostics), which is why it seems worth mentioning now rather than after it becomes load-bearing.

If the in-place write is not intended, sunlitwall = np.where(sunwall > 0, 1.0, sunwall) or an explicit sunwall.copy() would match the comment. Happy to submit a one-line PR if you agree.

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions