sizespectrum / mizer

Multi-species size-based ecological modelling in R
https://sizespectrum.org/mizer
38 stars 43 forks source link

Don't warn repeatedly when l_mat and w_mat are inconsistent #277

Closed gustavdelius closed 11 months ago

gustavdelius commented 1 year ago

If a species parameter has both an l_mat and a w_mat column, then each time mizer checks the validity of the species parameters (which it does each time a species parameter is changed) it issues a warning if the l_mat and w_mat values are inconsistent with each other. This will be a nuisance when the user has made a conscious decision to change w_mat (for example while using tuneParams()) but does not want to have to change l_mat by hand at the same time.

There are two possible solutions:

1) Delete the l_mat column once there is an w_mat column 2) Recalculate the l_mat column each time w_mat is changed and similarly recalculate w_mat when l_mat is changed.

I am in favour of the first solution.

gustavdelius commented 11 months ago

The length-based parameters are now removed once they have been used to calculate any missing weight-based parameters

gustavdelius commented 11 months ago

It was not a good idea to remove the length-based parameters. Users may really want to keep a record of what parameters they have provided. Also they may have added comments to the parameters that they want to preserve.

To avoid the frequent warning, I have converted it to a signal instead, so it will be issued when creating a new model but not each time the model is changed.