App-SeismicUnixGui

 view release on metacpan or  search on metacpan

lib/App/SeismicUnixGui/fortran/src/immodpg.for  view on Meta::CPAN

       write_model_bin_opt                = 71
       exit_opt                           = 99
       option_default                     = -1
       option                             = option_default
!      default velocity model km per sec
!      a2 is X coord-top_right (Vel-km/s); Vmax
!      a1 is Y coord (depth-km), Zmax
!      bottom left model - ymax can be negative
!       a1 =  0.0
!       a2 = -1.0
!       a1_prior =  0.0
!      a2_prior = -1.0
!       datax1          nearest offset (km)
!       datadx          trace offset increment (km)
!       datadt          sample interval (s)
!       datat1          time value of first sample (s)
!       governor        multiplicative value to slow down
!                       GUI looping
!       inbound_bin    full path to stripped su file
!       inbound_par     path to the parameter file
!       dp              increment of p for each ray
!       nlmax           maximum number of layers allowed
!       nchanges        number of gui interactions allowed
!       npmax           maximum number of  allowded
!       npamax          maximum number of  allowded
!       ns              number of samples per trace
!       ntp             total number of computed points
!       ntr             number of traces in file
!       ntrmax          maximum number of traces allowed
!       nsmax           maximum number of samples allowed
!       par_file        contains no. traces, no. samples, SI (usec)
!       start_change    time at which GUI induces a change
!       last_change     array of times at which GUI is clicked
!       change_step     array of time delays between GUI clicks

!       Amp_min         minimum amplitude
!       Amp_max         maximum amplitude
!       multin
!       rv_kmps 		reducing velocity km/s
!       rvinv_kmps      reduction velocity km/s
!
!       how often user calls immodpg via a click in the  gui
        thickness increment_m = 10.
        Vincrement_mps        = 10.
!       tout             time output, 
!       Aug 2013 by Juan
!       va and va_prior, za and za_prior are velocity  and depth
!       vectors for plotting the velocity-versus-depth model om
!       far right side
!       xa1
!       xa2
!       xa3
!       xa4
!       xout
!       output distance of distance,time calculated pairs
!       va
!       za
!       xmax    maximum plotting distance
!               Should be greater than maximum offset in
!               order to allow V-Z plot to show on black
!               background ; in km
!       tmax    maximum time of data
!       tmin    minimum time of data
!       xinc    increment for km/s in modeling or thickness in modelign

! DEFAULT PARAMETERS
! OLD values for big-scale marine work
! 	pmin   = 0.0
! 	pmax   = 3.0
! 	pmax   = .6
       km2m  = 1000.
       m2km  = .001
       us2ms = .001
       ms2us = 1000
       sdepth = 0.0
       rdepth = 0.0

! pmax = 40 s/km   V= 25 m/s
! pmin = 5   s/km  V= 200 m/s
!
       pmin   = 0
       pmax   = 40
! 	dp     = 0.0005
! 	dp     = 0.001
	dp     = 0.0001
        vmf    = 1./sqrt(3.)
! reduction velocity
	rv_kmps     = 0.0
	    
!   In km
	xmin   = 0.0
	xmax   = 0.120
! 	xmax   = 20.
! 	delt   = -10 ms
! 	tmin   = -0.010
	 tmin   = 0.0
! 	tmax   = 6
	 tmax   = 1.
       current_layer_number    = 1
	icolor = 0
	xinc   = 0.1
	iout   = 35
	datadx = 0.001
! 	datadx = 0.2
        datax1 = 0.001
!        datax1 = 0
! 	datadt = 0.005
        datat1 = 0.0
        flag   = .false.
       idred  = 0
       idrdtr = 0
       idrxy  = 0
!
	  do i=1,nlmax
		multin(i) = 1
	  enddo

! define the different needed directories
        set_DIR = "IMMODPG"
       call Project_config(set_DIR,get_DIR)
       

lib/App/SeismicUnixGui/fortran/src/immodpg.for  view on Meta::CPAN

140     continue ! go to a new layer
!
! Draw digitized X-T data if it exists
!
       if(idrxy.eq.1) then

         do ixy = 1,ndxy
             xa2(ixy) = tdig(ixy) - xdig(ixy) * rvinv_kmps
         enddo

	   call pgsci(3)
         call pgpoint(ndxy,xdig,xa2,9)  ! TODO perhaps
         print *, 'L647 Draw digitized X-T data if it exists'

       endif
!
! Draw velocity vs. depth plot at far right
! for pgvport:
!  left_bottom_X, right_top_X,left_bottom_Y,right_top_Y
! STEP 1: Erase previous model
! 0 = black (erase)
       VPlotMax_prior=a2_prior*VPlotScale
       ZPlotMax_prior=a1_prior*1.0
       call pgsci(0)
       call pgvport(0.8,0.98,0.15,0.9)
       call pgwindow(0.0,VPlotMax_prior,ZPlotMax_prior,0.0)
       call pgbox('BCTN',0.0,0,'BCNST',0.0,0)
       call pglabel('V(km/s)','Z(km)','')
       call pgline(2*current_layer_number,va_prior,za_prior)
!       print *, 'L 555 current layer number is ', current_layer_number
!       print *, 'L 556 end of draw velocity model'

! STEP 2: Calculate the current model
! ****** descomentar para trabajo con OBS  ***
!       dz(1) = 2.0 * dz(1)
! ***********************
       a1=0.
       a2=-1.0
       do 145 i = 1,current_layer_number
              k = 2*i - 1
              va(k) = vt(i)
              if(vt(i).gt.a2) a2=vt(i)
              za(k) = a1
              va(k+1) = vb(i)
              if(vb(i).gt.a2) a2=vb(i)
              a1 = a1 + dz(i)
              za(k+1) = a1
145    continue

! STEP 3: Save the current model as the "prior"
       a1_prior = a1
       a2_prior = a2
       va_prior = va
       za_prior = za

! STEP 4: Draw the current model
! ****** descomentar para trabajo con OBS  ***
!       dz(1) = dz(1)/2.0
! ***********************
! set color index: 3 = green
! white on black background =1
       call pgsci(3)
       VPlotMax=a2*VPlotScale
       ZPlotMax=a1*1.0
 !     print*,'L711,a1,a2',a1,a2
       call pgvport(0.8,0.98,0.15,0.9)
	   call pgwindow(0.0,VPlotMax,ZPlotMax,0.0)
	   call pgbox('BCTN',0.0,0,'BCNST',0.0,0)
	   call pglabel('V(km/s)','Z(km)','')
!	   call pgslw(5)
	   call pgline(2*current_layer_number,va,za)
!      print *, 'L 594 current layer number is ', current_layer_number
!	   call pgslw(1)
!      print *, 'L 596 end of draw velocity model'

150    continue

!      define the different needed directories
       set_DIR = "IMMODPG_INVISIBLE"
       call Project_config(set_DIR,get_DIR)
!      print*, '1. immodpg.for, get_DIR:',trim(get_DIR),'--'
!      print*, '1. immodpg.for, change_file:',change_file,'--'
       inbound_change = trim(get_DIR)//"/"//change_file
       inbound_clip   = trim(get_DIR)//"/"//clip_file
!      print*, '1.immodpg.for,inbound_change:',inbound_change,'--'

       ans = .TRUE.
       icount=0;

       do while (ans)

! Slow down fortran for Perl i/o to .001 s
!        call cpu_time(start)
!        print '("Time = ",f6.3," seconds.")',start
! 151    call cpu_time(finish)
!        print*,'slowing'
!        cpu_duration = finish-start
!        print '("Time = ",f6.3," seconds.")',cpu_duration

!        if (cpu_duration .lt. time_delay) then
         sleep_time_usec = sleep_time_ms * ms2us
         record_sleep = c_usleep(sleep_time_usec)
!         print '("sleeping",i20,"milliseconds.")',sleep_time_ms
!         go to 151
!        endif
        
!        print '("Time = ",f6.3," seconds.")',cpu_duration

           icount=icount+1
!          print *, 'L 722 do loop: immodpg,icount=',icount
! Detect for change:  "yes"
!          print*, '2. immodpg.for,inbound_change:',inbound_change,'--'

           call read_yes_no_file(is_change,inbound_change)
           
!          print*, '737.immodpg.for,is_change:',is_change,'--'
           if (is_change ) then
! keep track of change frequency
              i_past_change   = i_change    
              i_change        = i_change+1
              



( run in 1.371 second using v1.01-cache-2.11-cpan-f56aa216473 )