[Proj] lla file format

Clifford J Mugnier cjmce at lsu.edu
Tue Feb 26 14:19:10 EST 2008


Is this what you need?
 
Cliff Mugnier
LOUISIANA STATE UNIVERSITY
 
c       program convert.ftn  -- cpfs csm golden,co
c
c       this routine converts ascii files of x,y,z1,z2,...zn 
c       data to the center format for binary file storage
c       the interactive nature allows for creation of the
c       appropriate headers and file formats
c
c----------------------------------------------------------------
      program convdam
      parameter(nfile=50,nx=6000,ny=10)
      character rident*56,pgm*8,filin(nfile)*30,
     1          filout*30,formin*56
      character gname(nfile)*8
      dimension data(ny,nx),zero(ny)           
      common /inout/ iit,iot
      common /input/ nv,nr,formin,rident,pgm,filout
c      data iit,iot/5,6/,in,iout/30,31/,nc/-1/
c      data pgm/'convertd'/
      data x0,dx,y0,dy,angle/5*0.0/,zero/ny*0.0/
 iit = 5
 iot = 6
 in = 30
 iout = 31
 nc = -1
 pgm = 'convertd'
c
c......................................................................
1000  format(///,5x,'this program converts a formatted data file to',/,
     &           5x,'an unformatted binary file conforming to the  ',/,
     &           5x,'center format',//,' ** warning - the input files',
     &              ' are assumed to have a uniform format;',
     &            /,' all the groups are to have the same number',
     &              ' and type of variables',//,
     &           5x,'each group will come from one input file.',//,
     &           5x,'program is dimensioned to read',i3,' files of',/,
     &           8x,i6,' variables per sample',/,
     &           8x,i6,' samples per group',//)
1005  format(' enter number of input-files/output-groups',
     &       ' (eg. flightlines):')
1010  format(' enter filename for input file ',i3,' :')
1020  format(/,' enter filename for output file:')
1030  format(a30)                         
1040  format(///,5x,'enter header information,up to 56 characters',/,
     &           5x,'this should include data identifier',/,
     &           5x,'and coordinate system used !!')
1050  format(a56)
1070  format(/,5x,'enter the number of variables at each location',/,
     &         5x,'this includes the x and y locations')             
1080  format(/,5x,'enter the format of the input file records',/,
     &         5x,'e.g. (3f20.4)    ')
1100  format(' enter an groupname (8 char) for input file ',a30,)
1110  format(a8) 
1120  format('there will be',i3,' sample sets on each binary record')
1130  format(' there are ',i6,' samples in group: ',a8)
1300  format(' cannot open file ',a30,/,' reenter correct name:')
1400  format(' error in read; current format: ',a56,//,
     &       ' fix file and/or reenter correct format:')
c......................................................................
c
c...write intro to screen
      write(iot,1000)nfile,ny,nx
c...get in and out filenames 
             
      write(iot,1005)
      read(iit,*)nr
      do 50 i = 1,nr
         write(iot,1010)i
         read(iit,1030)filin(i)
50    continue
      write(iot,1020)
      read(iit,1030)filout
c
c...get input information from user and set pgm for header
c
      write(iot,1040)
      read(iit,1050)rident
      write(iot,1070)
      read(iit,*)nv
      write(iot,1080)
      read(iit,1050)formin
      do 60 i = 1,nr
         write(iot,1100)filin(i)
         read(iit,1110)gname(i)
60    continue
c
c...check input information and allow for changes
c
      call go(nfile,filin,gname)
c
c...now figure number of samples that will fit in 256 bytes
c
      nrec=64/nv
      write(iot,1120)nrec
c
c...open output file
c
      open(iout,file=filout,access='direct',
     *     form='unformatted',status='unknown',recl=256)
c      rewind(iout)
c
c...write header to output file
c
      nrd = 1
      write(iout,rec=nrd)rident,pgm,nc,nr,nv,x0,dx,y0,dy,angle                
      nrd = nrd + 1
c
c...proceed to open input data files
c              
      do 70 if=1,nr
1     open(in,file=filin(if),status='old',err=2000)
      rewind(in)
c...read in file/group data and recover the number of samples (nsamp)
                                                                    
      j = 1
80    read(in,fmt=formin,end=100,err=3000) (data(k,j),k=1,nv)
      j = j + 1
      goto 80
100   nsamp = j - 1
c...write group header to binary file
      write(iout,rec=nrd)gname(if),nsamp
      nrd = nrd + 1                       
      write(iot,1130)nsamp,gname(if)
c...check to see if last binary record is filled
c   (use integer division)
                       
      numrec = nsamp / nrec
      nsleft = nsamp - (nrec*numrec)
      if(nsleft.eq.0)then
         numwri = numrec
      else
         numwri = numrec + 1
      endif
c...see how many zeros are in remainder part of record
      nremain = 64 - nv * nrec
      
c...write this data to records (extra space in records are zeros)
                  
      do 110 k=1,numwri
         write(iout,rec=nrd)((data(j,i),j=1,nv),i=(k-1)*nrec+1,k*nrec),
     1                                         (zero(ir),ir=1,nremain)
         nrd = nrd + 1    
110   continue
c...zero data array for next file read
c
      do 120 kk=1,nx
         do 130 kkk=1,ny
            data(kkk,kk) = 0.0
130      continue
120   continue
              
c...loop back up and write next file
      close(in)
      go to 70
2000  write(iot,1300)filin(if)
      read(iit,1030)filin(if)
      goto 1
3000  write(iot,1400)formin
      read(iit,1050)formin
      goto 80
70    continue
c
      close(iout)
      stop    
      end
c-------------------------------------------------------------------
      subroutine go(nfile,filin,gname)
c
c  purpose: allows alteration of input parameters
c
      character rident*56,pgm*8,filin(nfile)*30,ac*1,
     1     filout*30,formin*56,gname(nfile)*8,
     1     buffer*200
      common /inout/ iit,iot
      common /input/ nv,nr,formin,rident,pgm,filout
c....................................................................
100   format(/,' there are ',i3,' input data files:',/)
102   format(' file ',i3,' is :',a30)
103   format(/,'  enter filename number to change: ',/,
     1         '  (enter 0 if no changes desired)')
104   format(/,' file ',i3,' is presently :',a30,/,
     1         ' please enter correct filename :')
105   format(a30)
110   format(/,' there are ',i3,' group names:',/)
111   format(' group ',i3,' is :',a8)
112   format(/,'  enter groupname number to change: ',/,
     1         '  (enter 0 if no changes desired)')
113   format(/,' group ',i3,' is presently :',a8,/,
     1         ' please enter correct groupname (8 char):')
114   format(a8)
300   format(/,' okay, enter changes ... (c/r twice when finished)',/)
301   format(a1)
c....................................................................
200     write(iot,400)nr,nr,formin,filout,rident,pgm,nr,nv
400     format(/////,
     1  ' the following are the control parameters:',//,
     1  ' 1. enter  1  to change any of the ',i3,' input files',/,
     1  ' 2. enter  2  to change any of the ',i3,' group names',/,
     1  ' 3. input files format (assumed the same): ',/,4x,a56,/,
     1  ' 4. output filename: ',/,4x,a30,/,
     1  ' 5. output file header comment:',/,4x,a56,/,
     1  ' 6. program title (8 CHARACTERS): ...................',A8,/,
     1  ' 7. NUMBER OF DATA Groups in output file: ...........',i3,/,
     1  ' 8. number of variables per sample: .................',i3,//)
        write(iot,*)' do you wish to change anything ? (y/n) :'
        read(iit,301)ac                        
            if(ac.eq.'n'.or.ac.eq.'n')return
            write(iot,300)
c    an 80 character buffer is used to input the changed parameters
c    from the crt screen.  the number identifying the parameter is
c    read first then the parameter is read.  changes are accordingly
c    made.                          
c
201           read(iit,fmt='(a)',end=200)buffer
                read(buffer(1:2),403)chng              
403             format(f2.0)       
410             format(f2.0,1x,a8)
420             format(f2.0,1x,a30)
430             format(f2.0,1x,a56)
440             format(f2.0,1x,i3)
              if(chng.eq.1.0)goto 500
              if(chng.eq.2.0)goto 600
              if(chng.eq.3.0)read(buffer,430)chng,formin
              if(chng.eq.4.0)read(buffer,420)chng,filout
              if(chng.eq.5.0)read(buffer,430)chng,rident
              if(chng.eq.6.0)read(buffer,410)chng,pgm
              if(chng.eq.7.0)read(buffer,440)chng,nr
              if(chng.eq.8.0)read(buffer,440)chng,nv
              if(chng.eq.0.0)goto 200
              goto 201
c
500   write(iot,100)nr
      do 501 i=1,nr
         write(iot,102)filin(i)
501   continue
      write(iot,103)
      read(iit,*)ichng
      if(ichng.eq.0)goto 200
      write(iot,104)ichng,filin(ichng)
      read(iit,105)filin(ichng)
      goto 500
600   write(iot,110)nr
      do 601 i=1,nr
         write(iot,111)gname(i)
601   continue
      write(iot,112)
      read(iit,*)ichng
      if(ichng.eq.0)goto 200
      write(iot,113)ichng,gname(ichng)
      read(iit,114)gname(ichng)
      goto 600
c
      end

________________________________

From: proj-bounces at lists.maptools.org on behalf of Eric Miller
Sent: Tue 26-Feb-08 12:00
To: PROJ.4 and general Projections Discussions
Subject: Re: [Proj] lla file format



As far as I can tell, it is only documented in the Fortran source code for nadgrd.  Get the sources and read "readme.grd" for some help...

"""
The program NADCON reads binary grids that contain NAD 27 to NAD 83
latitude and longitude shifts.  The first record in a grid file consists of
header information.  All the other records consist of FORTRAN REAL*4
numbers.  The grid files are unformatted and direct access.

...
""" 

>>> On 2/16/2008 at 5:30 PM, "Richard Greenwood" <richard.greenwood at gmail.com>
wrote:
> Can anyone point me to documentation of the *.lla file format?


_______________________________________________
Proj mailing list
Proj at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/proj


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20080226/f2ae7517/attachment-0001.html


More information about the Proj mailing list