hafs-community / HAFS

Hurricane Analysis and Forecast System
Other
29 stars 52 forks source link

Reduce GOTO statements from HAFS Fortran source codes #235

Open BinLiu-NOAA opened 8 months ago

BinLiu-NOAA commented 8 months ago

Description

Provide a clear and concise description of the requested feature/capability. From NCO SPA: Please consider to remove or reduce GOTO statements, replace them with more structured constants (if blocks, do loops, case blocks) in next HAFS upgrade.

under /lfs/h1/ops/para/packages/hafs.v1.0.3/

>for file in `find sorc -name "*.[fF]*" -type f` ; do egrep -iH "go[ ]*to" $file | grep -iv :c | grep -iv :\! ; done | wc -l
2938

Here are detailed GOTO statements in HWRF/HMON and HAFS - hafs.v1.0.0 - goto - total 2938
hafs_forecast.fd 1954
hafs_gsi.fd 73
hafs_hycom_utils.fd 419
hafs_post.fd 0
hafs_tools.fd 257
hafs_tracker.fd 43
hafs_utils.fd 192

Proposed solution

How should the new feature/capability be added? If you have thoughts on the implementation strategy, please share them here.

Status (optional)

Do you (or a colleague) plan to work on adding this feature?

Related to (optional)

Directly reference any related issues or PRs in this or other repositories, and describe how they are related. Examples:

BinLiu-NOAA commented 3 months ago

Based on the counting @BijuThomas-NOAA did for the latest HAFSv2 package, here are the numbers of "goto"s from the production/hafs.v2 branch:

hafs.v2.0.0 - goto - total 2153
hafs_forecast.fd 1127 hafs_gsi.fd 72 hafs_hycom_utils.fd 440 hafs_post.fd 0 hafs_tools.fd 257 hafs_tracker.fd 43 hafs_utils.fd 214