osmose-model / osmose-web-api

Web service that generates Osmose configuration files from data sources like Fishbase and SeaLifeBase. Used by https://www.config.osmose-model.org .
MIT License
2 stars 2 forks source link

Modifying the calculation of accessibility coefficients and theoretical accessibility coefficients #172

Closed agruss2 closed 5 years ago

agruss2 commented 5 years ago

@QQ-Sortiz Here is how accessibility coefficients (for focal functional groups) and theoretical accessibility coefficients (for biotic resources) should be estimated by the API from now on. Hereafter, the term “accessibility coefficient” stands for “accessibility coefficient” or “theoretical accessibility coefficient”, since the two types of parameters should be estimated by the API exactly the same way. Let us assume that the API considers “Species 1” and “Species 2”. (1) The accessibility coefficient of Species 1 to Species 2 is equal to either: accessibility coefficient = 0.8* coeff_1 If (Species 1 IS NOT "zooplankton" or "phytoplankton"). or: accessibility coefficient = 1 If (Species 1 IS "zooplankton" or "phytoplankton").

(2) In FishBase's ecology.csv, the API looks for the "Benthic", "Demersal" and "Pelagic" fields to determine whether: (i) Species 1 is benthic, demersal or pelagic; and (ii) Species 2 is benthic, demersal or pelagic.

(3) Finally: (i) If (Species 1 and Species 2 are both benthic OR are both demersal OR are both pelagic), then coeff_1 = 1; (ii) If (Species 1 is benthic and Species 2 is demersal) OR If (Species 1 is demersal and Species 2 is benthic) OR If (Species 1 is demersal and Species 2 is pelagic) OR If (Species 1 is pelagic and Species 2 is demersal), then coeff_1 = 0.5; (iv) If (Species 1 is benthic and Species 2 is pelagic) OR If (Species 1 is pelagic and Species 2 is benthic), then coeff_1 = 0.125.

Please let me know if you have any questions. Many thanks !

jhpoelen commented 5 years ago

Does this replace the functionality you described in https://github.com/jhpoelen/fb-osmose-bridge/issues/93 ?

jhpoelen commented 5 years ago

@agruss2 assuming that it does, given that you provided "modify ..." in the issue title.

agruss2 commented 5 years ago

@jhpoelen Yes, the idea is to substitute the previous computations that the OSMOSE API were doing (described in #93) by the computations described in the present issue. Many thanks!

jhpoelen commented 5 years ago

@agruss2 thanks for confirming. I've deployed a code change that implements the desired changes. Please confirm that API behaves as desired.

agruss2 commented 5 years ago

@jhpoelen Many thanks for having worked on this. I just ran a test where I queried OSMOSE parameters for the Gulf of Mexico for the functional groups represented in the OSMOSE-WFS model. Unfortunately, the accessibility coefficients I obtained do not look like they should, but I suspect that this is because I may have misunderstood the fields "Benthic", "Demersal" and "Pelagic" from the FB/SLB table "ecology". The problem is that I have been unable to find details about these FB/SLB fields in the Dropbox folders. Therefore, I am going to send an email to Skit on this issue. I suggest that we please make a break on this issue and resume it after the more important issue that remains to be addressed, i.e., #173 , has been addressed. Once again, many thanks for everything!

FIN-JBarile commented 5 years ago

@agruss2 Here it with the definitions for the ECOLOGY table: FishBase_DataDictionary.zip. I also put a copy in DropBox.

agruss2 commented 5 years ago

@FIN-JBarile Thanks a lot, I am going to study these definitions in detail and come back to you and @jhpoelen asap.

agruss2 commented 5 years ago

@FIN-JBarile First off, thanks a lot once again for the data dictionnary. I have spent the necessary time to review that dictionnary and to explore the information provided for different species in the "Ecology" section in fishbase.org and sealifebase.org. Doing all this has allowed me to identify what should be done to fix the issues with the accessibility coefficients that I identified last week. However, before providing detailed comments for Jorrit so that the present GitHub issue can be fixed, I would like to please have a look at the FishBase and SeaLifeBase "ecology" tables. Could you please send me those two tables in an Excel format? Many thanks!

agruss2 commented 5 years ago

@jhpoelen First, please find below the “predation-accessibility.csv” file which the web service delivered for the West Florida Shelf ecosystem to me on August, 20th. predation-accessibility.zip There are several issues with this file: (1) The web service usually set the accessibility coefficients of focal functional groups to 0.1, while I would like the web service to set the great majority of the accessibility coefficients of focal functional groups to 0.8. (2) There are six biotic resources defined with the web service: the two generic plankton groups (phytoplankton, and zooplankton); and the four other biotic resources (meiofauna, small infauna, bivalves, and echinoderms and gastropods). The web service set the theoretical accessibility coefficients of phytoplankton and zooplankton to 1, which is expected. In contrast, the web service set the theoretical accessibility coefficients of meiofauna, small infauna, bivalves, and echinoderms and gastropods to 1 as well, while this is not expected. For the web service should set the theoretical accessibility coefficients of all the biotic resources represented in an OSMOSE model other than the two generic plankton groups (phytoplankton, and zooplankton) to 0.8 maximum.

I reviewed the FishBase and SeaLifeBase “ecology” tables that Skit just sent me. Here is what I would like the web service to implement from now on, please. (Hereafter, the term “accessibility coefficient” stands for “accessibility coefficient” or “theoretical accessibility coefficient”, since the two types of parameters should be estimated by the OSMOSE API exactly the same way.) Let us assume that the API considers “Species 1” and “Species 2”. Species 1 is the prey item and, therefore, corresponds to one of the rows of the “predation-accessibility.csv” file, while Species 2 is the predator and, therefore, corresponds to one of the columns of the “predation-accessibility.csv” file. (1) The accessibility coefficient of Species 1 to Species 2 is equal to either: accessibility coefficient = 0.8* coeff_1 If (Species 1 IS NOT "zooplankton" or "phytoplankton"). or: accessibility coefficient = 1 If (Species 1 IS "zooplankton" or "phytoplankton"). (2) In FishBase's ecology.csv, the API looks for the "Benthic” field to determine whether: (i) Species 1 is benthic or not; and (ii) Species 2 is benthic or not. (3) Finally: (i) If (Species 1 and Species 2 are both benthic) OR If (Species 1 and Species 2 are both NOT benthic) then coeff_1 = 1; (ii) If (Species 1 is benthic and Species 2 is NOT benthic) OR (Species 1 is NOT benthic and Species 2 is benthic), then coeff_1 = 0.5;

Please let me know if you have any questions. Many thanks !

jhpoelen commented 5 years ago

@agruss2 I took a stab at updating the calculations of the accessibility coefficients as you described. Please confirm.

agruss2 commented 5 years ago

@jhpoelen Thank you very much for your work on this. As you can see in the “predation-accessibility.csv” file provided in the zip file attached below, the OSMOSE API now does a better job at defining accessibility coefficients. However, some more work is needed on the OSMOSE API before we can close the present issue. Indeed, most of the accessibility coefficients provided in lines 24-25 and 28-31 and in columns X and Y of the “predation-accessibility.csv” file should be set to 0.4 instead of 0.8, because large crabs (Callinectes sapidus), meiofauna (e.g., Chthamalus stellatus), small infauna (e.g., Branchiomma luctuosa), bivalves (e.g., Tridacna maxima) and echinoderms and gastropods (e.g., Acanthaster planci) are benthic, contrary to all the other functional groups represented in the OSMOSE-WFS model. Therefore, could you please make sure that the OSMOSE API properly gets this? I suspect that, so far, the OSMOSE API has not dealt with benthic organisms properly, because of the differing structure of the FishBase and SeaLifeBase ecology tables used in the “fishbase_archiver” GitHub repository (also provided in the zip file attached below):

Please let me know if this is clear and/or if you need anything else from me. Many thanks!

GitHub_message_Aug23_2018.zip

jhpoelen commented 5 years ago

@agruss2 nice catch! I was (incorrectly) assuming that the usage of the flags (e.g., 0, 1, -1) would be consistent across fishbase and sealifebase. I am now checking against the non-existence of "0". Please try again.

agruss2 commented 5 years ago

@jhpoelen Thank you very much for having addressed this promptly. The accessibility coefficients provided by the web service look better. However, we need some final work on the OSMOSE API, please.

Remember that when I talk about “accessibility coefficients”, I am actually referring to: (1) The accessibility coefficients of focal functional groups: lines 2 to 25 in the “predation-accessibility.csv” file for the OSMOSE-WFS model (provided in the zip file below). And (2) The theoretical accessibility coefficients of biotic resources: lines 26 to 31 in the “predation-accessibility.csv” file for the OSMOSE-WFS model.

Then, regarding the theoretical accessibility coefficients of biotic resources, we have two types of theoretical accessibility coefficients: (1) The theoretical accessibility coefficients of zooplankton and phytoplankton (which must all be set to 1): lines 26 and 27 in the “predation-accessibility.csv” file for the OSMOSE-WFS model. And (2) The theoretical accessibility coefficients of all other biotic resources: lines 28 to 31 in the “predation-accessibility.csv” file for the OSMOSE-WFS model.

The theoretical accessibility coefficients of all other biotic resources (i.e., meiofauna, small infauna, bivalves, and echinoderms and gastropods) are currently all set to 0.8 by the OSMOSE API, while the great majority of them should be set to 0.4. Indeed, meiofauna (e.g., Chthamalus stellatus), small infauna (e.g., Branchiomma luctuosa), bivalves (e.g., Tridacna maxima) and echinoderms and gastropods (e.g., Acanthaster planci) are benthic, contrary to all the other functional groups represented in the OSMOSE-WFS model. For example, the theoretical accessibility of “Meiofauna” to “Amberjacks > 4.0 year” in cell E28 of the “predation-accessibility.csv” file for the OSMOSE-WFS model should be 0.4 and not 0.8, because “Meiofauna” is benthic, while “Amberjacks > 4.0 year” is NOT benthic.

Could you please fix this? I will then run another test with the web service for the Gulf of Mexico/West Florida Shelf to see if the present issue can be closed. Many thanks!

predation-accessibility.zip

jhpoelen commented 5 years ago

@agruss2 Ok, now also applying same coefficient calculations for non-focal non-plankton groups. Please try again.

agruss2 commented 5 years ago

@jhpoelen I just ran a test for the Gulf of Mexico/West Florida Shelf and, now, everything works as it should. Many thanks! I can now close the present issue.