sfc_climo_gen

Note

The uwtools drivers are idempotent, meaning that actions they successfully complete during one invocation are not repeated in subsequent invocations. For example, an asset like a configuration file will not be recreated when the driver is run again, even if its UW YAML configuration changes. To force recreation, remove the asset(s) in question – up to and including the entire provisioned run directory – then re-run the driver, which will recreate any missing assets based on the current configuration.

The uw mode for configuring and running the sfc_climo_gen component.

uw sfc_climo_gen --help
usage: uw sfc_climo_gen [-h] [--version] [--show-schema] TASK ...

Execute sfc_climo_gen tasks

Optional arguments:
  -h, --help
      Show help and exit
  --version
      Show version info and exit
  --show-schema
      Show driver schema and exit

Positional arguments:
  TASK
    namelist_file
      The namelist file
    provisioned_rundir
      Run directory provisioned with all required content
    run
      A run
    runscript
      The runscript
    show_output
      Show the output to be created by this component
    validate
      Validate the UW driver config

All tasks take the same arguments. For example:

uw sfc_climo_gen run --help
usage: uw sfc_climo_gen run [-h] [--version] [--config-file PATH] [--batch]
                            [--dry-run] [--graph-file PATH]
                            [--key-path KEY[.KEY...]] [--schema-file PATH]
                            [--quiet] [--verbose]

A run

Optional arguments:
  -h, --help
      Show help and exit
  --version
      Show version info and exit
  --config-file PATH, -c PATH
      Path to UW YAML config file (default: read from stdin)
  --batch
      Submit run to batch scheduler
  --dry-run
      Only log info, making no changes
  --graph-file PATH
      Path to Graphviz DOT output [experimental]
  --key-path KEY[.KEY...]
      Dot-separated path of keys leading through the config to the driver's
      configuration block
  --schema-file PATH
      Path to schema file to use for validation
  --quiet, -q
      Print no logging messages
  --verbose, -v
      Print all logging messages

Examples

The examples use a configuration file named config.yaml with contents similar to:

sfc_climo_gen:
  execution:
    batchargs:
      export: NONE
      nodes: 1
      stdout: /path/to/runscript.out
      walltime: "00:02:00"
    envcmds:
      - module use /path/to/modulefiles
      - module load some_module
    executable: /path/to/sfc_climo_gen
    mpiargs:
      - "--export=ALL"
      - "--ntasks $SLURM_CPUS_ON_NODE"
    mpicmd: srun
  namelist:
    update_values:
      config:
        halo: 4
        input_facsf_file: /path/to/facsf.1.0.nc
        input_maximum_snow_albedo_file: /path/to/maximum_snow_albedo.0.05.nc
        input_slope_type_file: /path/to/slope_type.1.0.nc
        input_snowfree_albedo_file: /path/to/snowfree_albedo.4comp.0.05.nc
        input_soil_type_file: /path/to/soil_type.statsgo.0.05.nc
        input_substrate_temperature_file: /path/to/substrate_temperature.2.6x1.5.nc
        input_vegetation_greenness_file: /path/to/vegetation_greenness.0.144.nc
        input_vegetation_type_file: /path/to/vegetation_type.igbp.0.05.nc
        maximum_snow_albedo_method: bilinear
        mosaic_file_mdl: /path/to/C403_mosaic.halo4.nc
        orog_dir_mdl: /path/to/orog-files-dir
        orog_files_mdl:
          - C403_oro_data.tile7.halo4.nc
        snowfree_albedo_method: bilinear
        vegetation_greenness_method: bilinear
    validate: true
  rundir: /path/to/run/dir
platform:
  account: me
  scheduler: slurm

Its contents are described in depth in section sfc_climo_gen.

  • Run sfc_climo_gen on an interactive node

    $ uw sfc_climo_gen run --config-file config.yaml
    

    The driver creates a runscript.sfc_climo_gen file in the directory specified by rundir: in the config and runs it, executing sfc_climo_gen.

  • Run sfc_climo_gen via a batch job

    $ uw sfc_climo_gen run --config-file config.yaml --batch
    

    The driver creates a runscript.sfc_climo_gen file in the directory specified by rundir: in the config and submits it to the batch system. Running with --batch requires a correctly configured platform: block in config.yaml, as well as appropriate settings in the execution: block under sfc_climo_gen:.

  • Specifying the --dry-run flag results in the driver logging messages about actions it would have taken, without actually taking any.

    $ uw sfc_climo_gen run --config-file config.yaml --batch --dry-run
    
  • The --key-path option can be used to navigate from the top of the config to the driver’s configuration block. For example, specifying --key-path foo.bar with config

    foo:
      bar:
        driver:
          # driver config block
    

    is equivalent to using config

    driver:
      # driver config block
    

    without specifying --key-path.

  • The run task depends on the other available tasks and executes them as prerequisites. It is possible to execute any task directly, which entails execution of any of its dependencies. For example, to create an sfc_climo_gen run directory provisioned with all the files, directories, symlinks, etc. required per the configuration file:

    $ uw sfc_climo_gen provisioned_rundir --config-file config.yaml --batch
    
  • Specifying the --show-schema flag, with no other options, prints the driver’s schema:

    uw sfc_climo_gen --show-schema >schema
    head -n20 schema
    
    {
      "properties": {
        "sfc_climo_gen": {
          "additionalProperties": false,
          "properties": {
            "execution": {
              "additionalProperties": false,
              "properties": {
                "batchargs": {
                  "additionalProperties": true,
                  "properties": {
                    "cores": {
                      "type": "integer"
                    },
                    "debug": {
                      "type": "boolean"
                    },
                    "exclusive": {
                      "type": "boolean"
                    },
    
  • Use the --schema-file option to specify a custom JSON Schema file with which to validate the driver config. A custom schema could range in complexity from the simplest, most permissive schema, {}, to one based on the internal schema shown by --show-schema.