Claudius Ptolemy was the author of the famous Almagest, a compendium of astronomical observations and calculations that remained the main reference work on the subject for the best part of 1,500 years. Unfortunately this great work has serious flaws that have been picked over by historians of astronomy, who argue about whether they represent mere errors in Ptolemy's observations or, much worse, in the methods he used. A red flag was raised in the 16th century by that great observational astronomer Tycho Brahe, who had no quibble with the earth-based system in the Almagest, but found it unreliable and pursued his own methods.
Ptolemy lived in Egypt around AD 85-165 and the name Almagest came from Islamic astronomers, who combined the Arabic prefix "al" with the adjective of the Greek title, Megistē Syntaxis (greatest compendium). It was a beautifully written work, whose observations and methods held sway until the earth-based model of the universe that it propounded was overtaken by the solar-based model that emerged from the work of Copernicus, and later Kepler. So famous was its author that medieval artists portrayed him with a crown on his head, confusing him with being a member of the Greek Ptolemaic dynasty that ruled Egypt after the conquests of Alexander the Great. Being a brilliant expositor, he also wrote a popular account of his great Syntaxis, as well as serious work on optics and on geography, which was still used in relatively modern times by travellers attempting to circumnavigate the globe.
Little is known of Ptolemy's life, but we do know something of his astronomical antecedents. In the Bible we read of famous Chaldean astronomers, now known as Babylonians, whose careful observations over hundreds of years paved the way for their method of eclipse prediction, using what the Greeks later called Saros cycles. There are about 40 of these cycles in operation at any one time, and they are still used today and appear on the NASA website.
The Babylonian achievements were the greatest in the pre-Hellenistic world, and the Greeks naturally became avid students of their astronomy. They themselves made further advances, the greatest being a discovery about the length of a year. Hipparchos of Rhodes, who lived in the second century BC, showed that the period measured by the sun's progress around the zodiac, which is the same as the earth's orbit around the sun, is different from the length of the seasonal year. The small but significant difference, about 20 minutes a year, is called the "precession of the equinoxes", and is due to the fact that as the earth rotates, its axis precesses like a top. It is vital for accurate astronomical predictions, and a full precession, which takes about 26,000 years, is an important ingredient in the Milankovitch cycles that influence climate change.
Hipparchos was clearly a first-rate observational astronomer and seems to have been a geometer of the first rank. A result on quadrilaterals whose corners lie on a circle, known as Ptolemy's Theorem, is almost certainly due to him, and he led the development of what we now call trigonometry. Unfortunately we know of his work almost exclusively through the Almagest, and although Ptolemy refers to him with the respect due to a very distinguished contemporary, their work was separated by nearly three centuries.
During the intervening period the precession of the equinoxes meant that some of Hipparchos's observations needed updating, and a major complaint against Ptolemy was that he may have used and miscorrected them for precession, rather than make new observations of his own. Certainly he made an error in the length of the seasonal year, and Tycho Brahe pointed out a consistent error in the longitude of stars given in Ptolemy's catalogue. More than a century later, the renowned French astronomer Delambre made pointed criticisms of Ptolemy's work, saying that although the errors might have come in a complicated way from original data by Hipparchos, "One could explain everything in a less favourable but all the simpler manner by denying Ptolemy the observation of the stars and equinoxes, and by claiming that he assimilated everything from Hipparchos, using the minimal value of the latter for the precession motion."
The most pungent criticism came in the 20th century from Robert Russell Newton, who in 1977 published The Crime of Claudius Ptolemy, in which he states: "[Ptolemy] developed certain astronomical theories and discovered that they were not consistent with observation. Instead of abandoning the theories, he deliberately fabricated observations from [them]." Certainly the work of Tycho Brahe and Delambre shows that the errors were not random, though Newton's claim of a crime may be unfairly using modern notions of scientific fidelity to judge the ancient world. Newton's trenchant criticisms, implying that Ptolemy's errors had a terrible effect on scientific progress, have caused some scholars to row back in his defence, but the main point must be that in true scientific inquiry the observations come first, the theory later.