"We don't know much about their structure, how strong they are, their minerology. If we were ever to have to deflect an asteroid, we would want to know these things," says a NASA official.

An asteroid large enough to wreak continent-wide devastation will pass by the Earth. On Halloween.

Astronomers could not be happier about it.

Andrzej Wojcicki | Getty Images

Rendering of an asteroid. NASA will be monitory an asteroid that is set to pass Earth on Halloween.

Nicknamed "The Great Pumpkin" by NASA, the asteroid formally known as 2015 TB145 will provide scientists with needed knowledge of asteroids — valuable both for the sake of science, as well as knowing how to deflect one if it were ever headed straight for Earth.

"We need to know more about asteroids," said Paul Chodas, manager of the Center for Near Earth Object Studies at NASA's Jet Propulsion Laboratory in Pasadena, California. "We don't know much about their structure, how strong they are, their minerology. If we were ever to have to deflect an asteroid, we would want to know these things."

At its closest point it will be about 300,000 miles from Earth — slightly further out than the moon — which "astronomically is a pretty close passage," Chodas told CNBC.

It will not be close enough to see with the naked eye, but observers with a small telescope will be able to see it if they know where to look. Because it's so close, it will look like a very bright star in the night sky.

The asteroid is about 1,300 feet in diameter (400 meters) and is hurtling through space at about 22 miles per second. It has an unusual, egg-shaped orbit, and it's on a plane very different from the rest of the solar system. Those characteristics have led scientists to wonder if it's a comet. That unusual orbit also made the asteroid more difficult to detect.

Astronomers at the Goldstone Deep Space Communications Complex in Fort Irwin, California, will bounce radio waves off the asteroid, and researchers at other NASA facilities will collect radar data.

"We will see shape, surface, details, we will see whether it has a moon going around it," Chodas said. (Yes, asteroids can have their own moons.)

Whereas NASA, the European Space Agency and others have previously sent up spacecraft to study asteroids, "we get a freebie encounter to study this one with ground equipment," he said.

There are roughly 10,000 asteroids of TB145's size or larger flying within 30 million miles of Earth. NASA and other agencies have identified about half of those. About 1,000 near-Earth asteroids are a kilometer or larger in diameter, and NASA and other agencies believe they have identified most of those.

If an asteroid a kilometer wide or more struck Earth, it would cause a global catastrophe, Chodas said. "They come in with so much energy, it would create a huge crater, and have all kinds of effects on the climate and environment."

Chodas added that NASA has studies underway to determine how to deflect an asteroid on a collision course with Earth.