USGS_30sec_to_JHC
Overview
USGS_30sec_to_JHC converts big-endian 16-bit signed integer digital elevation models—either USGS 30-arc-second CONUS grids (-usgs_30sec) or 1-arc-second SRTM .hgt tiles (-srtm_1sec, $3601 \times 3601$)—simultaneously into an OMG unprojected geographic .r4 floating-point grid (<outprefix>.r4) and a 3-column ASCII point file (<outprefix>.llz).
Syntax & CLI Options
USGS_30sec_to_JHC [OPTIONS] (-usgs_30sec | -srtm_1sec) <USGS_or_SRTM_file> <JHC_out_prefix>
| Option | Description | Default |
|---|---|---|
<USGS_or_SRTM_file> | Required. Input 16-bit big-endian binary DEM or SRTM .hgt tile. | None |
<JHC_out_prefix> | Required. Output filename prefix; produces <prefix>.r4 and <prefix>.llz. | None |
-usgs_30sec | Configure for 30-arc-second USGS grid (dx = 7200, dy = 3120, 24°N–50°N, 126°W–66°W, step = 30/3600°, invalid = -9999). | None (must specify -usgs_30sec or -srtm_1sec) |
-srtm_1sec | Configure for $1^\circ \times 1^\circ$ 1-arc-second SRTM .hgt tile (dx = 3601, dy = 3601, step = 1/3600°, invalid = 0). Requires -minlat <blat> and -minlon <tlon> to set the SW tile corner! | None |
-minlat <deg> | Southern latitude bound (blat). For -srtm_1sec, tlat is automatically set to blat + 1.0. | 24.0 (in -usgs_30sec) |
-minlon <deg> | Western longitude bound (tlon). For -srtm_1sec, blon is automatically set to tlon + 1.0. | -126.0 (in -usgs_30sec) |
-maxlat <deg> | Northern latitude bound (tlat). | 50.0 (or blat + 1.0) |
-maxlon <deg> | Eastern longitude bound (blon). | -66.0 (or tlon + 1.0) |
-dx <cols> / -dy <rows> | Override grid dimensions (note: overridden by -usgs_30sec or -srtm_1sec preset block). | 7200 x 3120 or 3601 x 3601 |
-xstep <deg> / -ystep <deg> | Override angular cell size. | 30/3600 or 1/3600 |
-merid <deg> | Central meridian parameter. | 0.0 |
-low <val> / -high <val> | Parsed on CLI. | 0.0 |
How It Works
- Preset Initialization:
- If
-usgs_30secis selected, setsdx = 7200,dy = 3120, bounds24°N–50°Nand126°W–66°W,secstep = 30, andinvalid = -9999. - If
-srtm_1secis selected, setsdx = 3601,dy = 3601,tlat = blat + 1.0,blon = tlon + 1.0,secstep = 1, andinvalid = 0.
- If
- Header Creation: Writes an
OMG1JHC_headerto<JHC_out_prefix>.r4withprojection = 3(Geographic lat/lon),ellipsoid = 1(WGS84), anddata_type = 3(float). - Byte-Swapping & Dual Output:
- Reads each scanline of
dx16-bit shorts, byte-swaps each value viaswap_short, converts tofloat, and writes the row to<JHC_out_prefix>.r4viajswapfloat_fwrite. - Simultaneously writes
lat lon depthto<JHC_out_prefix>.llzfor every valid cell (depth != invalid).
- Reads each scanline of
Examples
1. Convert a 1-arc-second SRTM tile (N45W067.hgt) to .r4 and .llz:
USGS_30sec_to_JHC -srtm_1sec -minlat 45.0 -minlon -67.0 N45W067.hgt N45W067
# Produces N45W067.r4 (geographic projection=3) and N45W067.llz
2. Reproject the resulting geographic .r4 grid onto a UTM mapsheet:
project -in N45W067.r4 -Area fundy_utm.blank -out N45W067_utm.r4
Workflow Context
- Downstream: Use
projectto reproject the geographic.r4grid (projection = 3) onto a Mercator or UTM mapsheet, or grid the.llzpoints directly withweigh_grid.