natcap.invest.finfish_aquaculture.finfish_aquaculture_core¶
Implementation of the aquaculture calculations, and subsequent outputs. This will pull from data passed in by finfish_aquaculture.
-
natcap.invest.finfish_aquaculture.finfish_aquaculture_core.
calc_farm_cycles
(outplant_buffer, a, b, tau, water_temp_dict, farm_op_dict, dur)¶ - Input:
- outplant_buffer: The number of days surrounding the outplant day during
which the fish growth cycle can still be started.
- a: Growth parameter alpha. Float used as a scaler in the fish growth
equation.
- b: Growth paramater beta. Float used as an exponential multiplier in
the fish growth equation.
- water_temp_dict: 2D dictionary which contains temperature values for
farms. The outer keys are calendar days as strings, and the inner are farm numbers as strings.
- farm_op_dict: 2D dictionary which contains individual operating
parameters for each farm. The outer key is farm number as a string, and the inner is string descriptors of each parameter.
- dur: Float which describes the length for the growth simulation to run
in years.
Returns cycle_history where:
- cycle_history: Dictionary which contains mappings from farms to a
history of growth for each cycle completed on that farm. These entries are formatted as follows…
- Farm->List of Type (day of outplanting,day of harvest, fish weight
(grams))
-
natcap.invest.finfish_aquaculture.finfish_aquaculture_core.
calc_hrv_weight
(farm_op_dict, frac, mort, cycle_history)¶ - Parameters
farm_op_dict – 2D dictionary which contains individual operating parameters for each farm. The outer key is farm number as a string, and the inner is string descriptors of each parameter.
frac – A float representing the fraction of the fish that remains after processing.
mort – A float referring to the daily mortality rate of fishes on an aquaculture farm.
cycle_history – Farm->List of Type (day of outplanting, day of harvest, fish weight (grams))
- Returns
- curr_cycle_totals: dictionary which will hold a mapping from every
farm (as identified by farm_ID) to the total processed weight of each farm
- indiv_tpw_totals: dictionary which will hold a farm->list mapping,
where the list holds the individual tpw for all cycles that the farm completed
- Return type
tuple (curr_cycle_totals, indiv_tpw_totals)
-
natcap.invest.finfish_aquaculture.finfish_aquaculture_core.
compute_uncertainty_data
(args, output_dir)¶ Does uncertainty analysis via a Monte Carlo simulation.
Returns: -a dict containining statistical results (mean and std deviation) The dict has farm IDs as outer keys, and result types (e.g. ‘value’, ‘weight’, and ‘cycles’) as inner keys.
-
natcap.invest.finfish_aquaculture.finfish_aquaculture_core.
create_HTML_table
(output_html_path, args, cycle_history, sum_hrv_weight, hrv_weight, farms_npv, value_history, uncertainty_stats)¶ - Writes an HTML file containing 3 tables that summarize inputs and outputs
for the duration of the model.
- Input Table: Farm Operations provided data, including Farm ID #,
Cycle Number, weight of fish at start, weight of fish at harvest, number of fish in farm, start day for growing, and length of fallowing period
- Output Table 1: Farm Harvesting data, including a summary table
for each harvest cycle of each farm. Will show Farm ID, cycle number, days since outplanting date, harvested weight, net revenue, outplant day, and year.
- Output Table 2: Model outputs for each farm, including Farm ID,
net present value, number of completed harvest cycles, and total volume harvested.
- Parameters
output_html_path – The output html file path.
cycle_history – dictionary mapping farm ID->list of tuples, each of which contains 3 things- (day of outplanting, day of harvest, harvest weight of a single fish in grams)
sum_hrv_weight – dictionary which holds a mapping from farm ID->total processed weight of each farm
hrv_weight – dictionary which holds a farm->list mapping, where the list holds the individual tpw for all cycles that the farm completed
do_valuation – boolean variable that says whether or not valuation is desired
farms_npv – dictionary with a farm-> float mapping, where each float is the net processed value of the fish processed on that farm, in $1000s of dollars.
value_history – dictionary which holds a farm->list mapping, where the list holds tuples containing (Net Revenue, Net Present Value) for each cycle completed by that farm
- Returns
None
-
natcap.invest.finfish_aquaculture.finfish_aquaculture_core.
do_monte_carlo_simulation
(args)¶ Performs a Monte Carlo simulation and returns the results.
-
natcap.invest.finfish_aquaculture.finfish_aquaculture_core.
execute
(args)¶ Runs the biophysical and valuation parts of the finfish aquaculture model. This will output:
- a shape file showing farm locations w/ addition of # of harvest cycles,
total processed weight at that farm, and if valuation is true, total discounted net revenue at each farm location.
- Three HTML tables summarizing all model I/O- summary of user-provided
data, summary of each harvest cycle, and summary of the outputs/farm
- A .txt file that is named according to the date and time the model is
run, which lists the values used during that run
- Parameters
args['workspace_dir'] – The directory in which to place all result files.
args['results_suffix'] (string) – (optional) string to append to any output file names
args['ff_farm_file'] – An open shape file containing the locations of individual fisheries
args['farm_ID'] – column heading used to describe individual farms. Used to link GIS location data to later inputs.
args['g_param_a'] – Growth parameter alpha, used in modeling fish growth, should be int or a float.
args['g_param_b'] – Growth parameter beta, used in modeling fish growth, should be int or a float.
args['water_temp_dict'] –
A dictionary which links a specific date to the farm numbers, and their temperature values on that day. (Note: in this case, the outer keys 1 and 2 are calendar days out of 365, starting with January 1 (day 0), and the inner 1, 2, and 3 are farm numbers.)
- Format: {‘0’: ‘{‘1’: ‘8.447, ‘2’: ‘8.447’, ‘3’:’8.947’, …}’ ,
’1’: ‘{‘1’: ‘8.406, ‘2’: ‘8.406’, ‘3’:’8.906’, …}’ , . . . . . . . . . }
args['farm_op_dict'] –
Dictionary which links a specific farm ID # to another dictionary containing operating parameters mapped to their value for that particular farm (Note: in this case, the 1 and 2 are farm ID’s, not dates out of 365.)
- Format: {‘1’: ‘{‘Wt of Fish’: ‘0.06’, ‘Tar Weight’: ‘5.4’, …}’,
’2’: ‘{‘Wt of Fish’: ‘0.06’, ‘Tar Weight’: ‘5.4’, …}’, . . . . . . . . . }
args['frac_post_process'] – the fraction of edible fish left after processing is done to remove undesirable parts
args['mort_rate_daily'] – mortality rate among fish in a year, divided by 365
args['duration'] – duration of the simulation, in years
args['outplant_buffer'] – This value will allow the outplant start day to be flexible plus or minus the number of days specified here.
args['do_valuation'] – boolean indicating whether or not to run the valuation process
args['p_per_kg'] – Market price per kilogram of processed fish
args['frac_p'] – Fraction of market price that accounts for costs rather than profit
args['discount'] – Daily market discount rate
- Returns
None
-
natcap.invest.finfish_aquaculture.finfish_aquaculture_core.
valuation
(price_per_kg, frac_mrkt_price, discount, hrv_weight, cycle_history)¶ This performs the valuation calculations, and returns tuple containing a dictionary with a farm-> float mapping, where each float is the net processed value of the fish processed on that farm, in $1000s of dollars, and a dictionary containing a farm-> list mapping, where each entry in the list is a tuple of (Net Revenue, Net Present Value) for every cycle on that farm.
- Parameters
price_per_kg – Float representing the price per kilogram of finfish for valuation purposes.
frac_mrkt_price – Float that represents the fraction of market price that is attributable to costs.
discount – Float that is the daily market discount rate.
cycle_hisory – Farm->List of Type (day of outplanting, day of harvest, fish weight (grams))
hrv_weight – Farm->List of TPW for each cycle (kilograms)
- Returns
- val_history: dictionary which will hold a farm->list mapping, where the
list holds tuples containing (Net Revenue, Net Present Value) for each cycle completed by that farm
- valuations: dictionary with a farm-> float mapping, where each float is
the net processed value of the fish processed on that farm
- Return type
tuple (val_history, valuations)