NOAA-FIMS / FIMS

The repository for development of FIMS
https://noaa-fims.github.io/FIMS/
GNU General Public License v3.0
12 stars 8 forks source link

[Bug]: FIMS runs regardless of the length of the `log_obs_error` and `log_Fmort` inputs #622

Open Bai-Li-NOAA opened 1 month ago

Bai-Li-NOAA commented 1 month ago

Describe the bug

FIMS runs even if the user provides only one value for log_obs_error when its length is supposed to be >1. FIMS extends the input with 0s when the input size is shorter than the number of years, and truncates extra values when the input is accidently longer than expected.

To Reproduce

See issue raised in the case-studies repo and a test demonstrating the behavior. In the test, FIMS runs when the length of fleet log_obs_error input is 1 or 100, although the expected length is 30.

Screenshots

No response

Which OS are you seeing the problem on?

Windows

Which browser are you seeing the problem on?

No response

Which version of FIMS are you seeing the problem on?

No response

Additional Context

Suggestions from @msupernaw: It looks like the problem is here, which is called after here. Initially, log_observed_error is resized to the short length in add_to_fims_tmb, and then resized again by Fleet::Initialize when Information::CreateModel. A warning message, or error would be appropriate if the vector is the incorrect length. This highlights the reason we need improved logging.

Andrea-Havron-NOAA commented 3 weeks ago

This will be refactored in the nll_refactor sprint 2 happening around the end of July. The refactor will include appropriate resizing and error checking in the C++ side and change log_obs_error to the log_sd member of respective distribution classes. In the meantime, should we leave the code as is or remove the resize call in Fleet Prepare()?