ESCOMP / ESCOMP/CDEPS

Bug in `datm_datamode_clmncep_mod` preventing using diffuse & direct SW streams

Open Beginner friendly
#425 5 comments 2 reactions 0 assignees View on GitHub
bug
Dominant language
Fortran
Stars
32
Forks
68
Avg merge
5d 13h
Merged PRs (30d)
2

Description

A bug is currently in `datm_datamode_clmncep_mod: datm_datamode_clmncep_advance` on [line 329](https://github.com/ESCOMP/CDEPS/blob/49aa7a79710ddbc9ae3fd225cddf21c29a76da7c/datm/datm_datamode_clmncep_mod.F90#L329). The array assignment for `Faxa_swdn(:) = strm_Faxa_swdn(:)` occurs whether `strm_Faxa_swdn` has been associated or not (and it's not if you try to use direct & diffuse rather than total)

```
! Direct copies of stream fields
Sa_tbot(:) = strm_Sa_tbot(:)
Faxa_swdn(:) = strm_Faxa_swdn(:)
if (associated(strm_Sa_topo)) then
Sa_topo(:) = strm_Sa_topo(:)
else
Sa_topo(:) = SHR_CONST_SPVAL
end if
```

a fix could be to add an associates check (we already check that SOMETHING related to `_swdn` must be associated earlier)

```
if (associated(strm_Faxa_swdn)) then
Faxa_swdn(:) = strm_Faxa_swdn(:)
end if
```

but I'm not sure if this is what we want to do. @mvertens @billsacks @ekluzek @swensosc

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in datm/datm_datamode_clmncep_mod.F90 at datm_datamode_clmncep_advance, especially line 329 and the earlier checks for associated _swdn fields. Exercise a configuration using direct and diffuse rather than total shortwave streams, and confirm the unassociated field is not accessed while the valid stream data is retained.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran
Domain
data-engineering
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.