make_hgrid

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 UFS Utils preprocessing component make_hgrid. Documentation for this UFS Utils component is here.

uw make_hgrid --help
usage: uw make_hgrid [-h] [--version] TASK ...

Execute make_hgrid tasks

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

Positional arguments:
  TASK
    provisioned_rundir
      Run directory provisioned with all required content
    run
      A run
    runscript
      The runscript
    validate
      Validate the UW driver config

All tasks take the same arguments. For example:

uw make_hgrid run --help
usage: uw make_hgrid run [-h] [--version] [--config-file PATH] [--batch]
                         [--dry-run] [--graph-file PATH]
                         [--key-path KEY[.KEY...]] [--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
  --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:

make_hgrid:
  config:
    do_schmidt: true
    great_circle_algorithm: true
    grid_name: C96_foo
    grid_type: gnomonic_ed
    halo: 1
    iend_nest:
      - 87
    istart_nest:
      - 10
    jend_nest:
      - 78
    jstart_nest:
      - 19
    nest_grids: 1
    nlon:
      - 192
    parent_tile:
      - 6
    refine_ratio:
      - 2
    stretch_factor: 1.0001
    target_lat: 38.5
    target_lon: -97.5
  execution:
    batchargs:
      nodes: 1
      stdout: /path/to/runscript.out
      walltime: "08:00:00"
    executable: /path/to/make_hgrid
  rundir: /path/to/run/dir

Its contents are described in section make_hgrid.

  • Run make_hgrid on an interactive node

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

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

    An example runscript:

    rm -f runscript.make_hgrid
    base=../../../../../shared/make_hgrid.yaml
    echo "make_hgrid: {rundir: $PWD}" | uw config realize --input-file $base --update-format yaml --output-file config.yaml
    uw make_hgrid runscript --config-file config.yaml 2>/dev/null
    cat runscript.make_hgrid
    
    #!/bin/bash
    
    time /path/to/make_hgrid --do_schmidt --great_circle_algorithm --grid_name C96_foo --grid_type gnomonic_ed --halo 1 --iend_nest 87 --istart_nest 10 --jend_nest 78 --jstart_nest 19 --nest_grids 1 --nlon 192 --parent_tile 6 --refine_ratio 2 --stretch_factor 1.0001 --target_lat 38.5 --target_lon -97.5
    test $? -eq 0 && touch runscript.make_hgrid.done
    
  • Run make_hgrid via a batch job

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

    The driver creates a runscript.make_hgrid 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 make_hgrid:.

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

    $ uw make_hgrid 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.