From Trial to Triumph: Learning to Code at SkyTruth

When I was brought on to intern at SkyTruth, I was presented by one of our analysts, Ry Covington, with a rather open-ended challenge: “Here at SkyTruth, we want our internships to be a learning experience first and foremost. With that said, you can learn almost anything you want while working here. Think about your main goals, what you hope to get out of these next few months and let me know so that we can decide together how best to help you achieve your goal.” This isn’t verbatim, but it hits the mark in regards to the message he was conveying. I already knew the answer to this question, because it was something that I had thought about even before I started at SkyTruth: I had a strong desire to learn programming, especially as it pertains to the field of geospatial analysis. Now mind you, this is coming from someone who is brand new to programming in any respect. I had one class in C++ my sophomore year of college and all of that information has since slipped my mind, as most unimportant (or at least I regarded it as unimportant at the time) college course material does. I also had attempted to teach myself Python the summer before I started at SkyTruth while rehabilitating a nasty toe fracture, but that information didn’t quite encapsulate what I hoped to achieve with coding. I only knew the foundational pieces of what it means to communicate with a computer through coding, such as iterators, variables, and Boolean operators.

Around a month or so into the internship I received my opportunity to work towards my goal. Ry had a project he was doing with the Heinz Foundation that involved creating a map which detailed potential well pad sites in Allegheny County, PA (to see my blog post detailing the final results of this study, follow this link). We worked out a research approach and came up with a plan to map out these locations that seemed logical to both of us. Great. Now here’s an idea: let’s take all of those things that we want to incorporate into this project and write that into a Google Earth Engine (EE) script. On top of that, let’s also publish an app which uses this same Earth Engine script. These suggestions made by Ry seemed fine and well, until the moment where he delegated the task of writing this script unto me. In his words, “It’s a steep learning curve, but you’re a smart guy. You’ll figure it out!” He left the room as he was making this statement, leaving me stunned like a deer in headlights. Yes I wanted to learn to program, but this seemed excessive! After a few moments of processing, I collected myself and turned to the most trustworthy source of them all for guidance: Google Search. Looking up “Google Earth Engine tutorial” led me to a website which detailed the functions which you can use to make neat little UI plugins in your EE code. After a day of playing with them and applying some of the sample code they offered, I figured out how to display the elements of interest on the map. Following this discovery, I excitedly called to Ry to come and look at what I had made. He took one look at what I had done and said, “Good job Brendan, that’s an excellent start. Keep going.” Wait, this wasn’t what I was trying to get? It was an excellent start, which meant I was nowhere near the end. So it was time to expand my search for information.


An example of the guides found on Google’s official Earth Engine site.

At Ry’s suggestion, I looked at the code that one of SkyTruth’s other analysts, Christian Thomas, had written in EE for global ocean monitoring. This turned out to be an invaluable source of information for me but it was intimidating at first glance. The script itself is composed of over 500 lines of intensely in-depth code that made no sense to me whatsoever. On more than one occasion, I found myself becoming lost in the script’s intricacies while trying to find answers to my own predicament. Nevertheless, I remained determined to figure out how to compose my script, so I proceeded forward with the examples Christian’s code offered me. My program would involve creating a panel on which I’d load on a few buttons with different unique functions that built off of each other to display different text and layers on the panel and the map, respectively. Needless to say, my first few stabs at all of this led me to fall flat on my face. I could create the buttons that I wanted, but I couldn’t for the life of me figure out how to put the buttons on the side panel that I’d made. I spent roughly two weeks trying to get over this hurdle.

It was nice to have the encouragement of my mentors to keep me motivated to seek the answer to this question. Without Christian and Ry’s calm demeanors and calculated approach to solving these programming issues, I probably would’ve lost hope quickly. Days of work would go by and I’d spend a lot of time carefully combing through my code trying to discover the answer to my plight. Even when I was at home at night, I’d think about ways I could get to the result I desired. Then one day, all at once, it hit me. It was like the roadblock in my mind was slammed into by a Mack truck and just like that I figured out how to get the buttons to display on the side panel. To describe the feeling as a whole is difficult, but I think I could compare it to the way I felt as a little kid on Christmas morning when I rushed down the stairs and saw presents underneath the Christmas tree. I jumped up out of my seat, did some silent yelling, and added in a few fist pumps for good measure. I was elated! The cool part about it was that once I broke through that wall, it was like the rest came naturally. My fingers fluttered across my keyboard as I coded exactly what I had in mind for this project. Before I knew it I had an EE script that was logical and effective. I remember when Ry and Christian first looked at my latest script and they had nothing but good things to say about what I had accomplished. That positivity made me feel great; it was a huge payoff after a great deal of tribulation. I had finally done it!

A screenshot from my finished app.

Now that I reflect on the path I followed to create this code, I’m astounded by how much I learned. I learned more in those few chaotic weeks than I would typically learn over the course of a semester long college course! It was a chaos that you can’t quite replicate in the classroom because there aren’t people depending on you when you’re doing homework or taking a test. The urgency to make your product the finest ever conceived is palpable. You do the best that you can for your coworkers, who end up being more like your friends here at SkyTruth. I think that hits the nail on the head when considering the mission of SkyTruth overall; we’re all here to provide information for others so that they can do meaningful work in defending our precious environment. Every task you work on here could have an effect on your world, so you do everything you can to give every project your all. I definitely got way more than I bargained for when I said that I wanted to learn to program at SkyTruth. Despite that, I couldn’t be more satisfied with the work I was able to do over my first few months here.

If you would like to view my completed app, please click here!

Tracking the Chinese Squid Fleet in the South Pacific – Part 2: A City on the High Seas

Nighttime surveillance of the squid fleet from the bridge of the Brigitte Bardot. Photo by Simon Ager/ Sea Shepherd

Continued from Part 1: Voyage to the Galapagos.

As the Brigitte Bardot steamed west from the Galapagos we considered the sheer number of people we could expect to encounter when we reached this densely clustered fishing fleet 700 miles out to sea. The scale of fishing on the high seas has always been largely invisible to the seafood consuming public but our satellite tracking sources indicated an operation of truly remarkable size. From Automatic Identification System (AIS) data and radar we knew we were approaching a fleet of around 300 ships. These would be not only fishing vessels but a whole network of support vessels for refueling and transshipping catch from the fleet, as well as providing for an estimated 6,000 crewmen who would be at sea for several months at a time.

On the high seas in areas beyond national jurisdiction regulations are few and what oversight of fishing operations exists depends on Regional Fisheries Management Organizations (RFMOs). These RFMOs are established by international treaties to monitor and regulate fishing of particular species, although only some countries are signatories and there is a limited capacity for monitoring vast areas of open ocean. The region of the Eastern Pacific to which we were headed falls at the northern end of the area regulated by the South Pacific Regional Fisheries Management Organization (SPRFMO). The SPRFMO regulates fishing of non-tuna species and publishes a list of vessels authorized to fish in the area. However, beyond requiring countries to register their vessels and collecting the catch data they submit, no limits are set on squid catches.

We had our last sight of San Lorenzo Island the evening of September 19th and as we headed west into the open Pacific we expected a return of the rough weather we had seen on the voyage out. But by the next morning the seas were strangely still with fog obscuring our view much distance from the vessel. I sat below in the galley rechecking the latest set of AIS transmissions from the fleet against the SPRFMO’s authorization list. How a vessel is identified in the AIS system depends entirely on the information the vessel’s captain decides to input into his transmitter. Some operators conscientiously broadcast their full vessel name, callsign, International Maritime Organization (IMO) number, and flag. Others broadcast incomplete or outdated information via AIS and more than a few vessels give no identification at all or broadcast names that appear scrambled or don’t identify the vessel (“._NGDAYANG29” and “PS1” for instance). As a result, I had the challenge of trying to decipher as many of these vessel identifications as possible to determine if they were authorized to fish in the area.

SkyTruth Analyst Bjorn Bergman checking satellite AIS data for tracking the squid fleet. Photo by Simon Ager/ Sea Shepherd

In the afternoon I went up to the wheelhouse to stand watch. We continued through the fog, the Brigitte Bardot barely rocking on the calm seas. Jack, the Brigitte Bardot’s drone pilot taking a break from an action-packed stint on Sea Shepherd’s Milagro campaign in Mexico, explained the ship’s radar to me. We were limited in range by the relatively low height of the mast but our radar system had some useful options for locking and tracking targets and with a few adjustments we could even see the edge of an advancing rain front. But when Chris, the Brigitte Bardot‘s captain, joined us a few hours later there were still no blips on the radar screen. For the moment we appeared to have this vast stretch of the Pacific entirely to ourselves.

Alex and Stefan on watch on the bridge of the Brigitte Bardot. Photo by Simon Ager/ Sea Shepherd

Despite the lack of vessels in the vicinity we expected to soon be reaching the edge of a huge fishing fleet and we needed to settle on a strategy. If there was illegal activity we would need to collect evidence before news of our arrival spread by radio through the fleet. I shared a list of potential targets with Chris and Jack. Unsatisfyingly all were ambiguous cases, vessels that didn’t give enough information in their AIS broadcasts for us to determine if they were SPRFMO authorized. We’d initially thought we’d have some clearly identified vessels that weren’t authorized to fish and had planned to arrive after nightfall (when squid fishing occurs) and collect evidence with a night vision camera. However with only ambiguous unidentified vessels as targets it made sense to arrive at the fleet during daylight hours when it would still be possible to easily read names and numbers painted on the vessel hull.

Chris called up the ship’s engineer Stefan. We could speed up to arrive at the fleet with a few hours of daylight but as Stefan explained this would be a trade-off with the extra fuel we burned ultimately limiting the ship’s range for this operation. After a brief discussion Stefan turned up the RPM on the Brigitte Bardot’s twin engines.

The calm weather continued through the next day as we sped west. Eloy, a Peruvian researcher who was finishing his thesis on tracking this fleet, sat out on deck reading through journal articles. If we had had any doubt that we were in squid fishing grounds this would have been dispelled by the dozens of squid which somehow made it onto the deck every night, when as Eloy explained, they rose to the surface to feed and possibly were attracted to the lights on the Brigitte Bardot. In fact this attraction to light is a critical part of squid fishing operations with the industrial fleet deploying lights on a massive scale to lure the squid in.

With the Brigitte Bardot’s crew gathered in the wheelhouse later in the afternoon there was a building sense of anticipation. The first vessel had appeared on the radar to the west an hour before and was quickly joined by half a dozen others. I checked these against satellite AIS, doing my best to guide the Brigitte Bardot towards a squid vessel broadcasting only the callsign BZZ5K, a callsign not registered to any vessel authorized to take squid. As we approached this first target Jack and Stefan passed back and forth a ridiculously large pair of pair of binoculars. Then on the port side the first vessel came into view.

Chris and Jack survey the approaching fleet from the Brigitte Bardot’s bridge. Photo by Simon Ager/ Sea Shepherd

Rust and soot on the hull seemed to obscure any identifying markings. Squid jigging gear projected out from either side below strings of giant bare bulbs hanging like oversized Christmas tree lights. A Chinese flag flew above the wheelhouse and at the stern of the vessel what appeared to be a tattered black sail. But on board all was quiet with a sea anchor keeping the vessel in place as the crew apparently waited below for the onset of nighttime fishing operations. This vessel was broadcasting AIS and we could faintly make out its name, which was on the SPRFMO authorization list, so we continued past it toward our target.

The Chinese flagged squid vessel Hai Yang 5. Photo by Simon Ager/ Sea Shepherd

Reaching this first target, broadcasting callsign BZZ5K, was immediately anticlimactic. We could see a name and different callsign clearly painted on the hull, Hua Ying 819 with callsign BZV9K, an authorized vessel. The reason for the incorrect callsign on AIS was unclear but entirely legal since there are no regulations mandating correct identification on AIS. This is a frustrating situation for advocates of fisheries transparency since AIS is usually the only source of information the public has for tracking fleets out at sea. A simple requirement from flag states and authorities like the SPRFMO that vessels broadcasting AIS identify themselves correctly and broadcast continuously while operating, would dramatically improve the public’s ability to reliably monitor fleets on the high seas which are extracting a common global resource.

We sped on hoping to check a few more target vessels before dark. The fleet was now all around us, dozens of mostly still vessels extending out to the edge of radar reception. We’d expected that the arrival of the Brigitte Bardot would set off a flurry of chatter on the radio but the fleet was strangely silent as we set the radio to scan for broadcasts. We passed close to some vessels comparing their broadcast ID to identification painted on the hull and checking their authorization on the SPRFMO list. Once we noticed a few flashes of light through our wheelhouse’s starboard windows. Had someone tried to signal us with a mirror? Glancing back all seemed still on the boat we had passed.

We had soon spent the few hours of daylight we had gained by speeding westward. Though we’d managed to check off a number of the vessels with ambiguous AIS IDs on my target list we were finding that they all checked out once we were able to get identification from the vessel’s hull. As the sun sank below the horizon we halted to reassess the situation. So far just tracking down boats with bad AIS identification was not turning up any illegal activity. How about identifying vessels with no AIS broadcast at all? Consulting with Chris we decided to make a loose grid through the fleet checking the AIS broadcast of each boat as we approached.

The Brigitte Bardot now proceeded slowly to conserve fuel as we prepared to survey through the night. Suddenly out of the darkness a towering intense white light showed on the horizon. Soon it was followed by others all around us, mostly white but some an iridescent green and others with dimmer yellow light. Looking out from the wheelhouse we seemed no longer to be on the open ocean but in the edge of some great coastal metropolis.

With their powerful fishing lights on the squid fleet lights up the horizon all around the Brigitte Bardot. Photo by Simon Ager/ Sea Shepherd

The ships had now come alive. Squinting against the blinding lights we could see crewmen lined up behind the protruding jigging gear on either side of the vessel. Checking the AIS broadcasts of each vessel we were frustrated by what seemed to be severely limited reception range. Often we had to approach within a mile or two of a vessel before they appeared on our navigation plotter when it ought to have been possible to pick up vessels even 10 or 20 miles out. Around midnight when we judged the fishing operation to be well underway we roused Jack from below. It was time to take a closer look at what was actually happening on board these vessels.

Chinese squid boat lights up the surrounding water attracting squid to the baited lines. Photo by Simon Ager/ Sea Shepherd

Jack launched the drone, a phantom 4 quadcopter, from the bow of the Brigitte Bardot then stared intently at his control screen as he steered the drone in towards the fishing vessel. Navigating at night guided by only the vessel’s powerful fishing lights Jack brought the drone close over the deck avoiding the mast and cables strung high above the swaying vessel. Crewmen manned baited lines extending out from the ship in all directions. A few stopped and waved at the drone as it passed overhead. At one point the foreman on deck made an exasperated shooing motion with both hands. This fleet was on record for catching exclusively squid. Could something else be going on board? Large quantities of shark reached the coast of South America, mostly from longliners, with fins then shipped back to markets in China. Were sharks also caught on these vessels? Carefully examining the footage Jack would later notice a dozen fins protruding from the water around where the squid lines reached the ocean surface. But were these sharks being caught — or just hanging out where they might get some bait? The mechanics of landing a shark with the gear being used seemed difficult and on the vessels we could observe no sharks were seen on deck or on the fishing lines.

Drone footage of a nighttime fishing operation by a Chinese squid jigger. Video by Jack Hutton/ Sea Shepherd

With the drone back on board we continued a slow survey through the fleet. Checking about 50 ships just one vessel we approached appeared not to be broadcasting AIS and all we identified had a valid authorization to fish. Eloy noted a clear distinction between vessels with strings of blinding LED lights (the total luminosity of these vessels is said to rival European soccer stadiums) and boats with somewhat dimmer yellow incandescent bulbs. We identified a number of vessels in these two categories so we could check later if this distinction also appeared in our data from NASA’s Visible Infrared Imaging Radiometer Suite (VIIRS). Hearing from Eloy that the satellite with the VIIRS instrument (NASA’s Soumi NPP) would be passing overhead at about 1:30 am, we also noted the positions of nearby vessels from the ship’s radar at precisely that time to compare with the vessel locations NOAA derived from the satellite’s imagery. I headed down for some sleep soon afterwards leaving the bridge in the hands of Simon, a professional photographer and veteran of Sea Shepherd’s Antarctic missions.

The glow of the Chinese squid fleet lights up the sky ahead of the Brigitte Bardot. Photo by Simon Ager/ Sea Shepherd

After getting a few inadequate hours of sleep I scrambled back up to the wheelhouse to look out at the fleet, now mostly quiet in the clear morning light. Jack and Chris were eager to show video captured the night before and as we looked at the latest satellite AIS data we could see one of the squid vessels alongside a reefer (refrigerated cargo ship). Was catch being transshipped just a few miles away? Today we would have a rare chance to document this activity and face a critical choice for continuing our investigation of fishing on the high seas.

To be be continued…

John Amos’ Presentation at EDF’s Science Day

Our own John Amos recently made a presentation at Environmental Defense Fund’s Science Day symposium called Satellite Remote Sensing for Environmental Protection. It’s available below and on our YouTube channel.

Video Clips of John at CBUC

Check out these standup interviews John had with Globo News when he presented at the Brazilian Congress on Protected Areas (CBUC) in August.

How can we illustrate the problem of overfishing from space?

How the Silver Sea 2 fishing vessel was caught with slaves on board

Global Fishing Watch Provides Training to Peru’s Vessel Surveillance Group

[Originally posted on the Global Fishing Watch blog, Aug. 15, 2018.]

We were very pleased to complete a three day training session this month in Lima with the Peruvian Ministry of Production’s vessel surveillance division. It was an opportunity for us to share the latest developments on the Global Fishing Watch mapping platform and to get expert feedback from professionals in Peru’s fisheries sector.

Since Peru’s public commitment in 2017 to show fishing activity from their Vessel Monitoring System (VMS) tracking data on our map we have engaged with local researchers and regulators to review and improve our data and analysis in the region. This began with a workshop with Peru’s Instituto del Mar de Peru (IMARPE) last December and now continues with Peruvian regulators directly responsible for daily monitoring of one of the world’s largest fisheries (Peruvian anchoveta).

In our most recent training session we highlighted the benefits of being able to view and compare multiple data sources on the Global Fishing Watch map including the new night lights and encounters layers launched in June this year. Many large fishing vessels on the Peruvian coast are covered both by AIS and the Peruvian VMS system. In training, we compared the tracking data from both systems for the same vessel showing how one system may cover a gap in the other.

The new night lights layer also has the potential to be very useful to regulators in combination with tracking data. A fleet of hundreds of Chinese vessels fishing for squid is expected to soon return to the Peruvian EEZ boundary. Individual fishing locations can be seen precisely due to the powerful lights they use to attract squid to the surface. However, to identify the fishing vessels, the night light information has to be combined with tracking and identity information from AIS. In training we identified a number of vessels in the Chinese squid fleet and followed their AIS tracks into port in Peru or to rendezvous with reefers (refrigerated cargo ships) where their catch is likely being transshipped.

As we work to develop new tools and data sources for the Global Fishing Watch map it’s valuable to get the insights of fisheries regulators on how they would like to be able to apply our map. So it was great to be able to wrap up the training with a discussion on features that it would be useful to enable in the future. These included being able to select an area on the map with the mouse and display a list of vessels inside and downloading reports of past activity for individual vessels as they come into port.

A special thanks to José Luis Herrera and Nilton Yarmas for coordinating the training. We also benefited greatly from the assistance of Eloy Aroni Sulca of Oceana’s Lima office who demonstrated many interesting potential applications of Global Fishing Watch in Peru. We look forward to hearing more in the future from participants in our training course and collaborating with them for successful monitoring and management of Peru’s ocean resources.