upp_assets
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 the UPP component. This driver provisions required assets for UPP under the assumption that it will be executed by another process.
uw upp_assets --help
usage: uw upp_assets [-h] [--version] [--show-schema] TASK ...
Execute upp_assets 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
control_file
The GRIB control file
files_copied
Files copied for run
files_hardlinked
Files hardlinked for run
files_linked
Files linked for run
namelist_file
The namelist file
provisioned_rundir
Run directory provisioned with all required content
validate
Validate the UW driver config
All tasks take the same arguments. For example:
uw upp_assets provisioned_rundir --help
usage: uw upp_assets provisioned_rundir --cycle CYCLE --leadtime LEADTIME [-h]
[--version] [--config-file PATH]
[--dry-run] [--graph-file PATH]
[--key-path KEY[.KEY...]]
[--schema-file PATH] [--quiet]
[--verbose]
Run directory provisioned with all required content
Required arguments:
--cycle CYCLE
The cycle in ISO8601 format (e.g. yyyy-mm-ddThh)
--leadtime LEADTIME
The leadtime as hours[:minutes[:seconds]]
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)
--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 to driver config 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:
upp_assets:
control_file: /path/to/postxconfig-NT.txt
files_to_link:
eta_micro_lookup.dat: /path/to/nam_micro_lookup.dat
params_grib2_tbl_new: /path/to/params_grib2_tbl_new
namelist:
base_file: /path/to/base.nml
update_values:
model_inputs:
datestr: "{{ (cycle + leadtime).strftime('%Y-%m-%d_%H:%M:%S') }}"
filename: /path/to/dynf{{ '%03d' % (leadtime.total_seconds() / 3600) }}.nc
filenameflux: /path/to/phyf{{ '%03d' % (leadtime.total_seconds() / 3600) }}.nc
grib: grib2
ioform: netcdf
modelname: FV3R
submodelname: RTMA
nampgb:
kpo: 3
numx: 1
po:
- 1000
- 100
- 1
validate: true
rundir: /path/to/run/dir
Its contents are described in depth in section upp_assets.
Provision assets for execution of UPP by another process
$ uw upp_assets provisioned_rundir --config-file config.yaml --cycle 2024-05-06T12 --leadtime 6
Specifying the
--dry-runflag results in the driver logging messages about actions it would have taken, without actually taking any.$ uw upp_assets provisioned_rundir --config-file config.yaml --cycle 2024-05-06T12 --leadtime 6 --dry-run
The
--key-pathoption can be used to navigate from the top of the config to the driver’s configuration block. For example, specifying--key-path foo.barwith configfoo: bar: driver: # driver config block
is equivalent to using config
driver: # driver config block
without specifying
--key-path.
Specifying the
--show-schemaflag, with no other options, prints the driver’s schema:uw upp_assets --show-schema >schema head -n20 schema{ "properties": { "upp_assets": { "additionalProperties": false, "properties": { "control_file": { "type": "string" }, "files_to_copy": { "additionalProperties": { "type": "fs_src" }, "minProperties": 1, "type": "object" }, "files_to_hardlink": { "additionalProperties": { "type": "fs_src" }, "minProperties": 1,Use the
--schema-fileoption 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.