Fisheries

MichelleWardMichelleWard Member
edited December 2015 in Marine Models
Hi NatCap, 

I am trying to run the fisheries model however continually receive an error message for strings cannot be converted to floats. Any suggestions on how to fix this issue? 

Thanks, 

Michelle


Post edited by MichelleWard on

Comments

  • WillBWillB NatCap Staff
    Hi Michelle,

    This sounds like an issue with the model trying to read your input data.  Are there any non-number characters in the inputs files or text-boxes that you're providing?

    If it looks clean to you, would you mind providing a full copy of the messages that were logged when you ran the model?

    Best,
    Will

  • Hi Will, 

    Thanks for your email. So you were right, my csv file had a space in the title which was causing the problem. However now that I have run the model, my outputs are all 0. This happens regardless of whether I run 100, 200 or 10 steps. 

    Do you mind having a look to see if anything stands out to you? 

    Thanks again, 

    Michelle 
  • WillBWillB NatCap Staff
    edited December 2015
    Hi Michelle,

    One thing I'm noticing is that the ExploitationFraction and VulnFishing coefficients in your population parameters CSV are both set to '1' for the only class that produces offspring.  This would mean that no mature individual is able to produce offspring because they're all being harvested.

    Also, you can remove the Fecundity column since your recruitment function is set to Beverton-Holt.

    If those changes don't resolve your issue, would you mind pasting a link to your shapefile?   That way I can run the model with you.

    Best,
    Will

    Post edited by WillB on
  • Hi Will, 

    Thanks for your help. 

    I recently read an article whereby annual recruit is constant, so I re-ran the model using the 'Fixed' recruitment function type and was able to get a value of Rand76,505. 

    For this run, I used:
    Time Steps= 100
    Age-Based model
    Population classes = No
    Harvest = weight
    Total Initial recuits = 19,461,000 kg of harvestable biomass
    Spawners by weight
    Total recruits = 2,780,142 (191,000 eggs per female: 191,000 * 2.21kg (weight of adult) = 422,110/7 steps = 60301kg

    I updated the CSV file to reflect 14.5% of the vulnfishing group is actually harvested. I also removed the Fecundity column. Please see dropbox folder for shp file and CSV file. 


    Thanks again and I hope you had a great Chrissy!

    Michelle
  • WillBWillB NatCap Staff
    edited December 2015
    Hi Michelle,

    Hope you had a great holiday yourself!

    The model ran to completion on my end too, so, if it's okay with you, I'll go ahead and mark this discussion as resolved.

    Let us know if you have any other issues or feedback that we can help out with!

    Best,
    Will

    Post edited by WillB on
  • Hi Will, 

    Thanks again for your help. Before we close this discussion, can you confirm that I am understanding the model requirements properly. 

    Time Steps= 100 (If I wanted to see for 2025, I would set this to 10?)
    Age-Based model
    Population classes = No 
    Harvest = weight
    Total Initial recuits = 19,461,000 (This is kg of harvestable biomass currently in the MPA)
    Spawners by weight
    Weight per adult = 2.21kg
    Total recruits per time step= 
    19,461,000kg = total initial recruits (19461000/2= 9,730,500kg of female recruits)
    9,730,500 /2.21kg = 4,402,941 female adult lobsters 
    4,402,941 *191,000 = 840,961,764,705 new lobsters
    840,961,764,705/7 (stages to become adults) = 120,137,394,957 lobsters per year
    120,137,394,957 x 2.21kg per adult = 265,503,642,857kg 
    Total recruits per time step= 265,503,642,857kg

    Or should I use the below calculations:















    Lobsters live 50 years (43 as adults)

    Females have 1,000,000 eggs
    in life time

    1,000,000/43 = 23,255

    4,402,941 = adult females

    102,390,392,955 = recruits per year    

    Fraction of Harvest: .145 (14.5% is actually harvested)
    Unit Price: 100 (100 rand/ kg)

    CSV file:
    Class1 Subregion1 Duration Maturity Duration       Weight
    Class1: .99  0 0 1 0.5kg
    (99% mortality)  (0% chance of being caught)

    Thanks for your help, 

    Michelle 



  • LaurenLauren Member
    edited January 2016













    Hi Michelle,

    Thanks for posting your questions about the Fisheries model on
    the forum. See below for some answers to your last set of questions.

    Time Steps= 100 (If I wanted to see for 2025, I would set this
    to 10?) 

    **This model is intended to be used as an equilibrium model,
    which means you should always run it for enough time steps so that it reaches
    equilibrium. It shouldn't be used to make predictions for particular years, but
    rather to compare potential outcomes of different scenarios using different
    model runs.


    Total Initial recuits = 19,461,000 (This is kg of harvestable
    biomass currently in the MPA) 

    **This number is to initialize the model, but shouldn't make
    much of a difference for the final results if you let the model run to
    equilibrium. Note that we've used the terminology "recruits" to refer
    to the first age class in the population, not necessarily those that are
    "recruited" to the fishery.

     

    Total recruits per time step= 

    19,461,000kg = total initial recruits (19461000/2= 9,730,500kg
    of female recruits)

    9,730,500 /2.21kg = 4,402,941 female adult lobsters 

    4,402,941 *191,000 = 840,961,764,705 new lobsters

    840,961,764,705/7 (stages to become adults) = 120,137,394,957
    lobsters per year

    120,137,394,957 x 2.21kg per adult = 265,503,642,857kg 

    Total recruits per time step= 265,503,642,857kg

     

    Or should I use the below calculations:

     

    Lobsters live 50 years (43 as adults)

    Females have 1,000,000 eggs
in life time

    1,000,000/43 = 23,255

    4,402,941 = adult females

    102,390,392,955 = recruits per year    

     

    **It's hard to advise on this as it depends on the quality of
    your data. I don't fully follow your first approach, but the second approach
    seems reasonable. If you feel that the other parameters are reasonably well
    known, then you can run the model multiple times with different numbers of
    recruits per time step until you find the number that gives a final estimated
    spawner biomass that matches data you may have on spawner biomass. Note that in
    general the fixed recruitment function makes the most sense if larval recruits
    are being advected from spawning populations outside the area of interest. In
    general the Ricker or Bev-Holt are more biologically realistic. Also note that
    recruits should be in numbers, not in kg.

      

    Fraction of Harvest: .145 (14.5% is actually harvested)

    ** This should be the fraction of the actual harvest that is
    processed and sold. For instance, if only tails are sold, and the price below
    is the price per kilo of tails, then this fraction should be the fraction of
    the total lobster that is tail meat. If the price below is price per kg of
    whole lobster, then this should be 1. The "exploitation fraction" in
    the population parameters CSV gives the proportion of the (vulnerable)
    population that is harvested (as you have it). The user's guide should specify
    this, but let us know if it's not clear.

     

    Unit Price: 100 (100 rand/ kg)

    CSV file: (99% mortality)  (0% chance of being caught)                       

    **Something was lost in
    the formatting, but I think  you had 0.99
    in the CSV input file. This would correspond to a 99% survival rate, meaning
    99% survive to the next year.

     

    Good luck and best wishes!

    Lauren

    Post edited by Lauren on
  • Hi Lauren, 

    Thanks so much for in-depth answers. 

    As recommended, I have changed to Beverton-Holt. The total initial recruits is 1,805,882. (This number is very conservative. Due to lack of data, I used the kg of exploitable biomass multiplied by the average weight of each animal). The alpha is 43,517,441,860 (eggs per female within 1 year X number of adult females currently within the MPA). And Beta is half of this, which is 21,758,720,930.    

    You mentioned that the model is meant to be run to equilibrium, so can I input 100-200 time steps, however look at the 10 time step mark in order to make assumptions for 2026?

    In the output, is the harvest column how much can be harvested under the current exploitable fraction? I have run three different scenarios, one is business as usual, the other is if Commercial take was stopped within the MPA and the third is if poaching was stopped. Unusually, stopping commercial fishing yielded the least amount of harvest. I have uploaded everything on dropbox accessible via this link. 


    If you have time, let me know your thoughts. It is very unusual. 

    Thanks, 

    Michelle 


  • Hi Michelle,

    A few comments. I would not recommend to look at the 10 time step mark to make assumptions for 2026. It's really not intended to be a time-dynamic model. In order to use it in this way you would need to have VERY good data and do a lot of testing of past dynamics using time series (which would require another modeling approach). It's meant to compare average long-term outcomes under different scenarios.

    I see that all of your scenarios, including BAU, result in the population going to 0. This implies that something is probably mis-specified in the model (likely the spawner-recruit relationship). If you do think that extinction is a possibility in the near term, then this is not the best model for assessing extinction risk.

    A bit about harvest: The harvest column indicates how much is harvested given the parameters you've fed the model (harvest rate * exploitable fraction * age-specific biomass or numbers). The model assumes this harvest is all taken; in other words, it's not what can be taken, but what is taken, regardless of how much harvest is sustainable. If you specify a low harvest rate under a scenario of stopping commercial fishing, then in most cases the total harvest will be lower. One exception is if previous harvest rates were unsustainably high and a lower level of fishing allows the population to grow to a great extent, but this will only happen under very specific parameter combinations.

    I hope that helps. 

    Lauren
  • Hi Lauren, 

    Thanks for your assistance, I will adjust my research accordingly. 

    You mentioned that the issue may lie with the spawner-recruit relationship. As you suggested, I decided to use the Beverton-Holt function. So according to Payne and Crawford (1989), female Jasus Lalandii can lay over one million eggs in her 43 year adult lifespan (Payne and Crawford 1989; Branch and Branch 1981). This translates to approximately 23,256 eggs per year. According to Statistics South Africa (2010), there are 19,461,000kg of lobster adults in South African waters. Each adult weighs approximately 2.21 kg (Pollock 1986), so there are about 8,805,882 adult animals. According to Sauer et al. 2003, areas 7 and 8 represent 85% of the national landed catch. These two areas embody what is now the TMNP MPA, including an additional 70km further north and 20km south. Assuming that catch is relative to population, 8,805,882 was multiplied by 85% then halved, leaving a very conservation value of 3,742,500 animals within the MPA. This was then divided by 2 (1,871,250 animals) to find the approximate female population. To find alpha, I simply multiple 1,871,250 (current female population) by 23,256 (eggs per year), equalling 43,517,441,860. 

    The beta in this equation represents the numbers of spawners needed to produce recruitment equal to half the maximum, so divided 43,517,441,860 by 2, which equals 21,758,720,930. 

    There are lot of assumptions due to lack of data, but do my calculations and thought process sound correct?

    Thanks again, 

    Michelle
  • Hi Michelle, 
    I'm not sure I can provide much more feedback on the details of your application. I've usually used time series to estimate spawner-recruit parameters when possible, but in the absence of that I would check to make sure that the output you get makes sense. Can you test against a base case where you know harvest rate and total lobster biomass (e.g. from the historical data) to see if the model outputs are reasonable? 
    Feel free to message me personally using the messaging feature on this forum if you want to discuss more. 

    Lauren
  • Hi.
    Can anyone help me please with my problem. I've got an issue
    running the model of fisheries. I've tried all the data provided by the
    Invest and it worked. Once I used my data i got the following messages :


    Initializing...

    01/24/2018
    19:12:42 root DEBUG Loading <module
    'natcap.invest.fisheries.fisheries' from
    'C:\INVEST~1.3_X\INVEST~1\natcap\invest\fisheries\fisheries.pyc'> in
    frozen environment

    Arguments:

    alpha

    aoi_uri C:/InVEST_3.3.3_x86/Fisheries/input/shapefile_Dakhla/Dakhla.shp

    beta

    do_batch False

    harvest_units Individuals

    migr_cont False

    population_csv_uri C:/InVEST_3.3.3_x86/Fisheries/input/input_Dakhla/population_params.csv

    population_type Stage-Based

    recruitment_type Fixed

    results_suffix

    sexsp No

    spawn_units Individuals

    total_init_recruits 19700000000.0

    total_recur_recruits 53972602.0

    total_timesteps 1000

    val_cont False

    workspace_dir C:\Users\soukaina\Documents\fisheries_workspace



    01/24/2018
    19:12:42 root INFO Logging will be saved to
    natcap.invest.fisheries.fisheries-log-2018-01-24--19_12_42.txt

    01/24/2018 19:12:42 root DEBUG Loaded the model from natcap.invest.fisheries.fisheries

    01/24/2018 19:12:42 root INFO Executing the loaded model

    01/24/2018 19:12:42 root INFO Running InVEST version "3.3.3"

    01/24/2018 19:12:42 root INFO Python architecture: ('32bit', 'WindowsPE')

    01/24/2018 19:12:42 root INFO Disk space remaining for workspace: 127.02 GB

    01/24/2018
    19:12:42 root INFO Pointing temporary directory at
    the workspace at C:\Users\soukaina\Documents\fisheries_workspace

    01/24/2018 19:12:42 root INFO Starting natcap.invest.fisheries.fisheries

    01/24/2018 19:12:42 root INFO Setting tempfile.tempdir to C:\Users\soukaina\Documents\fisheries_workspace\tmp

    01/24/2018 19:12:42 root ERROR ---------------------------------------------------

    01/24/2018 19:12:42 root ERROR ---------------------- ERROR ----------------------

    01/24/2018 19:12:42 root ERROR ---------------------------------------------------

    01/24/2018 19:12:42 root ERROR Error: exception found while running natcap.invest.fisheries.fisheries

    01/24/2018 19:12:42 root DEBUG

    01/24/2018 19:12:42 root DEBUG Build details

    01/24/2018 19:12:42 root DEBUG Interpreter

    01/24/2018 19:12:42 root DEBUG Current temp dir: C:\Users\soukaina\Documents\fisheries_workspace\tmp

    01/24/2018 19:12:42 root DEBUG tempfile.tempdir: C:\Users\soukaina\Documents\fisheries_workspace\tmp

    01/24/2018 19:12:42 root DEBUG

    01/24/2018 19:12:42 root DEBUG System

    01/24/2018 19:12:42 root DEBUG OS : Windows-7-6.1.7601-SP1

    01/24/2018 19:12:42 root DEBUG Processor architecture: x86

    01/24/2018 19:12:42 root DEBUG FS encoding : mbcs

    01/24/2018 19:12:42 root DEBUG Preferred encoding: cp1252

    01/24/2018 19:12:42 root DEBUG

    01/24/2018 19:12:42 root DEBUG Python

    01/24/2018 19:12:42 root DEBUG Version : 2.7.9

    01/24/2018 19:12:42 root DEBUG Build : ('default', 'Dec 10 2014 12:24:55')

    01/24/2018 19:12:42 root DEBUG Compiler : MSC v.1500 32 bit (Intel)

    01/24/2018 19:12:42 root DEBUG Implementation : CPython

    01/24/2018 19:12:42 root DEBUG Architecture : 32bit

    01/24/2018 19:12:42 root DEBUG Linkage format : WindowsPE

    01/24/2018 19:12:42 root DEBUG

    01/24/2018 19:12:42 root DEBUG Packages

    01/24/2018 19:12:42 root DEBUG Cython : ?

    01/24/2018 19:12:42 root DEBUG Numpy : 1.11.2

    01/24/2018 19:12:42 root DEBUG Scipy : 0.16.1

    01/24/2018 19:12:42 root DEBUG OSGEO : 1.11.3

    01/24/2018 19:12:42 root DEBUG Shapely : 1.5.5

    01/24/2018 19:12:42 root DEBUG InVEST : 3.3.3

    01/24/2018 19:12:42 root DEBUG

    01/24/2018 19:12:42 root DEBUG

    01/24/2018 19:12:42 root DEBUG Exception not environment-related

    01/24/2018 19:12:42 root DEBUG Printing traceback

    Traceback (most recent call last):


    File
    "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.iui.executor",
    line 620, in runModel


    File
    "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.fisheries.fisheries",
    line 201, in execute


    File
    "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.fisheries.fisheries_model",
    line 487, in run_population_model


    File
    "C:\Users\natcap-servers\jenkins-home\workspace\natcap.invest\label\GCE-windows-1\exe\build\invest\out00-PYZ.pyz\natcap.invest.fisheries.fisheries_model",
    line 360, in stage_based_cycle_func

    ValueError: shapes (4,4) and (1,4) not aligned: 4 (dim 1) != 1 (dim 0)


    01/24/2018 19:12:42 root ERROR Exiting due to failures.


Sign In or Register to comment.