-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
convertBINtoPPM.F90
29 lines (22 loc) · 1.05 KB
/
convertBINtoPPM.F90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
PROGRAM main
! Import modules ...
USE ISO_FORTRAN_ENV
USE mod_safe, ONLY: sub_allocate_array, &
sub_load_array_from_BIN, &
sub_save_array_as_PPM
IMPLICIT NONE
! Declare parameters ...
INTEGER(kind = INT64), PARAMETER :: nx = 13200_INT64
INTEGER(kind = INT64), PARAMETER :: ny = 24600_INT64
! Declare variables ...
REAL(kind = REAL32), ALLOCATABLE, DIMENSION(:, :) :: elev
! Allocate (1.21 GiB) array and populate it ...
CALL sub_allocate_array(elev, "elev", nx, ny, .TRUE._INT8)
CALL sub_load_array_from_BIN(elev, "terr50_gagg_gb.bin") ! [m]
! Scale map (up to 1,300m ASL) ...
elev = elev / 1300.0e0_REAL32
! Save scaled map ...
CALL sub_save_array_as_PPM(elev, "terr50_gagg_gb.ppm", "jet")
! Clean up ...
DEALLOCATE(elev)
END PROGRAM main