Bridge Command Forum

Support => Environment models => Topic started by: elir71 on June 25, 2017, 09:38:44 PM

Title: .f32 heightmap creation
Post by: elir71 on June 25, 2017, 09:38:44 PM
Does anyone know of an easy way to create an f32 heightmap from .asc file format strm data ?
Title: Re: .f32 heightmap creation
Post by: forum_admin on July 14, 2017, 08:36:09 PM
Hi, do you have access to Matlab, or Octave (an open source alternative)? If so, it's quite easy to process the height data into a binary f32 file.

I used a simple script to process .asc NOAA Coastal Relief model data to .f32:

This example takes an ascii text file (in.txt) for the area of interest, with all header information removed, and scales it to 2049x2049, then saves it. You will need to think about how to handle the elevations for the sea area. This example sets everything at 0m or less to -10m.

Code: [Select]
clear
pkg load image
load 'in.txt';
in = flipud(in); %Flip in north-south direction
scaled = imresize(in,[2049 2049]);

%Do any extra processing here
scaled(scaled<=0) = -10; %This would set any elevations at or below 0 in the raw data to -10m

fileID = fopen('height2049.f32','w');
fwrite(fileID,scaled,'single');
fclose(fileID);
Title: Re: .f32 heightmap creation
Post by: elir71 on November 05, 2017, 02:42:53 PM
when you mean strip the headers do you mean, manually delete this (in the case of an srtm .asc file) ....

ncols         6001
nrows         6001
xllcorner     -0.00041661826815287
yllcorner     49.999583817591
cellsize      0.00083333333333333
NODATA_value  -9999


Title: Re: .f32 heightmap creation
Post by: forum_admin on November 14, 2017, 07:42:25 AM
Yes, that's correct.
Title: Re: .f32 heightmap creation
Post by: elir71 on July 11, 2022, 03:12:50 PM
In fedora 36, the current version i am using then installing the image package on octave does not seen to work using the pkg command withing octave's own "commanline"

I've tried this however from the linux commandline

sudo dnf makecache
sudo dnf install octave-image.x86_64