mos2 is the primary Ocean Mapping Group sidescan and multibeam backscatter mosaicking program. Modeled on the command-line architecture of weigh_grid, it reads georeferenced GLORIA-format sidescan files (ss/<subdir>/<line>.ss, generated by makess and gap-filled by glfill) or OMG-HDCS .merged beam amplitudes (-beam), projects each swath quadrilateral onto a pre-initialized 8-bit mapsheet (<mosprefix>.mos), and uses a companion weight/range buffer (<mosprefix>.ran) to autoseam overlapping swaths.
During autoseaming (enabled by default), each across-track sample in the 1024-sample GLORIA swath is assigned a priority weight (weight_map[0..1023], or dynamically computed by grazing angle via -weight_by_angle). When two survey lines overlap at a pixel (x, y), mos2 compares the incoming sampleβs weight against the weight already stored in <mosprefix>.ran and retains the sample with the higher weight (typically mid-swath oblique incidence angles, suppressing nadir stripe artifacts and noisy outer-swath edges).
# Step 1: Create an 8-bit .blank mapsheet primed to 255 from your .ss (or .merged) files
make_blank -8bit-prime 255 bay_mos -boundsof_ss ss/JD100/*.ss
# (Enter desired resolution in mpp, e.g. 1.0)# Step 2: Copy bay_mos.blank to bay_mos.mos and bay_mos.ran
tomos bay_mos.blank
# Step 3: Run mos2, telling it how to find the companion .merged & bounds files via -swap_dirs
mos2 -swap_dirs ss/ merged/ bay_mos ss/JD100/*.ss
# Step 4: View the mosaic in jview
jview -initstr 100 220 bay_mos.mos
Arguments
Core Input, Output & Directory Mapping
Option
Description
Default
<mosprefix>
Required. Base prefix of the .mos and .ran files (initialized from <mosprefix>.blank via tomos).
None
<file(s)>
Required (unless -xyzlist is used). Input .ss files (default -gloria mode), .merged files (-beam mode), or .mr1 files (-mr1 mode). Up to 100,000 files.
None
-xyzlist <listfile>
Read input file paths from a text list file (one path per line).
Disabled
-swap_dirs <ss_dir> <merged_dir>
Highly Recommended. Replaces <ss_dir> with <merged_dir> in each input .ss path (e.g., -swap_dirs ss/ merged/) so mos2 can automatically locate <line>.merged.global_bounds, <line>.merged.100_ping_bounds, and <line>.merged for fast spatial indexing and beam-edit checking.
Disabled
-mergedpath <path>
Specify a single directory path containing the companion .merged and .100_ping_bounds files.
Disabled
-fresh_start / -fs
Clear <mosprefix>.mos and <mosprefix>.ran back to 255 before mosaicking. Without -fs, mos2 incrementally adds new lines into the existing .mos/.ran files!
Incremental
Input Backscatter Data Type
Option
Description
Default
-gloria
Input files are 1160-byte/record JCU GLORIA .ss sidescan files (gloria_rec, 512 port + 512 stbd 8-bit pixels per ping).
Default (JCU_GLORIA)
-beam
Input files are OMG-HDCS .merged files; mosaics per-beam amplitude values directly without requiring .ss files.
Disabled
-refl
Used with -beam: mosaic beam.reflectivity (standard Kongsberg TVG-flattened reflectivity).
Default for -beam
-aibs
Used with -beam: mosaic beam.pseudoAngleIndependentBackscatter (reflectivity2_dB).
Disabled
-calb
Used with -beam: mosaic beam.calibratedBackscatter (BScalibration_dB).
Disabled
-mr1
Input files are HIG/SOEST MR1 format sidescan files.
Load a custom 1024-element across-track priority weight curve from an ASCII file.
Default bell-shaped weight curve
-weight_by_angle <.grz_suffix>
Dynamically compute autoseaming weights per ping using the true seafloor grazing angle stored in <prefix><.grz_suffix> (generated by makess -write_grz).
Used with -weight_by_angle: assigns maximum weight (255) at <centre_deg> grazing angle, tapering linearly to 0 over $\pm (\text{range_deg} / 2)$.
40.0 deg center, 40.0 deg range
-weight_centre_depth_multiple <in> <cen> <out>
Weight across-track pixels by water-depth multiples rather than grazing angle.
Disabled
-dont_mos_wt_255
Do not mosaic pixels with weight 255.
Disabled
-apply_along_track <.altr_suffix>
Apply per-sample along-track beam offsets stored in <prefix><.altr_suffix> (generated by makess) to accurately geolocate yaw-stabilized or deep-water outer swath snippets.
Disabled
Downsampling, Radiometric Adjustments & Filtering
Option
Description
Default
-no_auto_dg
Disable automatic across-track downsampling (dg_scan) when the .ss pixel size is finer than the .mos grid pixel size (mpp).
Auto-downgrade enabled (1)
-linear
Perform across-track downsampling in linear intensity space rather than logarithmic (dB) space.
Logarithmic average
-just_drop
Project individual sample points directly into grid cells rather than quadrilateral scan-conversion between consecutive pings.
Quadrilateral fill
-addDN <val>
Add a constant Digital Number shift (<val>) to all input backscatter pixels.
0
-pulselenDNshift <microsec> <dDN>
Add <dDN> to pings whose transmit pulse length equals <microsec> $\mu\text{s}$ (up to 100 pulse-length rules) to balance tonal shifts across Kongsberg depth-mode transitions.
Disabled
-apply_shifts
Apply per-ping DN shifts from a <line>.dn_shift file.
Disabled
-dBwrap <dB>
Wrap dB values exceeding <dB>.
Disabled
-MINinvalid <DN> / -MAXinvalid <DN>
Set invalid pixel thresholds.
255 / -1
-port / -stbd
Mosaic only the port side or only the starboard side of each swath.
Both sides
-maxacross <meters>
Clip swath width to <meters> across-track (useful on heavily overlapping lines).
Full swath
-maxdist <meters>
Maximum allowable nadir distance jump (meters) between consecutive pings before quadrilateral interpolation is broken (prevents smearing across data gaps).
5.0 m
-maxtime <sec>
Maximum allowable time gap (seconds) between consecutive pings to interpolate across.
10.0 s
-maxazi <deg>
Maximum allowable heading change (degrees) between consecutive pings to interpolate across.
5.0 deg
-azirange <low_deg> <high_deg>
Only mosaic pings whose heading falls within [low_deg, high_deg] (supports wrap-around, e.g., 340 20).
All headings
-time_start <yr> <jd> <hr> <min> <sec>
Only mosaic pings after the specified UTC time.
All times
-time_end <yr> <jd> <hr> <min> <sec>
Only mosaic pings before the specified UTC time.
All times
-skip <N>
Mosaic every $N$-th ping.
1
-select
Interactively prompt for first and last ping numbers for each file.
Disabled
-declin <deg>
Apply an azimuth offset (degrees) to swath orientation.
0.0
-pixshift <dx> <dy> / -llshift <dlat> <dlon>
Shift swath positions by pixels or decimal degrees.
0.0
Troubleshooting
Symptom / Error
Cause
Resolution
Could not open <mosprefix>.mos or <mosprefix>.ran
tomos <mosprefix>.blank was not run before mos2.
Run make_blank -8bit -prime 255 <mosprefix> ... followed by tomos <mosprefix>.blank.
Mosaicking is slow or misses bounds acceleration
mos2 cannot find the .merged.global_bounds and .merged.100_ping_bounds files because the .ss files are in ss/ while .merged files are in merged/.
Pass -swap_dirs ss/ merged/ on the mos2 command line.
Smearing / βbow-tieβ streaks across line turns or data dropouts
Vessel speed exceeded -maxdist (default 5 m between pings) or line turns exceeded -maxazi (default 5Β°).
For deep-water sonars (e.g., EM124 / EM304) with slow ping rates (5β15 s between pings, moving 25β75 m per ping), you must increase -maxdist and -maxtime (e.g., -maxdist 100 -maxtime 30) or mos2 will refuse to paint quadrilaterals between consecutive pings!