ufs-community / regional_workflow

THIS REPOSITORY IS NOW DEPRECATED; SEE UFS SRW APP FOR CURRENT CODE
https://github.com/ufs-community/ufs-srweather-app
Other
10 stars 86 forks source link

Python script does not recognize all Fortran float numbers when processing namelist templates from Yaml file #699

Closed ywangwof closed 2 years ago

ywangwof commented 2 years ago

Description

When processing YAML file, some scientific notations that are valid for Fortran namelist variable will render as a string but not a float number.

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. set a variable in templates/FV3.input.yml, for example, nssl_cccn: 0.6e9;
  2. run generate_FV3LAM_wflow.sh;
  3. we will get nssl_cccn: '0.6e9' in file input.nml.

Additional Context

I did a search and found a way to get around the problem. The problem lies in the fact how YAML Resolves floats. For scientific notation, it requires a decimal dot in the base and a sign symbol in the exponent after "e or E", for example, nssl_cccn: 0.6e+9 will work properly.

My suggestion is to add a regex check before processing the YAML file to prevent users from using invalid values in the YAML template file and avoid surprise when running FV3 model.

mkavulich commented 2 years ago

Issue migrated to ufs-srweather-app repository: https://github.com/ufs-community/ufs-srweather-app/issues/363