esm-tools / esm_runscripts

GNU General Public License v2.0
3 stars 5 forks source link

oasis number of transformations calculated incorrectly #154

Closed JanStreffing closed 3 years ago

JanStreffing commented 3 years ago

I want to change the coupling for AWICM3 where some field that were BICUBIC so far need to be GAUSWGT now. Before I had a mix of BICUBIC and GAUSWGT, now everything is GAUSWGT. GAUSWGT does work already, as can be seen in this working example:

R_Runoff_oce:R_Calving_oce hydr_oce:enth_oce 14 7200 2 rstas.nc EXPOUT
512 256 126858 1 RnfO feom LAG=0
P 0 P 0
SCRIPR CONSERV
GAUSWGT LR SCALAR LATITUDE 1 9 2
GLBPOS opt

For the new fields:

A_Runoff:A_Calving R_Runoff_atm:R_Calving_atm 12 7200 3 rstas.nc EXPOUT
35718 1 512 256 R080 RnfA LAG=0
P 0 P 0
SCRIPR CONSERV
GAUSWGT D SCALAR LATITUDE 1 9 2
GLBPOS opt

the number 3 in the line 1 is wrong. This should be the number of transformations in line 4. So it needs to be a 2! This 3 will crash the model, since OASIS is trying to interpret the first word from the 5th line as a transformation method as well, when it is a remapping method instead.

I think the error should originates here: https://github.com/esm-tools/esm_runscripts/blob/5b4850d2076ec00c0819114e3d1086264052ee02/esm_runscripts/oasis.py#L79-L85

Apparently seq is 3 instead of 2 for the new coupling. This is the exact same coupling btw, just different fields:

                                        - 'R_Runoff_atm:R_Calving_atm <--gauswgt_c-- A_Runoff:A_Calving'
                                        - 'hydr_oce:enth_oce <--gauswgt_c-- R_Runoff_oce:R_Calving_oce'

Any idea whats going on?

JanStreffing commented 3 years ago
+---------------------+-----------+---------------------------------------------------------+----------------------------------+----------------------------+
| package_name        | version   | file                                                    | branch                           | tags                       |
|---------------------+-----------+---------------------------------------------------------+----------------------------------+----------------------------|
| esm_calendar        | 5.0.0     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_database        | 5.0.0     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_environment     | 5.1.1     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_master          | 5.1.3     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_motd            | 5.0.2     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_parser          | 5.1.6     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_plugin_manager  | 5.0.1     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_profile         | 5.0.0     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_rcfile          | 5.1.0     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
| esm_runscripts      | 5.1.15    | /home/ollie/jstreffi/esm_runscripts                     | hotfix/write_env_and_prev_run    | v5.1.15-5-g2c1e523         |
| esm_tools           | 5.0.12    | /home/ollie/jstreffi/esm_tools                          | feature/awicm3_prep_merge_geomar | v5.0.12-300-gc921b34-dirty |
| esm_version_checker | 5.1.4     | /home/ollie/jstreffi/.local/lib/python3.7/site-packages |                                  |                            |
+---------------------+-----------+---------------------------------------------------------+----------------------------------+----------------------------+
jstreffi@ollie1:~/esm_tools$ git diff configs/setups/awicm3/awicm3.yaml
diff --git a/configs/setups/awicm3/awicm3.yaml b/configs/setups/awicm3/awicm3.yaml
index eff7e44..e56fd1b 100644
--- a/configs/setups/awicm3/awicm3.yaml
+++ b/configs/setups/awicm3/awicm3.yaml

@@ -387,10 +387,10 @@ oasis3mct:
                         coupling_target_fields:
                                 rstas.nc:
                                         - 'heat_oce:heat_swo <--bicubic_glb-- A_Qns_oce:A_Qs_all'
-                                        - 'prec_oce:snow_oce:evap_oce:subl_oce <--bicubic_glb-- A_Precip_liquid:A_Precip_solid:A_Evap:A_Subl'
+                                        - 'prec_oce:snow_oce:evap_oce:subl_oce <--gauswgt_c-- A_Precip_liquid:A_Precip_solid:A_Evap:A_Subl'
                                         - 'heat_ico <--bicubic_gss-- A_Q_ice'
                                         - 'taux_oce:tauy_oce:taux_ico:tauy_ico <--bicubic-- A_TauX_oce:A_TauY_oce:A_TauX_ice:A_TauY_ice'
-                                        - 'R_Runoff_atm:R_Calving_atm <--bicubic-- A_Runoff:A_Calving'
+                                        - 'R_Runoff_atm:R_Calving_atm <--gauswgt_c-- A_Runoff:A_Calving'
dbarbi commented 3 years ago

I am on it. I agree, that line IS the problem. For some reason seq is (so order in which couplings are executed in sequential runs) is used to calculate the number of lines in the namcouple, which has nothing to do with each other

dbarbi commented 3 years ago

Can you try the bugfix in branch "oasis_nb_lines_bug" I just pushed? It branched off from the branch hotfix/write... you were on.

dbarbi commented 3 years ago

wait a second, please

dbarbi commented 3 years ago

You can try now, I made the fix a bit more general, so that it not specifically works only for conserv

JanStreffing commented 3 years ago

Hey Dirk, ty for the quick return on this. I'll try it out now.

JanStreffing commented 3 years ago

This seems to work. I was able to make a one day run with the new namcouple.

I'm having a problem still that the oasis restart files are not created because some ncwa command doesnt work. I'll chat with Miguel about it. I think thats unrelated to this fix.

dbarbi commented 3 years ago

probably some sort of "module load nco" missing in your environment. I pushed the bugfix to release, develop and prep_release, and will therefore close the issue now