Commit 8ff639c0 authored by thomas.forbriger's avatar thomas.forbriger
Browse files

[WP] (issue7_refract): define upper limit for single precision values

parent 8b7301b6
......@@ -50,6 +50,8 @@ c defined in refract_seipar.inc
c
integer i
logical reverse
real limit
parameter(limit=1.e38)
c
include 'refract_dim.inc'
include 'refract_data.inc'
......@@ -59,6 +61,20 @@ c
cE
c
c ----------------------------------------------------------------------
c limit
c -----
c
c To prevent numerical overflow, we must set an upper limit for floating
c point single precision variables. Fortran 95 provides a function
c huge(), where
c
c huge(1.0)=3.40282347E+38
c
c in a standard Intel environment with gfortran. Since this function
c might not be available for users relying on the code being compiled
c with a standard Fortran 77 compiler, I set the limit to 1.e38
c
c ----------------------------------------------------------------------
c
c tov stands for total viewport
c trv stands for trace viewport
......@@ -143,29 +159,60 @@ c coordinates in counts.
c -----------------------------------------------------------
c
c factor "world coordinates -> normalized device coordinates"
c derived from the total viewport
vppm=(tov_vptop-tov_vpbot)/(tov_rmax-tov_rmin)
c
c result will be true in case we expect any part of the curve to be visible
c within the trace viewport
result=.true.
c
c get clipping region in terms of the total viewports world coordinates
c a) Calculate raw offset range
c -----------------------------
c
c The offset range to be used for display of this trace is defined by
c the clipping margin to larger and smaller offsets, centred on the
c trace's offset.
c
c Calculate the raw offset range to be used, simplay based on trace's
c offset and clipping level:
trv_rtop=roffset(i)+plpar_clip
trv_rbot=roffset(i)-plpar_clip
c
c Check if this - maybe - already is outside global plot range
c
c will there anything be visible
if ((trv_rtop.lt.tov_rmin).or.(trv_rbot.gt.tov_rmax))
& result=.false.
c
if (result) then
c
c b) Adjust offset range
c ----------------------
c
c The offset range defined by the clipping margin might partly be
c outside the global offset range.
c
c respect clipping by total viewport
trv_rtop=min(trv_rtop, tov_rmax)
trv_rbot=max(trv_rbot, tov_rmin)
c
c trv_rtop and trv_rtop now specify the actual offset range in the
c window of the total graphical viewport to be used for the display of
c the current trace. If any sample value should fall outside this offset
c range, they shall now be displayed.
c
c c) Find corresponding viewport in device coordinates
c ----------------------------------------------------
c
c To select a plot area on the device surface, we have to use normalized
c device coordinates.
c
c map to a viewport range
trv_vpbot=(trv_rbot-tov_rmin)*vppm+tov_vpbot
trv_vptop=(trv_rtop-tov_rmin)*vppm+tov_vpbot
c
c d) Find world coordinates for traces viewport in counts
c -------------------------------------------------------
c
c remap equivalent offset to seismogram counts
if (reverse) then
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment