Brief History on Sardines¶
Source: SeaGrant California
# import required packages
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
from matplotlib.pyplot import figure
import plotly.graph_objects as go
import plotly.express as px
import plotly.io as pio
import math
from scipy import stats
pio.renderers.default = 'notebook'
The collapse of the pacific sardine population propelled the formation of The California Cooperative Oceanic Fisheries Investigations (CalCOFI) in 1949 to better understand factors influencing the decline of the sardine population, such as the relative role of fishing effort and environmental variability on the population. The pacific sardine was highly valued as it was the main fish for many fisheries not just in the California Coast, but the entire country. In fact, sardine significant played a role in World War I by being one of the main source of food. Thus, the decline of the sardine population caused a lot of panic due to its value and importance in history.
CALCOFI stated in their research article that they hypothesize temperature to be the leading cause of the decline. Yet, results of their analysis concludes a multitude of different variables- such as a change in migration patterns and predatory behaviors. In addition, the role of overfishing in declining sardine populations relative to environmental variability is still an open question. Thus the question still remains: has the sardine population recovered from the effects of this decline?
Source: Gilberto Villasana/Shutterstock
# Loading Sardine Larvae Count Dataset
sardine_ts2 = pd.read_csv("data/sardine_larvae.csv")
sardine_ts2['Count'] = sardine_ts2['Count'].round(0)
We can visualize the sardine population using two different scopes. The first method is to track the amount of sardine larvae recorded each years. As the saying goes, children are our future. Thus, visualizing the larvae population is crucial in showcasing what the future of sardine population may be. The second method is similar- visualize the pounds of adult sardine caught. More sardine caught in a given year may indicate that there was a higher amount of sardine present in the wild.
Sardine Larvae Per Year¶
The chart below visualizes the count of sardine larvae recorded per year.
# relabel column
sardine_ts2['Species'] = 'Sardine'
# create new variable that keeps track of "year" -> used to animate the line graph
data_sardine = []
for y in sardine_ts2['Year'].unique():
df = sardine_ts2[sardine_ts2.Year<=y].copy()
df['year_upto'] = y
data_sardine.append(df)
sardine_ts_animated = pd.concat(data_sardine)
# convert Year column into integers
sardine_ts_animated.Year = sardine_ts_animated.Year.astype(int)
# generate line plot
fig_sardine_animated = px.line(
sardine_ts_animated,
x = 'Year',
y = 'Count',
animation_frame = 'year_upto',
range_x = [1949,2022],
hover_name = 'Count',
hover_data =['Count'],
title = 'Sardine Abundance, By Year',
labels = {'Count':'Sardine Abundance','Year':'Year','year_upto':'Year'},
template = 'plotly'
)
# configure axis ranges
fig_sardine_animated.update_xaxes(autorange=False)
fig_sardine_animated.update_yaxes(range=[0,7500])
# configure window layout and display plot
fig_sardine_animated.update_layout(autosize=True)
fig_sardine_animated.show(animate=True,autorange=False)