Reflection files format: Difference between revisions

Jump to navigation Jump to search
→‎LCF: get ncol from header
(→‎LCF: get ncol from header)
Line 219: Line 219:


i=COMMAND_ARGUMENT_COUNT()
i=COMMAND_ARGUMENT_COUNT()
IF (i/=3) STOP 'usage: lcf_dump <name.LCF> ncol offset'
IF (i/=2) STOP 'usage: lcf_dump <name.LCF> offset'
! read command line
! read command line
CALL GET_COMMAND_ARGUMENT(1,string)  ! expects LCF filename on command line
CALL GET_COMMAND_ARGUMENT(1,string)  ! expects LCF filename on command line
Line 227: Line 227:
WRITE(*,*) 'LCF file: ',TRIM(string)
WRITE(*,*) 'LCF file: ',TRIM(string)


CALL GET_COMMAND_ARGUMENT(2,string)  ! expects NCOL
CALL GET_COMMAND_ARGUMENT(2,string)  ! expects OFFSET
READ(string,*) ncol
ALLOCATE(refdat(ncol))
 
CALL GET_COMMAND_ARGUMENT(3,string)  ! expects OFFSET
READ(string,*) offset
READ(string,*) offset
WRITE(*,*) 'ncol, offset:',ncol,offset
WRITE(*,*) 'ncol, offset:',ncol,offset
Line 238: Line 234:
READ(1) header,separator  ! reads 8*2+12 bytes. ends after byte 28
READ(1) header,separator  ! reads 8*2+12 bytes. ends after byte 28
WRITE(*,'(a,8(i0,1x))') ' header: ',header
WRITE(*,'(a,8(i0,1x))') ' header: ',header
IF (header(1) /= -32768) STOP 'error - first header item is not -32768'
IF (header(5) == -12) THEN
  ncol=6
ELSE IF (header(6)==-14) THEN
  ncol=7
ELSE
  ncol=-header(7)/2
  IF (ncol<0 .OR. ncol>100) STOP 'error - could not determine ncol'
END IF
WRITE(*,'(a,i0))') ' ncol: ',ncol
ALLOCATE(refdat(ncol))
DO i=1,6
DO i=1,6
   READ(1) cell(i),separator  ! reads 6*(4+12) bytes. ends after byte 124
   READ(1) cell(i),separator  ! reads 6*(4+12) bytes. ends after byte 124
1,330

edits

Cookies help us deliver our services. By using our services, you agree to our use of cookies.

Navigation menu