geoschem / integrated_methane_inversion

Integrated Methane Inversion workflow repository.
https://imi.readthedocs.org
MIT License
25 stars 19 forks source link

[bug] Perturbation factors not applied to Jacobian simulations in `feature/global_inversion` branch #183

Closed eastjames closed 4 months ago

eastjames commented 6 months ago

Perturbation factors aren't applied to global Jacobian simulations. In src/components/jacobian_component/jacobian.sh, the Jacobian geoschem_config.yml files are edited with sed to apply the perturbation factors, but the command refers to emission_perturbation while geoschem_config.yml has emission_perturbation_factor. As a result, perturbation factors aren't applied.

Here are the lines to change:

https://github.com/geoschem/integrated_methane_inversion/blob/c3aa27366bad9fe55efc7c2f2e0d94e9c29ed1d2/src/components/jacobian_component/jacobian.sh#L95-L99

They can be replaced with

 # Update settings in geoschem_config.yml except for the base run 
    if [ $x -ne 0 ]; then 
     sed -i -e "s|emission_perturbation_factor: 1.0|emission_perturbation_factor: ${PerturbValue}|g" \ 
            -e "s|state_vector_element_number: 0|state_vector_element_number: ${xUSE}|g" geoschem_config.yml 
    fi 
laestrada commented 6 months ago

Hi @eastjames,

I believe that this is just because the feature/global_inversion branch hasn't been synced with dev in quite a while. I suspect running git merge origin/dev in that branch would update the sed command.

also tagging @msulprizio

eastjames commented 6 months ago

Ok, thanks Lucas!

ltmurray commented 6 months ago

I just ran into this problem in the main branch as well.

laestrada commented 6 months ago

Hi @ltmurray,

The underlying issue is likely due to your GCClassic version. The main branch of the IMI (version 1.2.1) assumes that you are using GCClassic v14.0.2. v14.0.2 has the perturbation variable in geoschem_config.yml set by emission_perturbation. This variable got renamed in GCClassic v14.2.1 to emission_perturbation_factor.

There are a few other changes related to the GCClassic version. I recommend either using the main branch with v14.0.2 or switching to our dev branch for IMI 2.0 (the dev branch code is relatively mature at this point). In dev the IMI automatically downloads the correct GCClassic version/ checks that the correct version is installed (Now using v14.2.3).

Let me know if you run into additional issues!

-- Lucas

msulprizio commented 4 months ago

The feature/global_inversion branch has now been merged into dev and this issue should now be resolved. Please let us know if you continue to have problems.