This library provides the implementation of a fully-differentiable atmosphere transport model called pyATM, which encoded the partial differential equations (PDEs) solver into a computational graph based on a deep learning framework pytorch. The code is applied to our paper An Automatic Differentiation Method for Surface Carbon Flux Inversion.
The atmospheric transport model used in the inversion problem can be expressed as
The equation describes the evolution of the carbon concentration field
The Merra2 meteorological data used in this article can be accessed in this repo, which needs to be downloaded and unzip into the ./data/ folder.
Using the PyATM, we can run the atmospheric transport model, or to solve the inversion problem by automatic differentiation.
The forward simulation can be run using the script"
./script/twin_forward.sh
python main.py \
--year 2019 \
--month 7 \
--day 1 \
--last_day 7 \
--interval_minutes 30 \
--device "cpu" \
--if_mixing_str "True" \
--sim_dimension 2 \
--layer_type "layer_1" \
--if_plot_result_str "True" \
--plot_interval 1 \
--data_folder './data/' \
--sub_data_folder "201907" \
--result_folder './result/twin_forward/' \
--geoschem_co2_file "GEOSChem.SpeciesConc.20190701_0000z.nc4" \
--flux_type "carbon_tracker" \
--flux_file_name "monthly_flux_np/CT2019B.flux1x1.201807_reshape.npy" \
--cinit_type "geos-chem" \
--problem_type "forward_simulation" \
--experiment_type "twin" \
--obs_type "full"
The inversion problem can be run using the script:
./script/twin_inversion.sh
python main.py \
--year 2019 \
--month 7 \
--day 1 \
--last_day 7 \
--interval_minutes 30 \
--device "cpu" \
--if_mixing_str "True" \
--sim_dimension 2 \
--layer_type "layer_1" \
--if_plot_result_str "True" \
--plot_interval 1 \
--data_folder './data/' \
--sub_data_folder "201907" \
--result_folder './result/twin_inversion/' \
--geoschem_co2_file "GEOSChem.SpeciesConc.20190701_0000z.nc4" \
--flux_type "carbon_tracker" \
--flux_file_name "monthly_flux_np/CT2019B.flux1x1.201807_reshape.npy" \
--cinit_type "geos-chem" \
--problem_type "inversion" \
--experiment_type "twin" \
--obs_type "full" \
--flux_type_inversion "init_constant" \
--iteration_number 300 \
--early_stop_value 0.1e-10 \
--lr_flux 1e-5