Simultaneous use of partial differential equations in conjunction with data analysis has proven to be an efficient way to obtain the main parameters of various phenomena in different areas, such as medical, biological, and ecological. In the ecological field, the study of climate change (including global warming) over the past centuries requires estimating different gas concentrations in the atmosphere, mainly CO2. The mathematical model of gas trapping in deep polar ice (firns) consists of a parabolic partial differential equation that is almost degenerate at one boundary extreme. In this paper, we consider all the coefficients to be constants, except the diffusion coefficient that is to be reconstructed. We present the theoretical aspects of existence and uniqueness for such direct problem and build a robust simulation algorithm. Consequently, we formulate the inverse problem that attempts to recover the diffusion coefficients using given generated data, by defining an objective function to be minimized. An algorithm for computing the gradient of the objective function is proposed and its efficiency is tested using different minimization techniques available in MATLAB's optimization toolbox.