A Method to Study the Atmospheric Influence on the Isotopic Composition of Primary Cosmic Rays Applied to the Elements Carbon and Oxygen