Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in vulnerable biomass equation #8

Closed
ChrisFishCahill opened this issue Mar 5, 2024 · 3 comments
Closed

Bug in vulnerable biomass equation #8

ChrisFishCahill opened this issue Mar 5, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@ChrisFishCahill
Copy link
Collaborator

ChrisFishCahill commented Mar 5, 2024

There is a bug in the vulnerable biomass as currently calculated, for example see here:

https://github.com/boettiger-lab/rl4fisheries/blob/rppo-n-viz/src/rl4fisheries/envs/asm_2o.py#L223

This p["mwt"] is for prediction of the spawning stock biomass (SSB) used in recruitment predictions, and should actually be p["wt"], as the latter is for prediction of the biomass vulnerable to harvesters.

So to get the time values for vulnerable biomass (visible to harvesters and/or surveys), we need to replace p["mwt"] with p["wt"] in the following files:

asm.py

asm_2o.py

asm_esc.py

Sorry, this bug must have been lost in translation when I converted this from earlier languages to Python.

@ChrisFishCahill ChrisFishCahill added the bug Something isn't working label Mar 5, 2024
@felimomo
Copy link
Collaborator

felimomo commented Mar 5, 2024

Thanks so much, it's great to have caught that! And no worries about it!

To be clear (sometimes 'replace with' can be ambivalent in direction):

we need to change p["mwt"] -> p["wt"], right? Do we also need to replace p["wt"] -> p["mwt"]?

@ChrisFishCahill
Copy link
Collaborator Author

Sorry for the ambiguity. I meant that the following line:

self.vulb = sum(p["vul"] * n * p["mwt"])

should instead be the following:

self.vulb = sum(p["vul"] * n * p["wt"])

I checked the rest of the script--I don't think any further corrections are needed right now--the other locations that p["wt"] or p["mwt"] are called look OK.

@felimomo
Copy link
Collaborator

felimomo commented Mar 5, 2024

Cool! It's now fixed on pull request #9. (Should be merged into the main branch soon!)

@felimomo felimomo closed this as completed Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants