So you have a whale. A whale that beached itself and died or died then became beached—doesn’t matter, it’s dead. And now it’s under the sun swelling into a hot mess of bacteria. So how exactly do you get rid of 80,000 pounds of rotting flesh? That is the dilemma officials at San Onofre State Beach found themselves in when a dead whale washed up on the popular surfing spot near San Diego last week.

What you don’t do, despite a certain viral video, is blow it up. (A sizable chunk of whale nearly destroyed a nearby car when the Oregon Highway Division tried that in 1970.) Since 1992, law has it that all stranded mammals are the responsibility of National Oceanic and Atmospheric Administration. So NOAA has a network of offices along the coasts that takes cetacean SOS’s from the coast guard, navy, fishermen, and occasionally a very concerned homeowner. It gets about 1,200 strandings per year, including whales, dolphins, and porpoises.

The first thing NOAA does, if it can, is take scientific samples. While you and I and that homeowner might not like 40 tons of dead whale showing up the local beach, to marine biologists they are scientific goldmines. Whales spend their whole lives in the ocean, and most of us are lucky to get a few glimpses from far away. “All of a sudden you have one and it’s like having a space alien you can examine and learn something about,” says Joe Gaydos, director of the SeaDoc Society, who has done many a whale necropsy.

So whale biologists might take their scalpels—as well as their meat hooks and flensing knives, a long blade leftover from the whaling industry—to these dead whales. They collect tissue samples and bones and debris found in the stomach. When they’re done, they might have some 100 pounds of samples to take back to the lab or museum.

Burial By Sea or By Land

OK, but what happens to the other 79,900 pounds, give or take, of decomposing whale? That depends on where it is. The easiest thing is do is nothing. If the whale made landfall in an area remote enough—and in California, that was true of the majority of cases last year—NOAA will leave it to nature. “The carcasses for a homeowner, it’s like Nightmare on Elm Street, but for animals, it’s like manna on Earth,” says Gaydos. How long a whale takes to fully decompose depends on where it is and what creatures are around to eat it. Even in Alaska, where bears come to feast on whale flesh, the process may take months.

Don Kelsen/Getty Images

That’s way too slow if the dead whale is anywhere near civilization because of the smell alone. “It’s an oily dead smell,” says Gaydos. “It can stick to you. My kids will be like, ‘You were at a necropsy’ and I’d be like, ‘Really? I’ve taken a shower.’” Luckily, you have a few other options.

In some cases, a boat can tow the whale back to sea. NOAA analyzes ocean currents to make sure the whale won’t just float back to a beach again, but sometimes it still happens. This is expensive—running to several thousand dollars, according to Justin Greenman, NOAA’s assistant regional stranding manager in California—and the unlucky landowner gets stuck with the bill.

Another option is to bury it right on the beach. That means bringing in an earthmover to dig a hole two stories deep, so the whale is safely entombed under at least 10 feet of sand. Officials have buried whales stranded on San Francisco’s Ocean Beach this way.

By Scalpel and By Flensing Knife

But the whale at San Onofre State Beach was too badly decomposed to pull off the beach into the water in one piece. Surfers feared even a buried whale would attract sharks. So that meant the most grisly option: Cutting the whale into pieces and hauling it to the landfill piece by piece.

“Butchering” might sound like indiscriminate hacking, but butchering a whale can be delicate work. Like breaking down a cow, it involves intimate knowledge of the bones and ligaments that hold everything together. The team uses big long flensing knives but also scalpels. To cut the base of the skull from the neck, for example, you just have find the piece of connective tissue that keeps them together. The real challenge is that whales are so big, the blades dull quickly. “You basically have to have a entire team sharpening blades as you go along,” Greenman says.

Once the whale at San Onofre State Beach came apart, an excavator, a backhoe, and three dump trucks were waiting for haul it away. (Greenman was not involved in removing this whale, though NOAA did send another contractor.) Charlie Perrault, owner of the trucking company that provided the heavy machinery, says he’s never hauled a whale before, but he has done other nasty jobs. “It’s comparable to hauling chicken manure. It smelled just as bad.” Some of the team Vick’s Vapor Rub to cover the smell.

And that is how you get rid of beached whale. One more thing: Don’t even think about keeping a souvenir. Thanks to laws like the Marine Mammal Protection Act, National Marine Fisheries Service, that’s illegal without express permission from NOAA.