Command Line Tools
sch
schimpy CLI tools for pre- and post- processing for SCHISM and data processing.
Usage
sch [OPTIONS] COMMAND [ARGS]...
Options
- -h, --help
Show this message and exit.
batch-metrics-cli
Command line interface for generating metrics plots.
MAIN_INPUTFILE: Path to the main input YAML file.
Usage
sch batch-metrics-cli [OPTIONS] MAIN_INPUTFILE
Options
- -h, --help
Show this message and exit.
Arguments
- MAIN_INPUTFILE
Required argument
clip-dems-cli
Trim each DEM on a prioritized list. The coordinates used for clipping is supplied either directly as an upper left and lower right coordinate or indirectly using the bounding coordinates of a sample image. In practice this script is usually used with images saved from SMS.
- Arguments:
DEMLIST file containing prioritized (high to low) list of dems.
Usage
sch clip-dems-cli [OPTIONS] DEMLIST
Options
- --coords <coords>
Bounding coordinates to which DEMs will be clipped (upper left x, y, lower right x, y).
- --image <infile>
Image or DEM used to infer bounding coordinates for clipping. Use jpeg for the image. This argument is mutually exclusive with –coords. If a sample is provided its upper left and lower right corner will be used.
- --prefix <prefix>
Prefix used for output file names.
- --outformat <outformat>
Output format, default is AAIGrid (ArcInfo ASCII).
- --verbose
Enable verbose output.
- --hshift
(Deprecated) Shift DEM by half cell for applications that incorrectly interpret the location of the origin and data centering of a DEM. This is a bug fix for SMS < 11.1
- -h, --help
Show this message and exit.
Arguments
- DEMLIST
Required argument
combine-consume-cli
Usage
sch combine-consume-cli [OPTIONS]
Options
- --start <start>
Required start date of simulation in format like yyyy-mm-dd
- --dir <dir>
directory in which output will be processed
- --fbase <fbase>
File base name. This will either be ‘schout.nc’ or a list of files like ‘elev.61,hvel.64,salt.63’.
- --hotstart
Combine hotstart in addition to fbase
- --hotstart_only
Only combine hotstart – avoids file search errors when nothing left to combine
- --consume
Delete combined files or unrequested files
- --assume_done
Assume that the simulation is finished, so incomplete blocks can be deleted
- --combiner <combiner>
Executable for combine_output.
- --hot_combiner <hot_combiner>
Executable for combine_output.
- --sndx <sndx>
First index to consider for processing.
- --endx <endx>
Last index to consider for processing.
- --sndx_hot <sndx_hot>
First index to consider for processing.
- --endx_hot <endx_hot>
Last index to consider for processing.
- --datefile <datefile>
File containing list of dates. Each line can have a single date or comma-separated pair indicating block start and end. Blank lines are ignored and # is comment character that can comment the entire line or be placed at the side of a line after the date(s).
- --blocks_per_day <blocks_per_day>
Blocks used to store 1 day worth of output.
contour-smooth-cli
Uses the min-max curvature flow algorithm of Malladi and Sethian to simplify DEM topography.
The script requires a subcommand like: $ contour_smooth.py smooth The most basic subcommand is smooth. Given limited efficiency at the moment, the script is generally run on a small area and dumps intermediate points in the processing as numpy arrays so you can view the differences using the contour_smooth.py view subcommand.
You can get subject-specific help on a subcommand by typing: $ contour_smooth.py subcommand –help
Usage
sch contour-smooth-cli [OPTIONS] COMMAND [ARGS]...
Options
- -h, --help
Show this message and exit.
save
Save dumped DEM based on .npy dump and the original DEM it came from.
Usage
sch contour-smooth-cli save [OPTIONS]
Options
- -h, --help
Show this message and exit.
- --dumpfile <dumpfile>
Required Dump file from smoothing (npy format).
- --original <original>
Required Original DEM (GeoTiff).
- --outfile <outfile>
Required Output file that will be saved (GeoTiff format).
smooth
Smooth the input DEM.
Usage
sch contour-smooth-cli smooth [OPTIONS]
Options
- -h, --help
Show this message and exit.
- --input <input>
Required Input file name, file in tiff format.
- --scales <scales>
Scales (in multiples of DEM side length) over which to smooth. The sequence [1,2,3,4] is an example, where the smoothing is gradually introduced at 10m, 20m, 30m and 40m for a 10m DEM.
- --nstep <nstep>
Number of pseudo time steps to resolve integration. Default is 40.
- --max_time <max_time>
Pseudo time representing final time step. Default is 4.0.
- --report_interval <report_interval>
Intermediate interval at which integration will be segmented and smoothed DEMs will be dumped. For example, if –max_time is 2.0 and –report_interval is 0.1, you will get 20 intermediate reports.
view
View two versions of the smoothed DEM based on their .npy dump.
Usage
sch contour-smooth-cli view [OPTIONS] FILE0 FILE1
Options
- -h, --help
Show this message and exit.
- --levels <levels>
Contour levels.
- --vmin <vmin>
Minimum elevation in color bar.
- --vmax <vmax>
Maximum elevation in color bar.
Arguments
- FILE0
Required argument
- FILE1
Required argument
convert-2dm-cli
Convert a *.2dm SMS mesh to a *.gr3 SCHISM mesh.
Usage
sch convert-2dm-cli [OPTIONS] INFILE
Options
- --outfile <outfile>
name of output file
- --elev2depth
SMS geometry is in terms of elevation and should be flipped in sign.
Arguments
- INFILE
Required argument
convert-linestrings-cli
Convert SCHISM line strings between YAML and Shapefile formats.
Usage
sch convert-linestrings-cli [OPTIONS]
Options
- -h, --help
Show this message and exit.
- --input <input>
Required Input file (YAML or Shapefile).
- --output <output>
Required Output file (YAML or Shapefile).
- -s, --structures
Flag to indicate conversion of structures YAML.
convert-mesh-cli
Convert a mesh from one format to another. The format is decided by the extensions automatically.
Usage
sch convert-mesh-cli [OPTIONS]
Options
- --input <input>
Required Input mesh file.
- --output <output>
Required Output mesh file.
- --crs <crs>
CRS string for the projection.
- -h, --help
Show this message and exit.
convert-points-cli
Convert SCHISM points (source and sink) between YAML and Shapefile formats.
Usage
sch convert-points-cli [OPTIONS]
Options
- -h, --help
Show this message and exit.
- --input <input>
Required Input file (YAML).
- --output <output>
Required Output file (Shapefile).
- -h, --help
Show this message and exit.
convert-polygons-cli
Convert SCHISM polygons between YAML and Shapefile formats.
Usage
sch convert-polygons-cli [OPTIONS]
Options
- --input <input>
Required Input file (YAML or Shapefile).
- --output <output>
Required Output file (YAML or Shapefile).
- -h, --help
Show this message and exit.
convert-station-cli
Create station.in file from station database (stations_utm.csv) and station subloc listing station_subloc.csv
Usage
sch convert-station-cli [OPTIONS]
Options
- --station_db <station_db>
station database, otherwise station_dbase as configured in dms_datastore dstore_config file
- --subloc_db <subloc_db>
subloc listings for stations (otherwise default subloc from dms_datastore dstore_config file)
- --request <request>
requested variables or ‘all’ for all of them. Possibilities are: elev,air pressure,wind_x,wind_y,temp,salt,u,v,w,ssc
- --default_zcor <default_zcor>
z coordinate used when there is no listing for station id (z coordinate, not subloc from surface)
- --out <out>
station.in formatted file
create-hotstart-cli
Create hotstart for a schism run
Usage
sch create-hotstart-cli [OPTIONS]
Options
- --input <input>
Required input yaml file for hotstart
create-nudge-cli
Create nudging for a schism run
Usage
sch create-nudge-cli [OPTIONS] [INPUT_FILE]
Options
- --input <input_opt>
input yaml file for nudging
Arguments
- INPUT_FILE
Optional argument
create-station-output-cli
Prepares station-related SCHISM inputs.
target: SCHISM input associated with input_type. For example, use following input_type and target pair:
station : staout* fluxflag : flux.out fluxline : flux.out
Usage Examples:
1. Create staout_* files from scratch (i.e., hotstart) create_station_output –hotstart –run_start 2021-01-01 –hot_date 2021-02-01 –input_type station –new_input station_new.in –out_dir . –overwrite_existing TRUE
2. Create staout_* files based on a previous run create_station_output –input_type station –old_input station_old.in –new_input station_new.in –out_dir . –overwrite_existing TRUE staout*
3. Create flux.out from scratch (i.e., hotstart) using fluxflag.prop create_station_output –hotstart –run_start 2021-01-01 –hot_date 2021-02-01 –input_type fluxflag –new_input fluxflag_new.prop –out_dir . –overwrite_existing TRUE
4. Create flux.out based on a previous run using fluxflag.prop create_station_output –input_type fluxflag –old_input fluxflag_old.prop –new_input fluxflag_new.prop flux.out
5. Create flux.out from scratch (i.e., hotstart) using flow_station_xsects.yaml create_station_output –hotstart –run_start 2021-01-01 –hot_date 2021-02-01 –input_type fluxline –new_input flow_station_xsects_new.yaml –out_dir . –overwrite_existing TRUE
Usage
sch create-station-output-cli [OPTIONS] target
Options
- --hotstart
Flag for creating desired SCHISM input files from scratch.
- --run_start <run_start>
Run start date in the format YYYY-MM-DD. Required only when –hotstart flag is present.
- --hot_date <hot_date>
Hotstart date in the format YYYY-MM-DD. Required only when –hotstart flag is present.
- --input_type <input_type>
Required Type of input. Must be one of: station, fluxflag, fluxlines
- --old_input <old_input>
Previous run’s input file associated with input_type. Not required when –hotstart flag is present.
- --new_input <new_input>
Required Current run’s input file associated with input_type.
- --out_dir <out_dir>
Output location. Default is current directory.
- --overwrite_existing <overwrite_existing>
If true, existing output files will be overwritten. If false, warning given without generating file.
- -h, --help
Show this message and exit.
Arguments
- target
Optional argument
create-vgrid-lsc2-cli
Create LSC2 vertical grid
Usage
sch create-vgrid-lsc2-cli [OPTIONS]
Options
- --hgrid <hgrid>
hgrid file name
- --vgrid <vgrid>
vgrid output file name
- --minmaxregion <minmaxregion>
Required Polygon file that contains min and max layer information
- --ngen <ngen>
Number of iterations for layer simplification
- --eta <eta>
Reference surface elevation
- --plot_transects <plot_transects>
Filename or glob prefix of transects to plot (e.g. mallard for files mallard_1.csv, mallard_2.csv, etc
- --archive_nlayer <archive_nlayer>
Filename or glob prefix of transects to plot (e.g. mallard for files mallard_1.csv, mallard_2.csv, etc
- --nlayer_gr3 <nlayer_gr3>
Filename or glob prefix of transects to plot (e.g. mallard for files mallard_1.csv, mallard_2.csv, etc
- --vgrid_version <vgrid_version>
Required SCHISM version number as string (e.g. ‘5.8’ and below for old style vgrid, ‘5.10’ is the current new style vgrid
hotstart-inventory-cli
Lookup station metadata by partial string match on id or name
Usage
sch hotstart-inventory-cli [OPTIONS]
Options
- --dt <dt>
Time step in seconds of model
- --run_start <run_start>
Start time in iso-like format, e.g. 2013-12-03
- --nday <nday>
Number of days in simulation (rnday) or maximum to catalog
- --workdir <workdir>
Working directory, which is the outputs dir
- --paramfile <paramfile>
Name of param.nml file if file is used to infer runtime. If neither params nor paramfile provided, ./param.nmo or ../param.nml will be tried.
- --hot_freq <hot_freq>
Hotstart frequency in pandas freq terms (e.g. ‘5D’)
- --expected
Flag to generate expected hotstarts instead of inventory of existing files
interpolate-structure-cli
Interpolate a dated th template for a structure
Usage
sch interpolate-structure-cli [OPTIONS]
Options
- --template_th <template_th>
th file path containing skeleton of operations.
- --output_th <output_th>
Output file path
- --dt <dt>
Time step of output. Input template timestamps must be neat with respect to this
- --int_cols <int_cols>
List of column names to treat as integers. Default is install, ndup, ndup_culvert, ndup_pipe, ndup_weir.
merge-th-cli
Merge multicolumn th files to form union of columns and (for tracers) variables.
Usage
sch merge-th-cli [OPTIONS]
Options
- --input <input>
Required Config file
model-time-cli
Convert elapsed model seconds to or from dates
Usage
sch model-time-cli [OPTIONS] COMMAND [ARGS]...
Options
- -h, --help
Show this message and exit.
clip
Clip (subset) an input file in elapsed time to a new, later, start date
Usage
sch model-time-cli clip [OPTIONS] ELAPSED_INPUT...
Options
- --start <start>
Required Start time in ISO-like format 2009-03-12T00:00:00. Time part is optional.
- --clip_start <clip_start>
Required Starting date for output.
- --out <out>
Name of output file. If input is a *.th file the file will be converted and output to this file, otherwise printed to screen
- -h, --help
Show this message and exit.
Arguments
- ELAPSED_INPUT
Required argument(s)
to-date
Convert input elapsed seconds or *.th file with elapsed seconds as the time column to equivalent output with a datetime or annotated with datetimes.
Usage
sch model-time-cli to-date [OPTIONS] ELAPSED_INPUT...
Options
- --start <start>
Required Start time in ISO-like format 2009-03-12T00:00:00. Time part is optional.
- --step <step>
Model time step in seconds. If given, answer will be the integer time step.
- --elapsed_unit <elapsed_unit>
Time unit of input file. Must be either ‘s’ for seconds or ‘d’ for days. Only used for files
- --time_format <time_format>
Time format for output, e.g. the default is %%Y-%%m-%%dT%%H:%%M:%%S for 2009-03-14T22:40:00. Only used when converting fields.
- --annotate
Annotate output.
- --out <out>
Name of output file. If input is a *.th file the file will be converted and output to this file, otherwise printed to screen
- -h, --help
Show this message and exit.
Arguments
- ELAPSED_INPUT
Required argument(s)
to-elapsed
Interpret model times in elapsed seconds and translate between calendar time and elapsed. The script requires a subcommand like: $ model_time.py to_elapsed. You can also get subject-specific help on a subcommand by typing $ model_time.py subcommand –help
Usage
sch model-time-cli to-elapsed [OPTIONS] DATED_INPUT...
Options
- --start <start>
Starting date and time basis for output if the input is a file.
- --annotate
Annotate output.
- --step <step>
Model time step. If given, answer will be the integer time step.
- --out <out>
Name of output file. If input is a *.th file the file will be converted and output to this file, otherwise printed to screen
- --skip_nan
Skip a record with nan if True
- -h, --help
Show this message and exit.
Arguments
- DATED_INPUT
Required argument(s)
prepare-schism-cli
Prepare SCHISM input files.
Usage
sch prepare-schism-cli [OPTIONS] MAIN_INPUTFILE
Arguments
- MAIN_INPUTFILE
Required argument
set_param
Command line tool to set SCHISM model parameters in PARAM_FILE.
Usage
sch set_param [OPTIONS] PARAM_FILE [PAIRS]...
Options
- -o, --output <output>
Write to this file instead of editing PARAM_FILE in place. If omitted, PARAM_FILE is overwritten.
- --dry-run
Parse and report changes but do not write anything.
Arguments
- PARAM_FILE
Required argument
- PAIRS
Optional argument(s)
Alias names you can use for NAME:
- hotstart_freq
maps to : hotstart_freq (Params property) value : ‘5d’, ‘12h’, or ‘none’ meaning : Wall-clock interval between writing hotstart.nc files. Implemented via nhot and nhot_write; nhot_write must be a multiple of the nc_out_file_span or, more directly in schism-speak, nhot must be a multiple of ihfskip
- hotstart_mode
maps to : ihot (raw SCHISM name) value : 0, 1, or 2 meaning : Hotstart option: 0 = cold start; 1 = restart from hotstart.nc but reset model time to 0; 2 = restart and continue from the time stored in hotstart.nc.
- nc_out_file_span
maps to : nc_stack (Params property) value : ‘1d’, ‘10d’, etc. meaning : Wall-clock time covered by each history file. Must be a multiple of nc_out_freq. Used to derive ihfskip, the number of (dt) time steps in the file, which is the parameter actually used by SCHISM. nc_out_steps_per_file is an alias that more directly expresses the ihfskip parameter.
- nc_out_steps_per_file
maps to : ihfskip (raw SCHISM name) value : integer time steps, e.g. 960 meaning : Number of model time steps per history file stack (ihfskip). Derived so that ihfskip is a multiple of nspool.
- run_nday
maps to : run_nday (Params property) value : integer days, e.g. 252 meaning : Total simulation length in days (maps to CORE::rnday).
- station_freq
maps to : station_freq (Params property) value : ‘15min’, ‘1h’, etc. or ‘none’ meaning : Wall-clock interval between samples written to station output files (staout_*). Use ‘none’ to disable station output.
- station_freq_in_model_steps
maps to : nspool_sta (raw SCHISM name) value : integer time steps meaning : Number of model time steps between station outputs (nspool_sta). Only used when station output is enabled (iout_sta != 0).
small-areas-cli
Identify small areas
Usage
sch small-areas-cli [OPTIONS]
Options
- --input_mesh <input_mesh>
Input mesh
- --warn <warn>
Threshold for warning (areas smaller)
- --fail <fail>
Threshold for failure (areas smaller)
split-quads-cli
Split quadrilateral elements that have higher skewness value than the given skewness into triangular elements.
Usage
sch split-quads-cli [OPTIONS] MESHINPUT MESHOUTPUT
Options
- --outdir <outdir>
Output directory for the mesh file and prop file.
- --skewness <skewness>
Maximum skewness (not normalized.) to split. If the skewness of an element is bigger than this, the element will be split.
- --minangle <minangle>
Minimum angle (degrees) to keep in quads. If any of internal angles of a quad is smaller than mingangle, the quad will be split.
- --maxangle <maxangle>
Minimum angle (degrees) to keep in quads. If any of internal angles of a quad is larger than maxgangle, the quad will be split.
- --propfile <propfile>
Write a prop file that shows elements that are split
Arguments
- MESHINPUT
Required argument
- MESHOUTPUT
Required argument