NADCON5-ng  0.0.1
NADCON5 Next Generation
gabs.f
Go to the documentation of this file.
1 c> \ingroup core
2 c> Part of the NADCON5 \ref core , Convert values in a `*.b` grid to absolute value
3 c>
4 c> Belongs to the suite of ".b" file manipulators
5 c>
6 c> This program will convert every value in a ".b" grid
7 c> to its absolute value.
8 c>
9 c> ### Program arguments
10 c> Arguments are newline terminated and read from standard input
11 c>
12 c> When run from the command line, the program prints a prompt for each argument
13 c>
14 c> They are enumerated here
15 c> \param infile Input File Name
16 c> \param outfile Output File Name
17 c>
18 c> ### Program Inputs:
19 c>
20 c> - `lin` Input File (`*.b` grid)
21 c>
22 c> ### Program Outputs:
23 c>
24 c> - `lout` Output File (`*.b` grid)
25 c>
26  program gabs
27 
28 c - Belongs to the suite of ".b" file manipulators.
29 
30 c - This program will convert every value in a ".b" grid
31 c - to its absolute value.
32 
33  implicit real*8(a-h,o-z)
34  character*200 fnamei,fnameo
35  integer hrec(100000)
36  real*4 zrec(100000),nw,ne,sw,se,zmin,zmax
37  integer*2 srec(100000)
38  equivalence(hrec(1),zrec(1),srec(1))
39 
40  lin = 1
41  lout = 99
42 
43  write(6,*) 'Program gabs - converts a grid to ABS values'
44 
45  write(6,2)
46  2 format('Enter the input grid file name: ',$)
47  read(5,'(a)') fnamei
48  open(lin,file=fnamei,status='old',form='unformatted')
49 
50  write(6,3)
51  3 format('Enter the output grid file name: ',$)
52  read(5,'(a)') fnameo
53  open(lout,file=fnameo,status='new',form='unformatted')
54 
55 
56 *** display header contents
57 
58  read(lin) glamn,glomn,dgla,dglo,nla,nlo,ikind
59  write(lout) glamn,glomn,dgla,dglo,nla,nlo,ikind
60 
61 *** read records south to north (elements are west to east)
62 
63  if(ikind.eq.0) then
64  do 9 irow=1,nla
65  read(lin)(hrec(i),i=1,nlo)
66  do 8 i=1,nlo
67  hrec(i) = int(abs(hrec(i)))
68  8 continue
69  write(lout)(hrec(i),i=1,nlo)
70  9 continue
71 
72  elseif(ikind.eq.1)then
73  do 7 irow=1,nla
74  read(lin) (zrec(i),i=1,nlo)
75  do 6 i=1,nlo
76  zrec(i) = abs(zrec(i))
77  6 continue
78  write(lout)(zrec(i),i=1,nlo)
79  7 continue
80 
81  elseif(ikind.eq.-1)then
82  do 10 irow=1,nla
83  read(lin) (srec(i),i=1,nlo)
84  do 11 i=1,nlo
85  srec(i) = int(abs(srec(i)))
86  11 continue
87  write(lout)(srec(i),i=1,nlo)
88  10 continue
89 
90  elseif(ikind.eq.2)then
91  do 90 irow=1,nla
92  read(lin) (srec(i),i=1,nlo)
93  do 91 i=1,nlo
94  srec(i) = int(abs(srec(i)))
95  91 continue
96  write(lout)(srec(i),i=1,nlo)
97  90 continue
98 
99  else
100  stop 'Bad ikind'
101  endif
102 
103  stop
104  end
program gabs
Part of the NADCON5 NADCON5 Core Library , Convert values in a *.b grid to absolute value...
Definition: gabs.f:26