Skip to content

Comments

add warning on read of out of range Fcast_relF_Basis#346

Merged
Rick-Methot-NOAA merged 3 commits intomainfrom
330-forecast-file-option-relf-basis
Jul 12, 2022
Merged

add warning on read of out of range Fcast_relF_Basis#346
Rick-Methot-NOAA merged 3 commits intomainfrom
330-forecast-file-option-relf-basis

Conversation

@Rick-Methot-NOAA
Copy link
Collaborator

What issue(s) does this PR address?

(note: including the keyword "resolves" means the issue will be closed automatically when merged in.)

Link issue(s), replacing everything in [ ]: resolves #[add issue number number], resolves #[optional second issue number if more than 1 issue addressed.]
resolves #330

Describe the issue, if not included in the PR

N/A

What tests have been done? Upload any model input files created for testing in a zip file, if possible.

option test; correct warning is created

What tests/review still need to be done? Who can do it, and by when is it needed (ideally)?

none

is there an input change for users to Stock Synthesis?

no
If so, please provide an example of the new inputs needed.

[New example stock synthesis input goes here]

Check which is true. This PR requires:

  • no further changes to r4ss
  • no further changes to the manual
  • no further changes to SSI (the SS3 GUI)
  • no further changes to the stock synthesis change log (new features, bug reports)

Describe any changes in r4ss/SS3 manual/SSI that are needed (if not checked):

If changes are needed in the change log, please fill in the table here:

Version Date Description Issue Input change Action Topic Type
3.30.20 [Add date] [add concise description] #[add issue] [yes or no] [fix, new, or revise] [e.g., biology. Use issue label options.] [input, output, and/or calc, or ALL]

Additional information (optional):

@Rick-Methot-NOAA Rick-Methot-NOAA linked an issue Jul 11, 2022 that may be closed by this pull request
Copy link
Contributor

@k-doering-NOAA k-doering-NOAA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rick-Methot-NOAA I like the warning message, it's very clear! I wonder if a few other changes are necessary:

  • Exit on error if Anything other than 1 or 2 is read. Otherwise, I think people will ignore the error
  • I still think this statement should be changed to specifically use 1 or 2 instead of 1 and an else statement: #330 (comment) . I think this is more clear, in case a future option is added or if the warning gets deleted for some reason.

Picky/Style: need space between "<1" in the if statement

@Rick-Methot-NOAA
Copy link
Collaborator Author

It does exit on error, that is what one of the "1"s does in warn_msg function
Disagree on the explicit usage; I am trying to move code towards doing all checking at the read stage so fewer "IF" needed in active code.
darn spaces. What I need is a way to highlight a section of code and then click the "style" button.

@Rick-Methot-NOAA
Copy link
Collaborator Author

Rick-Methot-NOAA commented Jul 12, 2022

message displayed to screen is:
Fatal Error: see warning.sso
Exiting SS3.

message in echoinput is:
next select fleet relative F: 1=use first-last alloc year read above; 2=read list of seas, fleet, relF below
Note that fleet allocation is used directly as average F if Do_Forecast=4
0 # echoed value
Exit! Fcast_relF_Basis value must be 1 or 2

@k-doering-NOAA
Copy link
Contributor

Thanks for explaining to me how the write_warning function works, I hadn't used it yet! like the approach of checking inputs early, and it looks good as-is!

As for the explicit usage: I see. My concern is that it is confusing for readers of the code to only look for the 1 and then use an else, when the 2 options are 1 and 2. Maybe a switch statement is actually a clearer option?
However, this is fairly picky, and I'm happy to leave it as is if you feel strongly the other way

@Rick-Methot-NOAA Rick-Methot-NOAA merged commit 1a0bf4a into main Jul 12, 2022
@Rick-Methot-NOAA Rick-Methot-NOAA deleted the 330-forecast-file-option-relf-basis branch July 12, 2022 20:34
@Rick-Methot-NOAA Rick-Methot-NOAA added this to the 3.30.20 milestone Sep 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

forecast file option relF basis

2 participants