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