NADCON5-ng  0.0.2
NADCON5 Next Generation Documentation
b2xyz.f
Go to the documentation of this file.
1 c> \ingroup core
2 c> \if MANPAGE
3 c> \page b2xyz
4 c> \endif
5 c>
6 c> Part of the NADCON5 \ref core , converts `*.b` grid to `xyz`
7 c>
8 c> Program to convert standard "*.b" grid
9 c> formatted data to a binary xyz (lon, lat, value)
10 c> list, which can then be used by GMT for
11 c> various things (like running the GMT
12 c> routine "xyz2grd", to get a "*.grd"
13 c> file, which is useful for plotting, etc)
14 c>
15 c> ### Program arguments
16 c> Arguments are newline terminated and read from standard input
17 c>
18 c> When run from the command line, the program prints a prompt for each argument
19 c>
20 c> They are enumerated here
21 c> \param infile Input File Name
22 c>
23 c> ### Program Inputs:
24 c>
25 c> - Input File defined by `infile`
26 c>
27 c> ### Program Outputs:
28 c>
29 c> - `temp.xyz`
30 c>
31  program b2xyz
32  implicit real*8(a-h,o-z)
33  character*200 fnamein,fnameout,prefix
34  real*4 data(100000)
35  integer*4 idata(100000)
36  real*4 xlo,xla,val
37  equivalence(data(1),idata(1))
38 
39 c ------------------------------------------------
40 c - User-supplied file name
41 c ------------------------------------------------
42  read(5,'(a)')fnamein
43  open(1,file=fnamein,status='old',form='unformatted')
44  read(1)glamn,glomn,dla,dlo,nla,nlo,ikind
45 c ll = len(trim(fnamein))
46 c prefix = fnamein(1:ll-2)
47 c fnameout = prefix//'.xyz'
48  fnameout = 'temp.xyz'
49  open(2,file=fnameout,status='new',form='binary')
50 
51 c - Read, compute location, and write
52  do 1 i=1,nla
53  if(ikind.eq.1)read(1)( data(j),j=1,nlo)
54  if(ikind.eq.0)read(1)(idata(j),j=1,nlo)
55  xla = glamn + (i-1)*dla
56  do 2 j=1,nlo
57  xlo = glomn + (j-1)*dlo
58  if(ikind.eq.1)val = data(j)
59  if(ikind.eq.0)val = dble(idata(j))
60  write(2)xlo,xla,val
61  2 continue
62  1 continue
63  end
program b2xyz
Part of the NADCON5 NADCON5 Core Library , converts *.b grid to xyz
Definition: b2xyz.f:31