Finding the edge: Preliminary insights into blue whale habitat selection in New Zealand

By Dawn Barlow, MSc student, OSU Department of Fisheries and Wildlife, Geospatial Ecology of Marine Megafauna Lab

I was fortunate enough to spend the Austral summer in the field, and so while the winter rain poured down on Oregon I found myself on the water with the sun and wind on my face, looking for blue whales in New Zealand. This spring I switched gears and spent time taking courses to build my analytical toolbox. In a course on technical writing and communication, I was challenged to present my research using only pictures and words with no written text, and to succinctly summarize the importance of my research in an introduction to a technical paper. I attended weekly seminars to learn about the diverse array of marine science being conducted at Oregon State University and beyond. I also took a course entitled “Advanced Spatial Statistics and Geographic Information Science”. In this skill-building course, we were given the opportunity to work with our own data. Even though my primary objective was to expand the tools in my toolbox, I was excited to explore preliminary results and possible insight into blue whale habitat selection in my study area, the South Taranaki Bight region (STB) of New Zealand (Figure 1).

Figure 1. A map of New Zealand, with the South Taranaki Bight (STB) region delineated by the black box. Farewell Spit is denoted by a star, and Kahurangi point is denoted by an X.

Despite the recent documentation of a foraging ground in the STB, blue whale distribution remains poorly understood in New Zealand. The STB is New Zealand’s most industrially active marine region, and the site of active oil and gas extraction and exploration, busy shipping traffic, and proposed seabed mining. This potential space-use conflict between endangered whales and industry warrants further investigation into the spatial and temporal extent of blue whale habitat in the region. One of my research objectives is to investigate the relationship between blue whales and their environment, and ultimately to build a model that can predict blue whale presence based on physical and biological oceanographic features. For this spring term, the question I asked was:

Is the number of blue whales present in an area correlated with remotely-sensed sea surface temperature and chlorophyll-a concentration?

For the purposes of this exploration, I used data from our 2017 survey of the STB. This meant importing our ship’s track and our blue whale sighting locations into ArcGIS, so that the data went from looking like this:

… to this:

The next step was to get remote-sensed images for sea surface temperature (SST) and chlorophyll-a (chl-a) concentration. I downloaded monthly averages from the NASA Moderate Resolution Imaging Spectrometer (MODIS aqua) website for the month of February 2017 at 4 km2 resolution, when our survey took place. Now, my images looked something more like this:

But, I can’t say anything reliable about the relationships between blue whales and their environment in the places we did not survey.  So next I extracted just the portions of my remote-sensed images where we conducted survey effort. Now my maps looked more like this one:

The above map shows SST along our ship’s track, and the locations where we found whales. Just looking at this plot, it seems like the blue whales were observed in both warmer and colder waters, not exclusively in one or the other. There is a productive plume of cold, upwelled water in the STB that is generated off of Kahurangi point and curves around Farewell Spit and into the bight (Figure 1). Most of the whales we saw appear to be near that plume. But how can I find the edges of this upwelled plume? Well, I can look at the amount of change in SST and chl-a across a spatial area. The places where warm and cold water meet can be found by assessing the amount of variability—the standard deviation—in the temperature of the water. In ArcGIS, I calculated the deviation in SST and chl-a concentration across the surrounding 20 km2 for each 4 km2 cell.

Now, how do I tie all of these qualitative visual assessments together to produce a quantitative result? With a statistical model! This next step gives me the opportunity to flex some other analytical muscles, and practice using another computational tool: R. I used a generalized additive model (GAM) to investigate the relationships between the number of blue whales observed in each 4 km2 cell our ship surveyed and the remote-sensed variables. The model can be written like this:

Number of blue whales ~ SST + chl-a + sd(SST) + sd(chl-a)

In other words, are SST, chl-a concentration, deviation in SST, and deviation in chl-a concentration correlated with the number of blue whales observed within each 4 km2 cell on my map?

This model found that the most important predictor was the deviation in SST. In other words, these New Zealand blue whales may be seeking the edges of the upwelling plume, honing in on places where warm and cold water meet. Thinking back on the time I spent in the field, we often saw feeding blue whales diving along lines of mixing water masses where the water column was filled with aggregations of krill, blue whale prey. Studies of marine mammals in other parts of the world have also found that eddies and oceanic fronts—edges between warm and cold water masses—are important habitat features where productivity is increased due to mixing of water masses. The same may be true for these New Zealand blue whales.

These preliminary findings emphasize the benefit of having both presence and absence data. The analysis I have presented here is certainly strengthened by having environmental measurements for locations where we did not see whales. This is comforting, considering the feelings of impatience generated by days on the water spent like this with no whales to be seen:

Moving forward, I will include the blue whale sighting data from our 2014 and 2016 surveys as well. As I think about what would make this model more robust, it would be interesting to see if the patterns become clearer when I incorporate behavior into the model—if I look at whales that are foraging and traveling separately, are the results different? I hope to explore the importance of the upwelling plume in more detail—does the distance from the edge of the upwelling plume matter? And finally, I want to adjust the spatial and temporal scales of my analysis—do patterns shift or become clearer if I don’t use monthly averages, or if I change the grid cell sizes on my maps?

I feel more confident in my growing toolbox, and look forward to improving this model in the coming months! Stay tuned.

Grad School Headaches

By Florence Sullivan, MSc student GEMM lab

Over the past few months I have been slowly (and I do mean SLOWLY – I don’t believe I’ve struggled this much with learning a new skill in a long, long time) learning how to work in “R”.  For those unfamiliar with why a simple letter might cause me so much trouble, R is a programming language and free software environment suitable for statistical computing and graphing.

My goal lately has been to interpolate my whale tracklines (i.e. smooth out the gaps where we missed a whale’s surfacing by inserting artificial locations).  In order to do this I needed to know (1) How long does a gap between fixes need to be to identify a missed surfacing? (2) How many artificial points should be used to fill a given gap?

The best way to answer these queries was to look at a distribution of all of the time steps between fixes.  I started by importing my dataset – the latitude and longitude, date, time, and unique whale identifier for each point (over 5000 of them) we recorded last summer. I converted the locations into x & y coordinates, adjusted the date and time stamp into the proper format, and used the package adehabitatLT  to calculate the difference in times between each fix.  A package known as ggplot2 was useful for creating exploratory histograms – but my data was incredibly skewed (Fig 1)! It appeared that the majority of our fixes happened less than a minute apart from each other. When you recall that gray whales typically take 3-4 short breathes at the surface between dives, this starts to make a lot of sense, but we had anticipated a bimodal distribution with two peaks: one for the quick surfacings, and one for the surfacings between 4-5 minutes dives. Where was this second peak?

Histogram of the difference in time (in seconds) between whale fixes.
Fig. 1.  Histogram of the difference in time (in seconds on x-axis) between whale fixes.

Sometimes, calculating the logarithm of one of your axes can help tease out more patterns in your data  – particularly in a heavily skewed distribution like Fig. 1. When I logged the time interval data, our expected bimodal distribution pattern became evident (Fig. 2). And, when I back-calculate from the center of the two peaks we see that the first peak occurs at less than 20 seconds (e^2.5 = 18 secs) representing the short, shallow blow intervals, or interventilation dives, and that the second peak of dives spans ~2.5 minutes to  ~5 minutes (e^4.9 = 134 secs, e^5.7 = 298 secs). Reassuringly, these dive intervals are in agreement with the findings of Stelle et al. (2008) who described the mean interval between blows as 15.4 ± 4.73 seconds, and overall dives ranging from 8 seconds to 11 minutes.

Fig. 2. Histogram of the log of time difference between whale fixes.
Fig. 2. Histogram of the log of time difference between whale fixes.

So, now that we know what the typical dive patterns in this dataset are, the trick was to write a code that would look through each trackline, and identify gaps of greater than 5 minutes.  Then, the code calculates how many artificial points to create to fill the gap, and where to put them.

Fig. 3. A check in my code to make sure the artificial points are being plotted correctly. The blue points are the originals, and the red ones are new.
Fig. 3. A check in my code to make sure the artificial points are being plotted correctly. The blue points are the originals, and the red ones are new.

One of the most frustrating parts of this adventure for me has been understanding the syntax of the R language.  I know what calculations or comparisons I want to make with my dataset, but translating my thoughts into syntax for the computer to understand has not been easy.  With error messages such as:

Error in match.names(clabs, names(xi)) :

  names do not match previous names

Solution:  I had to go line by line and verify that every single variable name matched, but turned out it was a capital letter in the wrong place throwing the error!

Error in as.POSIXct.default(time1) :

  do not know how to convert ‘time1’ to class “POSIXct”

Solution: a weird case where the data was in the correct time format, but not being recognized, so I had to re-import the dataset as a different file format.

Error in data.frame(Whale.ID = Whale.ID, Site = Site, Latitude = Latitude,  :   arguments imply differing number of rows: 0, 2, 1

Solution: HELP! Yet to be solved….

Is it any wonder that when a friend asks how I am doing, my answer is “R is kicking my butt!”?

Science is a collaborative effort, where we build on the work of researchers who came before us. Rachael, a wonderful post-doc in the GEMM Lab, had already tackled this time-based interpolation problem earlier in the year working with albatross tracks. She graciously allowed me to build on her previous R code and tweak it for my own purposes. Two weeks ago, I was proud because I thought I had the code working – all that I needed to do was adjust the time interval we were looking for, and I could be off to the rest of my analysis!  However, this weekend, the code has decided it doesn’t work with any interval except 6 minutes, and I am lost.

Many of the difficulties encountered when coding can be fixed by judicious use of google, stackoverflow, and the CRAN repository.

But sometimes, when you’ve been staring at the problem for hours, what you really need is a little praise for trying your best. So, if you are an R user, go download this package: praise, load the library, and type praise() into your console. You won’t regret it (See Fig. 4).

Screenshot (74)
Fig. 4. A little compliment goes a long way to solving a headache.

Thank you to Rachael who created the code in the first place, thanks to Solene who helped me trouble shoot, thanks to Amanda for moral support. Go GEMM Lab!

Why do pirates have a hard time learning the alphabet?  It’s not because they love aaaR so much, it’s because they get stuck at “c”!

Stelle, L. L., W. M. Megill, and M. R. Kinzel. 2008. Activity budget and diving behavior of gray whales (Eschrichtius robustus) in feeding grounds off coastal British Columbia. Marine mammal science 24:462-478.

Exciting news for the GEMM Lab: SMM conference and a twitter feed!

By Amanda Holdman (M.S Student)

At the end of the week, the GEMM Lab will be pilling into our fuel efficient Subaru’s and start heading south to San Francisco! The 21st Biennial Conference on the Biology of Marine Mammals, hosted by the Society of Marine Mammalogy, kicks off this weekend and the GEMM Lab is all prepped and ready!

Workshops start on Saturday prior to the conference, and I will be attending the Harbor Porpoise Workshop, where I get to collaborate with several other researchers worldwide who study my favorite cryptic species. After morning introductions, we will have a series of talks, a lunch break, and then head to the Golden Gate Bridge to see the recently returned San Francisco harbor porpoise. Sounds fun right?!? But that’s just day one. A whole week of scientific fun is to be had! So let’s begin with Society’s mission:

smm-2015-logo

‘To promote the global advancement of marine mammal science and contribute to its relevance and impact in education, conservation and management’ 

And the GEMM Lab is all set to do just that! The conference will bring together approximately 2200 top marine mammal scientists and managers to investigate the theme of Marine Mammal Conservation in a Changing World. All GEMM Lab members will be presenting at this year’s conference, accompanied by other researchers from the Marine Mammal Institute, to total 34 researchers representing Oregon State University!

Here is our Lab line-up:

Our leader, Leigh will be starting us off strong with a speed talk on Moving from documentation to protection of a blue whale foraging ground in an industrial area of New Zealand

Tuesday morning I will be presenting a poster on the Spatio-temporal patterns and ecological drivers of harbor porpoises off of the central Oregon coast

Solène follows directly after me on Tuesday to give an oral presentation on the Environmental correlates of nearshore habitat distribution by the critically endangered Maui dolphin.

Florence helps us reconvene Thursday morning with a poster presentation on her work, Assessment of vessel response to foraging gray whales along the Oregon coast to promote sustainable ecotourism. 

And finally, Courtney, the most recent Master of Science, and the first graduate of the GEMM Lab will give an oral presentation to round us out on Citizen Science: Benefits and limitations for marine mammal research and education

However, while I am full of excitement and anticipation for the conference, I do regret to report that you will not be seeing a blog post from us next week. That’s because the GEMM Lab recently created a twitter feed and we will be “live tweeting” our conference experience with all of you! You can follow along the conference by searching #Marman15 and follow our Lab at @GemmLabOSU

Twitter is a great way to communicate our research, exchange ideas and network, and can be a great resource for scientific inspiration.

If you are new to twitter, like the GEMM Lab, or are considering pursuing graduate school, take some time to explore the scientific world of tweeting and following. I did and as it turns out there are tons of resources that are aimed for grad students to help other grad students.

For example:

Tweets by the thesis wisperer team (@thesiswisperer) offer advice and useful tips on writing and other grad related stuff. If you are having problems with statistics, there are lots of specialist groups such as R-package related hashtags like #rstats, or you could follow @Rbloggers and @statsforbios to name a few.

As always, thanks for following along, make sure to find us on twitter so you can follow along with the GEMM Labs scientific endeavors.

 

 

On learning to Code…

By Amanda Holdman, MSc student, Dept. Fisheries and Wildlife, OSU

I’ve never sworn so much in my life. I stared at a computer screen for hours trying to fix a bug in my script. The cause of the error escaped me, pushing me into a cycle of tension, self-loathing, and keyboard smashing.

The cause of the error? A typo in the filename.

When I finally fixed the error in my filename and my code ran perfectly – my mood quickly changed. I felt invincible; like I had just won the World Cup. I did a quick victory dance in my kitchen and high-fived my roommate, and then sat down and moved on the next task that needed to be conquered with code. Just like that, programming has quickly become a drug that makes me come back for more despite the initial pain I endure.

I had never opened a computer programming software until my first year of graduate school. Before then Matlab was just the subject of a muttered complaint by my college engineering roommate. As a biology major, I blew it off as something (thank goodness!) I would never need to use. Needless to say, that set me up for a rude awakening just one year later.

The time has finally come for me to, *gulp*, learn how to code. I honestly think I went through all 5 stages of grief before I realized I was at the point where I could no longer put it off.

By now you are familiar with the GEMM Lab updating you with photos of our charismatic study species in our beautiful study areas. However, summer is over. My field work is complete, and I’m enrolled in my last course of my master’s career. So what does this mean? Winter. And with winter comes data analysis. So, instead of spending my days out on a boat in calm seas, watching humpbacks breach, or tagging along with Florence to watch gray whales forage along the Oregon coast, I’ve reached the point of my graduate career that we don’t often tell you about: Figuring out what story our data is telling us. This stage requires lots of coffee and patience.

However, in just two short weeks of learning how to code, I feel like I’ve climbed mountains. I tackle task after task, each allowing me to learn new things, revise old knowledge, and make it just a little bit closer to my goals. One of the most striking things about learning how to code is that it teaches you how to problem solve. It forces you to think in a strategic and conceptual way, and to be honest, I think I like it.

For example, this week I mapped the percent of my harbor porpoise detections over tidal cycles. One of the most important factors explaining the distribution and behavior of coastal marine mammals are tides. Tidal forces drive a number of preliminary and secondary oceanographic processes like changes in water depth, salinity, temperature, and the speed and direction of currents. It’s often difficult to unravel which part of the tidal process is most influential to a species due to the several covariates related to the change in tides , how inter-related those covariates are, and the elusive nature of the species (like the cryptic harbor porpoise). However, while the analysis is preliminary, if we map the acoustic detections of harbor porpoise over the tidal cycle, we can already start to see some interesting trends between the number of porpoise detections and the phases of the tide. Check it out!

reef3_clicks

Now, I won’t promise that I’ll be an excellent coder by the end of the winter, but I think I might have a good chance at being able to mark the “proficient” box next to Matlab and R on my first job application. Yet, whatever your reason for learning code – whether you are an undergraduate hoping to get ahead for graduate school, a graduate student hoping to escape the inevitable (like me), or just someone who thinks getting a code to work properly is a fun game – my advice to you is this:

Google first. If that fails, take mental breaks. Revisit the problem later. Think through all possible sources of error. Ask around for help. Then, when you finally fix the bug or get the code to work the way you would like it to, throw a mini-party. After it’s all over, take a deep breath and go again. Remember, you are not alone!

Happy coding this winter GEMM Lab readers – and I wish you lots of celebratory dancing!

Following Tracks: A Summer of Research in Quantitative Ecology

**GUEST POST** written by Irina Tolkova from the University of Washington.

R, a programming language and software for statistical analysis, gives me an error message.

I mull it over. Revise my code. Run it again.

Hey, look! Two error messages.

I’m Irina, and I’m working on summer research in quantitative ecology with Dr. Leigh Torres in the GEMM Lab. Ironically, as much as I’m interested in the environment and the life inhabiting it, my background is actually in applied math, and a bit in computer science.

vl-dsc04212

(Also, my background is the sand dunes of Florence, OR, which are downright amazing.)

When I mention this in the context of marine research, I usually get a surprised look. But from firsthand experience, the mindsets and skills developed in those areas can actually be very useful for ecology. This is partly because both math and computer science develop a problem-solving approach that can apply to many interdisciplinary contexts, and partly because ecology itself is becoming increasingly influenced by technology.

Personally, I’m fascinated by the advancement in environmentally-oriented sensors and trackers, and admire the inventors’ cleverness in the way they extract useful information. I’ve heard about projects with unmanned ocean gliders that fly through the water, taking conductivity, temperature, depth measurements (Seaglider project by APL at the University of Washington), which can be used for oceanographic mapping. Arrays of hydrophones along the coast detect and recognize marine mammals through bioacoustics (OSU Animal Bioacoustics Lab), allowing for analysis of their population distributions and potentially movement. In the GEMM lab, I learned about light and small GPS loggers, which can be put on wildlife to learn about their movement, and even smaller lighter ones that determine the animal’s general position using the time of sunset and sunrise. Finally, scientists even made artificial nest mounds which hid a scale for recording the weight of breeding birds — looking at the data, I could see a distinctive sawtooth pattern, since the birds lost weight as they incubated the egg, and gained weight after coming home from a foraging trip…

On the whole, I’m really hopeful for the ecological opportunities opened up by technology. But the information coming in from sensors can be both a blessing and a curse, because — unlike manually collected data — the sample sizes tend to be massive. For statistical analysis, this is great! For actually working with the data… more difficult. For my project, this trade-off shows as R and Excel crash over the hundreds of thousands of points in my dataset… what dataset, you might ask? Albatross GPS tracking data.

In 2011, 2012, and 2013, a group of scientists (including Dr. Leigh!) tagged grey-headed albatrosses at Campbell Island, New Zealand, with small GPS loggers. This was done in the summer months, when the birds were breeding, so the GPS tracks represent the birds’ flights as they incubated and raised their chicks. A cool fact about albatrosses: they only raise one chick at a time! As a result, the survival of the population is very dependent on chick survival, which means that the health of the albatrosses during the breeding season, and in part their ability to find food, is critical for the population’s sustainability. So, my research question is: what environmental variables determine where these albatrosses choose to forage?

The project naturally breaks up into two main parts.

  • How can we quantify this “foraging effort” over a trajectory?
  • What is the statistical relationship between this “foraging effort metric” and environmental variables?

Luckily, R is pretty good for both data manipulation and statistical analysis, and that’s what I’m working on now. I’ve just about finished part (1), and will be moving on to part (2) in the coming week. For a start, here are some color-coded plots showing two different ways of measuring the “foraging value” over one GPS track:

track89518

Most of my time goes into writing code, and, of course, debugging. This might sound a bit dull, but the anticipation of new results, graphs, and questions is definitely worth it. Occasionally, that anticipation is met with a result or plot that I wasn’t quite expecting. For example, I was recently attempting to draw the predicted spatial distribution of an albatross population. I fixed some bugs. The code ran. A plot window opened up. And showed this:

pretty_circles

I stared at my laptop for a moment, closed it, and got some hot tea from the lab’s electronic kettle, all the while wondering how R came up with this abstract art.

All in all, while I spend most of my time programming, my motivation comes from the wildlife I hope to work for. And as any other ecologist, I love being out there on the Oregon coast, with the sun, the rain, sand, waves, valleys and mountains, cliff swallows and grey whales, and the rest of our fantastic wild outdoors.

SONY DSC

Irina5