[3908] | 1 | The Fortran conventions that the author of the code in this directory |
---|
| 2 | aspired to are as follows: |
---|
| 3 | |
---|
| 4 | - Module names are prefixed by the static library name, in this case |
---|
| 5 | "radiation" (no need to suffix by "_mod" since this is always |
---|
| 6 | obvious from the context) |
---|
| 7 | |
---|
| 8 | - Names of derived types are suffixed by "_type" |
---|
| 9 | |
---|
| 10 | - Implicit none everywhere |
---|
| 11 | |
---|
| 12 | - Logicals are prefixed by "do_", "use_" or "is_" |
---|
| 13 | |
---|
| 14 | - All variables in SI units by default |
---|
| 15 | |
---|
| 16 | - Variables not in SI units have the units in the variable name, |
---|
| 17 | e.g. pressure_hPa |
---|
| 18 | |
---|
| 19 | - Integers either prefixed by "j" to indicate loop counter, "n" to |
---|
| 20 | indicate the size of an array dimension, or "i" otherwise. |
---|
| 21 | |
---|
| 22 | - Loop counters should be brief and contain no underscores |
---|
| 23 | |
---|
| 24 | - Integers variables beginning with "n" or "i" should either contain |
---|
| 25 | no underscores (e.g. "naerosoltypes"), or should have an underscore |
---|
| 26 | immediately after the "n" or "i" (e.g. "n_aerosol_types"). Thus, a |
---|
| 27 | variable beginning with "n" or "i" containing an underscore but not |
---|
| 28 | as its second character need not be an integer (would normally then |
---|
| 29 | be a real or a derived type), in order to enable real variables |
---|
| 30 | such as "ice_water_content". |
---|
| 31 | |
---|
| 32 | - All variables and procedure names in lower case using descriptive |
---|
| 33 | names, and if not too long these will be composed of complete words |
---|
| 34 | separated by underscores |
---|
| 35 | |
---|
| 36 | - All parameters are in CamelCase, and integer parameters are |
---|
| 37 | prefixed by "I" or "N" |
---|
| 38 | |
---|
| 39 | - C-style enumerations are treated as integer parameters |
---|
| 40 | |
---|
| 41 | - Variable character strings are suffixed by "_name" or "_str", while |
---|
| 42 | parameter character strings (in CamelCase) are suffixed by "Name" |
---|
| 43 | or "Str" |
---|
| 44 | |
---|
| 45 | - Global data included in modules must be constant; any variable data |
---|
| 46 | must be passed to procedures via dummy arguments |
---|
| 47 | |
---|
| 48 | - Long argument lists avoided by grouping variables thematically into |
---|
| 49 | derived types |
---|
| 50 | |
---|
| 51 | - Any variable used in a source file should be defined in a comment |
---|
| 52 | earlier in the source file (if this is not obvious from the |
---|
| 53 | variable name) including its units if it has them (even if they are |
---|
| 54 | SI units) |
---|
| 55 | |
---|
| 56 | - All functions and subroutines to be defined in modules and their |
---|
| 57 | explicit interfaces to be revealed via the "use" command, which |
---|
| 58 | should use "only". |
---|
| 59 | |
---|
| 60 | - Data are read in at run-time from NetCDF files rather than being |
---|
| 61 | embedded in the code (e.g. using data statements). |
---|
| 62 | |
---|
| 63 | - Lots of comments! |
---|