access_SoftwareGuidelines - ACCESS-NRI/accessdev-Trac-archive GitHub Wiki


#!html
<h1 style="text-align: center; color: blue"> ACCESS Coding Guidelines </h1>

Source Data Management for NWP the top page for NWP Source Code and Input Data Management

The Met Office style guides are available at: http://ngamai04.bom.gov.au/~access/fm_solar/docs/var_ops_src/ops30.0.0/GTDP.html

ACCESS Coding guidelines

  • Do not rely on users having certain settings in ~/.bashrc or ~/.bash_profile .

    • All the necessary environment should be specified in the environmnet file envfile
  • It is preferable to separate build and run suites

    • required for unit testing
    • preferred by operations
  • Simple updating

    • the layout of the software is chosen to enable easy updating of components from the main development branch
  • Python utilities from ACCESS_UTILS

    • The source code in ACCESS_UTILS is maintained within a directory structure

    • However my customary use has been to: check out the trunk

      flatten the trunk structure into a single directory

      include large, flat directory into $PYTHONPATH

      -- There are a few problems with this.
      
    • My (Peter Steinle) current thoughts are to run python scripts via: python ${PYTHON_DIR}/dir/script.py

      $PYTHON_DIR should be defined in envfile

        -- ${PYTHON_DIR}/dir will be included in *$PYTHONPATH* automatically
      

      A directory trunk/gen needs to be created and included in $PYTHONPATH

        -- This needs to contain files referred to from scripts in many subdirectories (e.g. *gen_args.py*)
        -- PJS to come up with a partial list for this
      
  • When loading modules - explicitly include the version number

    • Defaults change, and so to reproducibility requires explicit version numbers
  • Try to keep lines to no more than 80 characters wide.

    • seom remote logins are still limited
  • ENVIRONMENT variables in UPPER case, local variables in lower case

  • Directory names should be lower case in svn and under ~access/nwp

  • (mjn) Scripts and other text files should not contain tabs (as per Met Office style guide recommendation)

  • (mjn) Where possible, scripts and other text files should be limited 80 columns, especially for printing, but also for screen viewing

⚠️ **GitHub.com Fallback** ⚠️