In the middle of the season's first northeaster Sunday morning, only two of the 16 American Airlines flights scheduled to leave from Logan International Airport took to the skies. Why did those two planes - one to London, the other to St. Thomas - fly amid swirling snow while the others were canceled? For airlines, it's a complex decision-making process that goes beyond simply keeping planes out of the path of nasty weather. The chess game begins days before a storm hits and takes into account where the plane came from, where it's heading next, how many passengers onboard have connections, and where the flight crew needs to be, among other factors. American's two international flights departing from Logan on Sunday morning, for instance, took off while flights to Miami and San Francisco were grounded - and none of these destinations were affected by the storm. But canceling the larger international flights would have affected a lot of passengers, including those on the connecting flights each plane was scheduled to fly to after stopping in London and St. Thomas. 'It's a lesser of two evils,' said Ralph Lopez, general manager for American Airlines at Logan. On the surface, though, some cancellations don't make much sense. American nixed a flight from Dallas that would have landed in Boston at 6 p.m. on Saturday, long before it started snowing. But if the aircraft had flown in and gotten stuck in Boston, it would have caused even more cancellations at airports the plane was scheduled to fly into the next day. 'We link the airplanes together,' Lopez said. 'It's like a puzzle.' Markets with multiple daily flights are more likely to be canceled because passengers can easily be rebooked; planes due for maintenance, on the other hand, are more likely to stay on track. If a JetBlue aircraft is scheduled for a brake job, said Joe Bertapelle, director of system operations for the airline, the plane has to be sent to an airport with a properly trained mechanic. Of course, the weather at each airport plays a big part in deciding which planes are allowed to fly. Storms lead to decreased visibility, which means less air space for planes to fly in. Not only that, de-icing an aircraft can delay a flight by 20 minutes, and if there's a backup on the runway, planes may have to come back to get de-iced again. Better to cancel a few of the flights right off the bat than let the schedule slowly fall apart. 'If you proactively tear the schedule down, it comes back to life in a much more controlled manner,' Bertapelle said. At Logan, about 50 of the 700 arrivals and departures were canceled on Saturday, many of them coming from Washington, Baltimore, and Philadelphia, where the storm dumped up to 2 feet of snow. On Sunday, half of the 800 flights were canceled before 10 inches fell at Logan. By that afternoon, operations had nearly returned to normal at Logan - helped along by the initial Saturday cancellations. Only one-quarter of the airplanes that normally park at the airport overnight flew in, which made it easier to clear away the snow, said Edward Freni, the director of aviation for the Massachusetts Port Authority, which operates Logan. Rebooking passengers is especially tricky during the busy holiday travel season, however, when some planes are flying above 80 percent capacity. If an airline doesn't have room to rebook canceled passengers in a timely manner, it may rebook them on partner carriers or schedule additional flights. Sometimes, passengers don't mind having their flights canceled - as long as they're given fair warning and not left stranded at an airport. Noelle Johnson, 39, of Rochester, and her two sons were supposed to fly into Boston from Baltimore on Sunday after visiting family, but Johnson checked online in advance and found out their flight had been canceled. They flew out Monday, and the extra day with Johnson's family was fine by her. 'That was the best Christmas present of all,' she said. The key to keeping the schedule running as smoothly as possible is getting a headstart, airline officials say, even though it's a bit of a gamble to start rebooking passengers before the first flake hits the ground. The process involves a lot of 'bobbing and weaving,' said Bob Cordes, vice president of operations planning and performance for American Airlines. 'I can't say that I've had the same exact scenario twice in my career.' And the decisions have to be made rapidly. 'What takes JetBlue months and months to plan, we have to tear down and reschedule in 24 hours,' Bertapelle said. And unfortunately, he added, 'There is no magic button.' But the system for canceling flights has become more sophisticated in recent years, with computer programs that can calculate which flights and crews will be least affected. Some airlines now have tools that rebook passengers automatically and send out messages via e-mail and cellphones. Another system automatically reconfigures the crews' schedules, a process done by hand until a few years ago. New Department of Transportation regulations will lead to even more flight cancellations, said Peter Belobaba, director of the Massachusetts Institute of Technology's Global Airline Industry Program. Under the new rules, airlines can't keep passengers on the tarmac for more than three hours, which may prompt some carriers to cancel flights rather than face a steep fine. But airlines are used to dealing with adversity. As Belobaba likes to tell his students: 'It's like a Broadway play that you've practiced and practiced for months, and something always goes wrong.' Katie Johnston Chase can be reached at johnstonchase@globe.com. Globe correspondent Sean Teehan contributed to this report. 