/* JRG, the Resource Geology Seismic Processing System for Java, and Viewmat for Java are Copyright 1998-2007 by John N. Louie License is hereby granted for anyone to make any use of this software and its associated source and compiled binary codes, including free re-distribution, and incorporation into commercial products, provided this copyright notice is retained within all files, versions, and distribution media substantially incorporating John Louie's original work. The software and methods here are the subject of academic research, not commercial products. I would like to know what use you make of my methods, and have your feedback on their success or failure. Also, by letting me know who you are, I can inform you if bugs or errors are discovered. Please send me an email message with: your name and email address; whether you are a student or faculty member, consultant or employee; the name of your university or company, and department; and a sentence or two describing what use you intend to make of these methods. Send your message to louie@seismo.unr.edu */ import java.util.*; import java.io.*; import java.lang.Math; import java.awt.*; import java.awt.image.*; import java.awt.event.*; class testvol { public static void main(String args[]) { int i; System.out.println("Starting construction and reading."); /* FltVol fltvol = new FltVol(149, 80, 170); fltvol.readBinaryFile("/Users/louie/dixie/d.seis/d.simult/d.src101/simult.ts", 0); FltVol fvol = new FltVol(74, 80, 170); fvol.windowof(fltvol, 0, 2, 0, 1, 0, 1); fltvol = fvol; fltvol.createBinaryFile("simult.ts"); FltVol fltvol = new FltVol(74, 80, 170); fltvol.readBinaryFile("simult.ts", 0); float rms = fltvol.rms(); fltvol.setAmpUnits("Acoustic Amplitude"); fltvol.setUnitsofDim(0, "Distance from 1954 Rupture, meters"); fltvol.setDUnitofDim(0, 15F); fltvol.setUnitsofDim(1, "Depth, m"); fltvol.setDUnitofDim(1, 15F); fltvol.setUnitsofDim(2, "seconds"); fltvol.setDUnitofDim(2, 0.02F); fltvol.viewinFrame("So. Dixie Val. src101 Synthetic", false, 1F, RgCtab.yglobe, false, 5F*rms); */ FltVol fltvol = new FltVol(10, 21, 1000); fltvol.readBinaryFile("test.flt", 0); fltvol.setUnitsofDim(0, "Time, sec"); fltvol.setDUnitofDim(0, 0.001F); fltvol.viewinFrame("test.flt", true, (0.001F*2000F/2F)/15.24F, RgCtab.rwb, false, -1F); /* FltPlane fp = new FltPlane(100, 178); fp.readBinaryFile("dixie-migvels", 0); fp.addc(-(fp.min())); fp.viewinFrame("dixie-migvels", false, 1F, RgCtab.yglobe, true, -1F); */ } } class DixieSimultmod { public static void main(String args[]) { int i; System.out.println("Starting construction and reading."); FltVol fltvol = new FltVol(74, 80, 170); fltvol.readBinaryFile("simult.ts", 0); float rms = fltvol.rms(); fltvol.setAmpUnits("Acoustic Amplitude"); fltvol.setUnitsofDim(0, "Distance from 1954 Rupture, meters"); fltvol.setDUnitofDim(0, 15F); fltvol.setUnitsofDim(1, "Depth, m"); fltvol.setDUnitofDim(1, 15F); fltvol.setUnitsofDim(2, "seconds"); fltvol.setDUnitofDim(2, 0.02F); fltvol.viewinFrame("So. Dixie Val. src101 Synthetic", false, 1F, RgCtab.yglobe, false, 5F*rms); } } public class FltVol extends FltPlane { public int nv; public int planes; public String PlaneUnits; public float Plane0; public float DPlane; Scrollbar sb; Label sbl0; FltVolCanvas fvc; public static Menu makeMethodsMenu() { Menu methods = new Menu("On Each Plane", true); /*methods.add(new MenuItem("demultPlanes"));*/ methods.add(new MenuItem("cmpstack")); methods.add(new MenuItem("cvstack")); methods.add(new MenuItem("cutTime")); methods.add(new MenuItem("decimate")); methods.add(new MenuItem("dipfil")); methods.add(new MenuItem("flatten")); methods.add(new MenuItem("hann")); methods.add(new MenuItem("makevels")); methods.add(new MenuItem("mirror")); methods.add(new MenuItem("pad")); methods.add(new MenuItem("reduceT")); methods.add(new MenuItem("shade")); methods.add(new MenuItem("slantPlanes")); methods.add(new MenuItem("smooth")); methods.add(new MenuItem("sort")); methods.add(new MenuItem("stackHits")); methods.add(new MenuItem("vspect")); methods.add(new MenuItem("vspectSum")); methods.add(new MenuItem("window")); methods.add(new MenuItem("windowPlane")); methods.add(new MenuItem("xcorInterf")); /* Add new FltVol methods below: */ return methods; } public static void handleMethod(ViewmatFrame f, boolean inplace, String label) { f.setCursor(Cursor.WAIT_CURSOR); boolean redimension; redimension = false; String title = f.vm.title + " + " + label; ViewmatAction vad = new ViewmatAction(f); vad.beginPanel(); if (label.equals("cmpstack")) { inplace = false; redimension = true; FltVol.cmpstackPanel(vad, f, inplace, label, 2); } else if (label.equals("cvstack")) { inplace = false; redimension = true; FltVol.cmpstackPanel(vad, f, inplace, label, 0); } else if (label.equals("cutTime")) { inplace = false; redimension = true; FltPlane.cutTimePanel(vad, f, inplace, label); } else if (label.equals("decimate")) { inplace = false; redimension = true; FltVol.decimatePanel(vad, f, inplace, label); } else if (label.equals("dipfil")) FltVol.dipfilPanel(vad, f, inplace, label); else if (label.equals("flatten")) { inplace = false; redimension = true; FltVol.flattenPanel(vad, f, inplace, label); } else if (label.equals("hann")) FltVol.hannPanel(vad, f, inplace, label); else if (label.equals("makevels")) { inplace = false; redimension = true; FltVol.cmpstackPanel(vad, f, inplace, label, 1); } else if (label.equals("mirror")) FltVol.mirrorPanel(vad, f, inplace, label); else if (label.equals("pad")) { inplace = false; redimension = true; FltPlane.padPanel(vad, f, inplace, label); } else if (label.equals("reduceT")) { inplace = false; redimension = true; FltVol.reduceTPanel(vad, f, inplace, label); } else if (label.equals("shade")) FltVol.shadePanel(vad, f, inplace, label); else if (label.equals("slantPlanes")) { inplace = false; FltVol.slantPlanesPanel(vad, f, inplace, label); } else if (label.equals("smooth")) FltVol.smoothPanel(vad, f, inplace, label); else if (label.equals("sort")) { inplace = true; FltVol.sortPanel(vad, f, inplace, label); } else if (label.equals("stackHits")) { inplace = false; redimension = true; FltPlane.stackHitsPanel(vad, f, inplace, label); } else if (label.equals("vspect") || label.equals("vspectSum")) { Class haveReMi = null; try { haveReMi = Class.forName("ReMi"); } catch (ClassNotFoundException cnfe) { haveReMi = null; } if (haveReMi == null) { f.Errout("ReMi not licensed to this system.\n" + "Please contact John N. Louie at louie@seismo.unr.edu\n" + "for licensing information."); vad.dispose(); f.setCursor(Cursor.DEFAULT_CURSOR); return; } else { inplace = false; redimension = true; ReMi.vspectPlanePanel(vad, f, inplace, label); } } else if (label.equals("window")) { inplace = false; redimension = true; FltVol.windowPanel(vad, f, inplace, label); } else if (label.equals("windowPlane")) { inplace = false; redimension = true; FltVol.windowPlanePanel(vad, f, inplace, label); } else if (label.equals("xcorInterf")) FltVol.xcorInterfPanel(vad, f, inplace, label); /* Add new FltVol methods below: */ if (inplace) vad.setTitle(label + " on " + f.getTitle() + " in-place"); else vad.setTitle(label + " on " + f.getTitle() + " to new window"); Button apply = new Button(label); vad.pp.add(apply); apply.addActionListener(vad); vad.finishPanel(); f.setCursor(Cursor.DEFAULT_CURSOR); vad.center(); vad.show(); if (vad.done == false) { vad.dispose(); return; } f.setCursor(Cursor.WAIT_CURSOR); FltVol fvol = null; FltPlane fp = null; MethodRun mrun = null; if (vad.noticeonly == true) fvol = f.vm.fvol; else if (inplace) fvol = f.vm.fvol; else { if (!redimension) { mrun = new MethodRun(f.vm.fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); fvol = mrun.fvol; } } if (label.equals("cmpstack")) { fvol = f.vm.fvol.docmpstack(vad, 2); mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); mrun.clip = 3F*fvol.rms(); fvol = null; } else if (label.equals("cvstack")) { fvol = f.vm.fvol.docmpstack(vad, 0); mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); mrun.clip = 3F*fvol.rms(); fvol = null; } else if (label.equals("cutTime")) { fvol = f.vm.fvol.docutTimeVol(vad); mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); fvol = null; } else if (label.equals("decimate")) { fvol = f.vm.fvol.dodecimateVol(vad); mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); fvol = null; } else if (label.equals("dipfil")) fvol.dodipfil(vad); else if (label.equals("flatten")) { fp = f.vm.fvol.flatten(vad.ch0.getSelectedIndex(), vad.ch1.getSelectedIndex()); mrun = new MethodRun(fp, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); fp = null; } else if (label.equals("hann")) fvol.dohann(vad); else if (label.equals("makevels")) { fvol = f.vm.fvol.docmpstack(vad, 1); mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); mrun.clip = fvol.max(); mrun.positive = true; mrun.ctab = RgCtab.yglobe; fvol = null; } else if (label.equals("mirror")) fvol.domirror(vad); else if (label.equals("pad")) { /*fvol = f.vm.fvol.dopadVol(vad);*/ mrun = new MethodRun(f.vm.fvol.dopadVol(vad), f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); /*fvol = null;*/ } else if (label.equals("reduceT")) { mrun = new MethodRun(f.vm.fvol.doreduceTPlanes(vad), f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); } else if (label.equals("shade")) { fvol.doshade(vad); /* f.vm.positive = true; f.vm.ctab = RgCtab.gray; */ } else if (label.equals("slantPlanes")) { FltVol tfvol = fvol.doslantPlanes(vad); fvol.vec = new float[tfvol.vec.length]; fvol.copyvals(tfvol); fvol.copyvec(tfvol); tfvol = null; } else if (label.equals("smooth")) fvol.dosmooth(vad); else if (label.equals("sort")) fvol.dosort(vad); else if (label.equals("stackHits")) { fvol = f.vm.fvol.dostackHitsVol(vad); if (fvol == null) { vad.dispose(); f.setCursor(Cursor.DEFAULT_CURSOR); return; } mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); fvol = null; } else if (label.equals("vspectSum")) { fp = ReMi.dovspectSum(f.vm.fvol, vad); mrun = new MethodRun(fp, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); mrun.clip = fp.max(); mrun.ve = 2.5F*fp.ne/fp.vecs/4.2F; fp = null; mrun.rowsdown = false; mrun.positive = true; mrun.ctab = RgCtab.yglobe; } else if (label.equals("vspect")) { fvol = ReMi.dovspectPlanes(f.vm.fvol, vad); mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); mrun.clip = fvol.max(); mrun.ve = 2.5F*fvol.ne/fvol.nv/4.2F; fvol = null; mrun.rowsdown = false; mrun.positive = true; mrun.ctab = RgCtab.yglobe; } else if (label.equals("window")) { fvol = f.vm.fvol.dowindowVol(vad); mrun = new MethodRun(fvol, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); fvol = null; } else if (label.equals("windowPlane")) { fp = f.vm.fvol.dowindowPlane(vad); mrun = new MethodRun(fp, f.fd.getDirectory(), title, f.vm.rowsdown, f.vm.ve, f.vm.ctab, f.vm.positive, f.vm.clip); fp = null; } else if (label.equals("xcorInterf")) fvol.doxcorInterf(vad); /* Add new FltVol methods below: */ if (vad.noticeonly == true) { vad.dispose(); f.setCursor(Cursor.DEFAULT_CURSOR); return; } vad.dispose(); if (inplace) { f.setTitle(title); f.props.setTitle(title + " Properties"); f.picks.setTitle(title + " Picks"); f.geom.setTitle(title + " Geometry"); f.vm.titletf.setText(title); /*f.vm.cvs.vmat.clip = f.vm.fvol.max();*/ f.vm.cvs.vmat.title = new String(title); f.vm.fvol.replotinFrame(f); f.vm.cvs.zoom(f.vm.fzoom); f.vm.resetPropsPanel(f.props, f.props.pp); f.vm.setParameters(f.props, f.props.pp); } else /* altered 3/1/06 JNL to workaround MacOS 10.4 bug thanks to Leiph Preston! new Thread(mrun).start(); */ mrun.run(); f.setCursor(Cursor.DEFAULT_CURSOR); return; } static void cmpstackPanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label, int action) /* action: 0=cvstack 1=makevels 2=cmpstack */ { vad.height = 450; CMPStack cmpstkpar = new CMPStack(f.vm.fvol); vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "The " + label + " method on class FltVol data\n" + (action==1 ? "obtains interpolated pick velocities\nor Dix interval velocities" : "obtains a common-midpoint stacked section") + (action==0 ? ".\n" : "for a range of constant NMO velocities.\n") + "Parameters below:\n" + "dt=" + cmpstkpar.dt + ": time between samples, s\n" + (action == 1 ? "" : "If traces are labeled with headers, they are\n" + "used in calculating 3-d midpoints and offsets;\n" + "otherwise supply the following 2-d geometry:\n" + " off0=" + cmpstkpar.off0 + ": offset of first trace, m\n" + " doff=" + cmpstkpar.doff + ": offset interval between traces, m\n" + " s0=" + cmpstkpar.s0 + ": source x-coord of first record, m\n" + " ds=" + cmpstkpar.ds + ": source x-coord increment between records, m\n") + "ntau=" + cmpstkpar.ntau + ": number of time points for stack (dtau = dt)\n" + "tau0=" + cmpstkpar.tau0 + ": initial stack time, s\n" + "VP0=" + cmpstkpar.VP0 + " : the stacked section will be formed from\n" + " common midpoints close to a line originating from\n" + " station number VP0, if headers, or from the\n" + " source location of the record at index VP0,\n" + " if no headers.\n" + "mangle=" + cmpstkpar.mangle + " : bearing of the midpoint line, degrees\n" + " clockwise from north (the y axis);\n" + " if no headers then this should be 90 or 270.\n" + "m0=" + cmpstkpar.m0 + ": distance from VP0 of first midpoint stack trace, m\n" + "nm=" + cmpstkpar.nm + ": number of midpoint stack traces to compute\n" + "dm=" + cmpstkpar.dm + ": distance between midpoint stack traces, m\n" + (action==1 ? "" : "arc=dm: midpoint locations will be binned for summing\n" + " into the stacked trace, in sectoral bins\n" + " centered about the midpoints on the stacking\n" + " line, dm long and arc wide.\n") + (action == 0 ? "v0=" + cmpstkpar.v0 + ": initial constant stacking velocity, m/s\n" : "") + (action == 2 ? "" : "nv=" + cmpstkpar.nv + ": number of constant velocities to output\n" + "dv=" + cmpstkpar.dv + ": velocity increment, m/s"), 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label(" dt (sec):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("" + cmpstkpar.dt, 6); vad.pp.add(vad.tf0); if (action != 1) { if (cmpstkpar.geomexists) { vad.lab1 = new Label(" Labeled Traces:"); vad.pp.add(vad.lab1); vad.lab2 = new Label(f.vm.fvol.getOffsets()); vad.pp.add(vad.lab2); } else { vad.lab1 = new Label(/*"Offset of first trace, m:"*/" off0, m:"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + cmpstkpar.off0, 6); vad.pp.add(vad.tf1); vad.lab2 = new Label(/*"Trace offset interval, m:"*/" doff, m:"); vad.pp.add(vad.lab2); vad.tf2 = new TextField("" + cmpstkpar.doff, 4); vad.pp.add(vad.tf2); vad.lab3 = new Label(/*"Source X of first record, m:"*/" s0, m:"); vad.pp.add(vad.lab3); vad.tf3 = new TextField("" + cmpstkpar.s0, 8); vad.pp.add(vad.tf3); vad.lab4 = new Label(/*"Src X incr betw records, m:"*/" ds, m:"); vad.pp.add(vad.lab4); vad.tf4 = new TextField("" + cmpstkpar.ds, 4); vad.pp.add(vad.tf4); } } vad.lab5 = new Label(/*"Num of time samples for stack:"*/" ntau:"); vad.pp.add(vad.lab5); vad.tf5 = new TextField("" + cmpstkpar.ntau, 4); vad.pp.add(vad.tf5); vad.lab6 = new Label(/*"Initial stack time, s:"*/" tau0, s:"); vad.pp.add(vad.lab6); vad.tf6 = new TextField("" + cmpstkpar.tau0, 4); vad.pp.add(vad.tf6); if (cmpstkpar.geomexists) vad.lab7 = new Label(/*"Stack line origin station:"*/ " VP0 (VP" + cmpstkpar.VP0 + " " + Viewmat.getSignif("" + cmpstkpar.VP0projdist, 4) + " m from proj origin):"); else vad.lab7 = new Label(/*"Stack origin src record index:"*/" VP0 (irec):"); vad.pp.add(vad.lab7); vad.tf7 = new TextField("" + cmpstkpar.VP0, 4); vad.pp.add(vad.tf7); vad.lab8 = new Label(/*"Stack line bearing, deg E of N:"*/" mangle, deg:"); vad.pp.add(vad.lab8); vad.tf8 = new TextField(Viewmat.getSignif("" + cmpstkpar.mangle, 4), 6); vad.pp.add(vad.tf8); vad.lab9 = new Label(/*"1st midpt dist from VP0, m:"*/" m0, m:"); vad.pp.add(vad.lab9); vad.tf9 = new TextField("" + cmpstkpar.m0, 4); vad.pp.add(vad.tf9); vad.lab10 = new Label(/*"Num of midpoints:"*/" nm:"); vad.pp.add(vad.lab10); vad.tf10 = new TextField("" + cmpstkpar.nm, 4); vad.pp.add(vad.tf10); vad.lab11 = new Label(/*"Dist betw midpts, m:"*/" dm, m:"); vad.pp.add(vad.lab11); vad.tf11 = new TextField("" + cmpstkpar.dm, 4); vad.pp.add(vad.tf11); if (action == 1) { vad.lab12 = new Label("Calculate:"); vad.pp.add(vad.lab12); vad.ch0 = new Choice(); vad.ch0.add("Interpolated NMO Velocities"); vad.ch0.add("Dix Interval Velocities"); vad.pp.add(vad.ch0); vad.ch0.select(0); } else { vad.lab12 = new Label(/*"Transverse midpt bin, m:"*/" arc, m:"); vad.pp.add(vad.lab12); vad.tf12 = new TextField("" + cmpstkpar.arc, 4); vad.pp.add(vad.tf12); } if (action == 0) { vad.lab13 = new Label(/*"Initial const vel, m/s:"*/" v0, m/s:"); vad.pp.add(vad.lab13); vad.tf13 = new TextField("" + cmpstkpar.v0, 6); vad.pp.add(vad.tf13); } else { vad.lab13 = new Label("Velocity Pick Text:"); vad.pp.add(vad.lab13); vad.picks = new TextArea(cmpstkpar.picktext, 5, 35); vad.pp.add(vad.picks); } if (action != 2) { vad.lab14 = new Label(/*"Num of velocities:"*/" nv:"); vad.pp.add(vad.lab14); vad.tf14 = new TextField("" + cmpstkpar.nv, 3); vad.pp.add(vad.tf14); vad.lab15 = new Label(/*"Velocity interval, m/s:"*/" dv, m/s:"); vad.pp.add(vad.lab15); vad.tf15 = new TextField("" + cmpstkpar.dv, 6); vad.pp.add(vad.tf15); } } public FltVol docmpstack(ViewmatAction vad, int action) /* action: 0=cvstack 1=makevels 2=cmpstack */ { CMPStack cmpstkpar = new CMPStack(this); float htemp; int temp; boolean noVP0=false; try {htemp = Float.valueOf(vad.tf0.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = cmpstkpar.dt; } cmpstkpar.dt = htemp; if (action != 1) { if (!cmpstkpar.geomexists) { try {htemp = Float.valueOf(vad.tf1.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = cmpstkpar.off0; } cmpstkpar.off0 = htemp; try {htemp = Float.valueOf(vad.tf2.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = cmpstkpar.doff; } cmpstkpar.doff= htemp; try {htemp = Float.valueOf(vad.tf3.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = cmpstkpar.s0; } cmpstkpar.s0 = htemp; try {htemp = Float.valueOf(vad.tf4.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = cmpstkpar.ds; } cmpstkpar.ds = htemp; } } try {temp = Integer.valueOf(vad.tf5.getText()).intValue(); } catch (NumberFormatException nfe) {temp = cmpstkpar.ntau; } if (temp <= 0) temp = cmpstkpar.ntau; cmpstkpar.ntau = temp; try {htemp = Float.valueOf(vad.tf6.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = cmpstkpar.tau0; } cmpstkpar.tau0 = htemp; try {temp = Integer.valueOf(vad.tf7.getText()).intValue(); } catch (NumberFormatException nfe) {temp = cmpstkpar.VP0; } if (temp < 0) temp = cmpstkpar.VP0; if (!cmpstkpar.geomexists && temp >= this.getNMembofDim(2)) temp = this.getNMembofDim(2) - 1; else if (cmpstkpar.geomexists) { noVP0 = true; for (int i=0; i0, <0.5):"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + Freq, 8); vad.pp.add(vad.tf1); vad.cb0 = new Checkbox("Reject Low Dip?"); vad.pp.add(vad.cb0); vad.cb0.setState(RejectLow); vad.lab2 = new Label("(Reject high dips if not checked.)"); vad.pp.add(vad.lab2); } public FltPlane flatten(int Direction, int Operation) { int len, vecs, planes, direction, operation; len = this.getNMembofDim(0); vecs = this.getNMembofDim(1); planes = this.getNMembofDim(2); direction = Direction; operation = Operation; FltPlane fp=null; int np, nv, ne, i,j,k, nelem, bufsize; float vec[], ovec[], buf[]; if (direction == 0) { nelem = vecs*planes; fp = new FltPlane(planes, vecs); fp.setUnitsofDim(0, this.getUnitsofDim(1)); fp.setUnit0ofDim(0, this.getUnit0ofDim(1)); fp.setDUnitofDim(0, this.getDUnitofDim(1)); fp.setUnitsofDim(1, this.getUnitsofDim(2)); fp.setUnit0ofDim(1, this.getUnit0ofDim(2)); fp.setDUnitofDim(1, this.getDUnitofDim(2)); bufsize = len; } else if (direction == 1) { nelem = len*planes; fp = new FltPlane(planes, len); fp.setUnitsofDim(0, this.getUnitsofDim(0)); fp.setUnit0ofDim(0, this.getUnit0ofDim(0)); fp.setDUnitofDim(0, this.getDUnitofDim(0)); fp.setUnitsofDim(1, this.getUnitsofDim(2)); fp.setUnit0ofDim(1, this.getUnit0ofDim(2)); fp.setDUnitofDim(1, this.getDUnitofDim(2)); bufsize = vecs; } else { nelem = len*vecs; fp = new FltPlane(vecs, len); fp.setUnitsofDim(0, this.getUnitsofDim(0)); fp.setUnit0ofDim(0, this.getUnit0ofDim(0)); fp.setDUnitofDim(0, this.getDUnitofDim(0)); fp.setUnitsofDim(1, this.getUnitsofDim(1)); fp.setUnit0ofDim(1, this.getUnit0ofDim(1)); fp.setDUnitofDim(1, this.getDUnitofDim(1)); bufsize = planes; } if (Operation == 3) fp.setAmpUnits("Minimized " + this.getAmpUnits()); else if (Operation == 2) fp.setAmpUnits("Maximized " + this.getAmpUnits()); else if (Operation == 1) fp.setAmpUnits("Averaged " + this.getAmpUnits()); else fp.setAmpUnits("Stacked " + this.getAmpUnits()); fp.setAmp0(this.getAmp0()); fp.setAmpFac(this.getAmpFac()); ovec = fp.vec; vec = this.vec; buf = new float[bufsize]; if (direction == 0) { for (k=0; k max) max = fvec[i]; return(max); } else for (i=0; iOn Each Vector menu.", 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label("Taper Portion (float, >0.0, <=1.0):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("1.0", 4); vad.pp.add(vad.tf0); vad.lab1 = new Label("Rise (float, >=0.0, <0.5):"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("0.05", 4); vad.pp.add(vad.tf1); vad.cb0 = new Checkbox("Taper Across Traces?"); vad.pp.add(vad.cb0); vad.cb0.setState(true); vad.lab2 = new Label("(Taper across planes if not checked.)"); vad.pp.add(vad.lab2); } public void dohann(ViewmatAction vad) { float temp, portion, rise; portion = 1F; rise = 0.05F; try {temp = Float.valueOf(vad.tf0.getText()).floatValue(); } catch (NumberFormatException nfe) { Errout("hann: Cannot taper with portion of " + vad.tf0.getText() + " - must be a positive float <= 1.0."); return; } if (temp <= 0F || temp > 1F) { Errout("hann: Cannot taper with portion of " + vad.tf0.getText() + " - must be a positive float <= 1.0."); return; } portion = temp; try {temp = Float.valueOf(vad.tf1.getText()).floatValue(); } catch (NumberFormatException nfe) { Errout("hann: Cannot taper with rise of " + vad.tf1.getText() + " - must be a positive float < 0.5."); return; } if (temp < 0F || temp >= 0.5F) { Errout("hann: Cannot taper with rise of " + vad.tf1.getText() + " - must be a positive float < 0.5."); return; } rise = temp; this.hannVol(portion, rise, vad.cb0.getState()); } public void mirror() { mirror(false); } public void mirror(boolean ReversePlanes) { mirror(ReversePlanes, 0, this.nv-1); } public void mirror(boolean ReversePlanes, int v0, int vf) { float buf1[]; buf1 = new float[ne]; RgHead hdbuf = new RgHead(); int i, j, k, itemp, nvm; if (ReversePlanes) { Notice("FltVol.mirror: reversing the order of " + this.planes + " planes of " + this.nv + " vectors of " + this.ne + " elements... "); for (k=0; k vf) { itemp = v0; v0 = vf; vf = itemp; } if (v0 < 0) v0 = 0; if (vf > this.nv-1) vf = this.nv-1; nvm = vf-v0+1; Notice("FltVol.mirror: reversing the order of " + nvm + " vectors within " + this.nv + " of " + this.ne + " elements in " + this.planes + " planes... "); for (k=0; k vf) { itemp = v0; v0 = vf; vf = itemp; } if (v0 < 0) v0 = 0; if (vf > nx-1) vf = nx - 1; this.mirror(vad.cb0.getState(), v0, vf); } static void shadePanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label) { float SunAzim, SunHeight, Dx, Dy; SunAzim = 315F; SunHeight = 45F; if (f.vm.rowsdown) { Dx = f.vm.fvol.getDUnitofDim(1); Dy = f.vm.fvol.getDUnitofDim(0); } else { Dx = f.vm.fvol.getDUnitofDim(0); Dy = f.vm.fvol.getDUnitofDim(1); } if (Dx == 0F) Dx = 1F; if (Dy == 0F) Dy = 1F; if (Dx < 0F) Dx = -Dx; if (Dy < 0F) Dy = -Dy; vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "\n" + "The " + label + " method on class FltVol data\n" + "converts each plane in the volume separately\n" + "into a shaded-relief map. It assumes the data\n" + "values have the same units as the sample and\n" + "vector spacings (usually height and lengths).\n" + "Parameters below:\n" + "Sun Azimuth sun direction in degrees clockwise\n" + " from north- up the height of the screen, 0=N,\n" + " 90=E, 180=S, 270=W (float)\n" + "Sun Height is sun elevation in degrees above\n" + " the horizon, 0-90 (pos. float).\n" + "Dx and Dy are the horizontal and vertical sample\n " + " spacings as seen on the screen.", 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label("Sun Azimuth (degrees, float):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("" + SunAzim, 5); vad.pp.add(vad.tf0); vad.lab1 = new Label("Sun Height (degrees, >0, <90):"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + SunHeight, 4); vad.pp.add(vad.tf1); vad.lab2 = new Label("Dx (pos. float):"); vad.pp.add(vad.lab2); vad.tf2 = new TextField("" + Dx, 5); vad.pp.add(vad.tf2); vad.lab3 = new Label("Dy (pos. float):"); vad.pp.add(vad.lab3); vad.tf3 = new TextField("" + Dy, 5); vad.pp.add(vad.tf3); } public FltVol slantPlanes(float t0, float dt, float x0, float dx, float tau0, int ntau, float p0, int np, float dp, boolean scale) { int nt, noff, plane, nplanes; nt = this.ne; noff = this.nv; nplanes = this.planes; float starttime; starttime = t0; int it, nit, taddr, iptdrop, ip, ix, itau0, scl, sclv[], pscl, ps, s, tr; float fhld, ppts[], drop, offset, a; int istarttime, ihld; if (headers == null) Noticeln("slantPlanes: slantstacking " + nplanes + " planes of " + noff + " vectors of " + nt + " elements each with t0=" + t0 + " dt=" + dt + " x0=" + x0 + " dx=" + dx + " tau0=" + tau0 + " ntau=" + ntau + " p0=" + p0 + " np=" + np + " dp=" + dp + " scale=" + scale + "... "); else Noticeln("slantPlanes: slantstacking " + nplanes + " planes of " + noff + " labeled traces of " + nt + " samples each with t0=" + t0 + " dt=" + dt + " " + getOffsets() + " tau0=" + tau0 + " ntau=" + ntau + " p0=" + p0 + " np=" + np + " dp=" + dp + " scale=" + scale + "... "); itau0 = (int)(tau0/dt); ppts = new float[np]; FltVol sfp = new FltVol(nplanes, np, ntau); sclv = null; if (scale) sclv = new int[np*ntau]; /* find all p - values */ for (ip = 0; ip < np; ip++) ppts[ip] = p0 + ip * dp; /* loop through planes and find individual slantstacks */ for (plane=0; plane= itau0+ntau) continue; if (istarttime >= itau0) { ps = s + ip*ntau + istarttime-itau0; if (scale) pscl = scl + ip*ntau + istarttime-itau0; taddr = 0; nit = itau0+ntau >= istarttime+nt ? nt-1 : itau0+ntau-istarttime-1; } else { ps = s + ip*ntau; if (scale) pscl = scl + ip*ntau; taddr = itau0 - istarttime; nit = itau0+ntau >= istarttime+nt ? nt-(itau0-istarttime)-1 : ntau-1; } if (scale) { for(it=0; it 1) sfp.vec[ps] /= (float)(sclv[pscl]); ps++; pscl++; } } Noticeln("slantstacked plane " + (plane+1) + " of " + nplanes + "."); } /* end of loop over planes */ ppts = null; sclv = null; sfp.setUnitsofDim(0, "Intercept Time, s"); sfp.setUnit0ofDim(0, tau0); sfp.setDUnitofDim(0, dt); sfp.setUnitsofDim(1, "Slowness, sec/meter"); sfp.setUnit0ofDim(1, p0); sfp.setDUnitofDim(1, dp); sfp.setAmpUnits("Slantstacked " + this.getAmpUnits()); Noticeln("slantPlanes Done."); return sfp; } static void slantPlanesPanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label) { float t0, dt, x0, dx, tau0, p0, dp; int ntau, np; boolean scale; t0 = f.vm.fvol.getUnit0ofDim(0); dt = f.vm.fvol.getDUnitofDim(0); x0 = f.vm.fvol.getUnit0ofDim(1); dx = f.vm.fvol.getDUnitofDim(1); ntau = f.vm.fvol.ne; np = f.vm.fvol.nv; tau0 = t0; p0 = 0F; dp = 0.01F/np; /* sec/meter */ scale = false; vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "The " + label + " method on class FltVol data\n" + "computes the slantstack (or p-tau transform)\n" + "across the vectors of each plane.\n" + "Parameters below:\n" + "t0=0: data start time, s\n" + "dt=0.004: time between samples, s\n" + "If traces are labeled with headers, the offset is used;\n" + "otherwise supply the following:\n" + " x0=0: distance of first vector, m\n" + " dx=1: distance between vectors, m\n" + "ntau=nt: number of elements in intercept time for stack\n" + "dtau=dt\n" + "tau0=0: initial intercept time\n" + "np=nx: number of slowness vectors\n" + "p0=0: first p slowness, s/m\n" + "dp=0.01/np: slowness interval, s/m\n" + "scale=false: no scaling applied to slantstack\n" + " true: apply scaling by averaging values summed\n" + " into slantstack", 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label("t0 (sec):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("" + t0, 4); vad.pp.add(vad.tf0); vad.lab1 = new Label("dt (sec):"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + dt, 6); vad.pp.add(vad.tf1); if (f.vm.fvol.headers == null) { vad.lab2 = new Label("x0 (meter):"); vad.pp.add(vad.lab2); vad.tf2 = new TextField("" + x0, 4); vad.pp.add(vad.tf2); vad.lab3 = new Label("dx (meter):"); vad.pp.add(vad.lab3); vad.tf3 = new TextField("" + dx, 4); vad.pp.add(vad.tf3); } else { vad.lab2 = new Label("Labeled Traces:"); vad.pp.add(vad.lab2); vad.lab3 = new Label(f.vm.fvol.getOffsets()); vad.pp.add(vad.lab3); } vad.lab4 = new Label("tau0 (sec):"); vad.pp.add(vad.lab4); vad.tf4 = new TextField("" + tau0, 4); vad.pp.add(vad.tf4); vad.lab5 = new Label("p0 (s/m):"); vad.pp.add(vad.lab5); vad.tf5 = new TextField("" + p0, 6); vad.pp.add(vad.tf5); vad.lab6 = new Label("dp (s/m):"); vad.pp.add(vad.lab6); vad.tf6 = new TextField("" + dp, 6); vad.pp.add(vad.tf6); vad.lab7 = new Label("ntau (+int):"); vad.pp.add(vad.lab7); vad.tf7 = new TextField("" + ntau, 4); vad.pp.add(vad.tf7); vad.lab8 = new Label("np (+int):"); vad.pp.add(vad.lab8); vad.tf8 = new TextField("" + np, 4); vad.pp.add(vad.tf8); vad.cb0 = new Checkbox("scale?"); vad.pp.add(vad.cb0); vad.cb0.setState(scale); } public FltVol doslantPlanes(ViewmatAction vad) { float t0, dt, x0, dx, tau0, p0, dp; int ntau, np; boolean scale; t0 = f.vm.fvol.getUnit0ofDim(0); dt = f.vm.fvol.getDUnitofDim(0); x0 = f.vm.fvol.getUnit0ofDim(1); dx = f.vm.fvol.getDUnitofDim(1); ntau = f.vm.fvol.ne; np = f.vm.fvol.nv; tau0 = t0; p0 = 0F; dp = 0.01F/np; /* sec/meter */ scale = false; float htemp; int temp; try {htemp = Float.valueOf(vad.tf0.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = t0; } t0 = htemp; try {htemp = Float.valueOf(vad.tf1.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = dt; } if (htemp < 0F) htemp = -htemp; dt = htemp; if (this.headers == null) { try {htemp = Float.valueOf(vad.tf2.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = x0; } x0 = htemp; try {htemp = Float.valueOf(vad.tf3.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = dx; } dx = htemp; } try {htemp = Float.valueOf(vad.tf4.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = tau0; } tau0 = htemp; try {htemp = Float.valueOf(vad.tf5.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = p0; } p0 = htemp; try {htemp = Float.valueOf(vad.tf6.getText()).floatValue(); } catch (NumberFormatException nfe) {htemp = dp; } dp = htemp; try {temp = Integer.valueOf(vad.tf7.getText()).intValue(); } catch (NumberFormatException nfe) {temp = ntau; } if (temp <= 0) temp = ntau; ntau = temp; try {temp = Integer.valueOf(vad.tf8.getText()).intValue(); } catch (NumberFormatException nfe) {temp = np; } if (temp <= 0) temp = np; np = temp; scale = vad.cb0.getState(); return this.slantPlanes(t0, dt, x0, dx, tau0, ntau, p0, np, dp, scale); } static void smoothPanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label) { int xw, tw, norm; xw = 1; tw = 11; norm = 2; vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "The " + label + " method on class FltVol data\n" + "smooths the amplitudes in each plane using\n" + "an averaging kernel of adjustable size.\n" + "Parameters are:\n" + "xw=1: width of averaging kernel across vectors,\n" + " will be made odd\n" + "tw=11 width of averaging kernel across elements\n" + " will be made odd\n" + "norm=2 2: uses L-2 norm (average)\n" + " 1: uses L-1 norm (median)\n" + " 0: uses a faster scheme that often\n" + " finds the median.", 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label("Kernel Vector Width (+ odd int):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("" + xw, 4); vad.pp.add(vad.tf0); vad.lab1 = new Label("Kernel Element Length (+ odd int):"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + tw, 4); vad.pp.add(vad.tf1); vad.lab2 = new Label("Smoothing Operator:"); vad.pp.add(vad.lab2); vad.ch0 = new Choice(); vad.ch0.add("Fast Approx. Median"); vad.ch0.add("L-1 Norm (Median)"); vad.ch0.add("L-2 Norm (Average)"); vad.pp.add(vad.ch0); vad.ch0.select(2); } public void sort(int basis, boolean cross) { if (headers == null) { Errout("This FltPlane has no headers, sort aborted."); return; } if (basis < 0 || basis > 10) { Errout("Sort: basis=" + basis + " not between 0 and 10, aborted."); return; } Notice("Sorting " + vecs + " traces of " + ne + " elements each" + (cross ? ", across planes," : "") + " by basis " + basis + " ..."); RgHead tmphd = new RgHead(); float tmp[] = new float[ne]; if (cross) quickSort(0, vecs-1, basis, tmphd, tmp); else { for (int i=0; i= tnp) temp = p0; p0 = temp; try {temp = Integer.valueOf(vad.tf7.getText()).intValue(); } catch (NumberFormatException nfe) {temp = np; } if (temp <= 0 || temp > tnp) temp = np; np = temp; try {temp = Integer.valueOf(vad.tf8.getText()).intValue(); } catch (NumberFormatException nfe) {temp = dp; } if (temp <= 0 || temp > tnp) temp = dp; dp = temp; try {temp = Integer.valueOf(vad.tf0.getText()).intValue(); } catch (NumberFormatException nfe) {temp = v0; } if (temp < 0 || temp >= tnv) temp = v0; v0 = temp; try {temp = Integer.valueOf(vad.tf1.getText()).intValue(); } catch (NumberFormatException nfe) {temp = nv; } if (temp <= 0 || temp > tnv) temp = nv; nv = temp; try {temp = Integer.valueOf(vad.tf2.getText()).intValue(); } catch (NumberFormatException nfe) {temp = dv; } if (temp <= 0 || temp > tnv) temp = dv; dv = temp; try {temp = Integer.valueOf(vad.tf3.getText()).intValue(); } catch (NumberFormatException nfe) {temp = e0; } if (temp < 0 || temp >= tne) temp = e0; e0 = temp; try {temp = Integer.valueOf(vad.tf4.getText()).intValue(); } catch (NumberFormatException nfe) {temp = ne; } if (temp <= 0 || temp > tne) temp = ne; ne = temp; try {temp = Integer.valueOf(vad.tf5.getText()).intValue(); } catch (NumberFormatException nfe) {temp = de; } if (temp <= 0 || temp > tne) temp = de; de = temp; if (p0+np*dp > tnp) np = (tnp-p0)/dp; if (v0+nv*dv > tnv) nv = (tnv-v0)/dv; if (e0+ne*de > tne) ne = (tne-e0)/de; FltVol tfvol = new FltVol(np, nv, ne); tfvol.windowof(this, p0, dp, v0, dv, e0, de); return tfvol; } static void windowPlanePanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label) { int temp, p0, v0, nv, dv, e0, ne, de, tnp, tnv, tne; ne = f.vm.fvol.ne; nv = f.vm.fvol.nv; tnv = nv; tne = ne; p0 = 0; v0 = 0; dv = 1; e0 = 0; de = 1; vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "The " + label + " method on class FltVol data\n" + "extracts a single FltPlane obect plane from a FltVol, and\n" + "windows out and/or decimates vectors and elements.\n" + "The Methods->On Each Plane->window method will \n" + "window and/or decimate planes from a FltVol\n" + "Parameters below:\n" + " p0=0 index of the plane to be copied\n" + " v0=0 index of the first vector in the plane to be copied\n" + " nv=all the number of vectors to be copied\n" + " dv=1 increment between input vectors\n" + " e0=0 index of the first element of each vector to be copied\n" + " ne=all the number of elements from each vector to be copied\n" + " de=1 increment between input elements", 5, 35); vad.pp.add(vad.expl); vad.lab6 = new Label("Plane Index p0 (+integer):"); vad.pp.add(vad.lab6); vad.tf6 = new TextField("" + p0, 4); vad.pp.add(vad.tf6); vad.lab0 = new Label("v0 (+integer):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("" + v0, 4); vad.pp.add(vad.tf0); vad.lab1 = new Label("nv (+integer):"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + nv, 4); vad.pp.add(vad.tf1); vad.lab2 = new Label("dv (+integer):"); vad.pp.add(vad.lab2); vad.tf2 = new TextField("" + dv, 4); vad.pp.add(vad.tf2); vad.lab3 = new Label("e0 (+integer):"); vad.pp.add(vad.lab3); vad.tf3 = new TextField("" + e0, 4); vad.pp.add(vad.tf3); vad.lab4 = new Label("ne (+integer):"); vad.pp.add(vad.lab4); vad.tf4 = new TextField("" + ne, 4); vad.pp.add(vad.tf4); vad.lab5 = new Label("de (+integer):"); vad.pp.add(vad.lab5); vad.tf5 = new TextField("" + de, 4); vad.pp.add(vad.tf5); } static void decimatePanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label) { int temp, v0, nv, dv, e0, ne, de, dp, np, tnp, tnv, tne; ne = f.vm.fvol.ne; nv = f.vm.fvol.vecs; np = f.vm.fvol.planes; tnp = np; tnv = nv; tne = ne; v0 = 0; dv = 1; e0 = 0; de = 1; dp = 1; vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "The " + label + " method on class FltVol data\n" + "decimates planes, vectors, and/or elements\n" + "after smoothing across elements and vectors only.\n" + "Parameters below:\n" + " dp=1 increment between input planes\n" + " dv=1 increment between input vectors\n" + " de=1 increment between input elements", 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label("Vector Decimation dv (+integer):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("" + dv, 4); vad.pp.add(vad.tf0); vad.lab1 = new Label("Element Decimation de (+integer):"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + de, 4); vad.pp.add(vad.tf1); vad.lab2 = new Label("Plane Decimation dp (+integer):"); vad.pp.add(vad.lab2); vad.tf2 = new TextField("" + dp, 4); vad.pp.add(vad.tf2); } public FltPlane dowindowPlane(ViewmatAction vad) { int temp, p0, v0, nv, dv, e0, ne, de, tnp, tnv, tne; ne = f.vm.fvol.ne; nv = f.vm.fvol.nv; tnv = nv; tne = ne; tnp = f.vm.fvol.planes; p0 = 0; v0 = 0; dv = 1; e0 = 0; de = 1; try {temp = Integer.valueOf(vad.tf6.getText()).intValue(); } catch (NumberFormatException nfe) {temp = p0; } if (temp < 0 || temp >= tnp) temp = p0; p0 = temp; try {temp = Integer.valueOf(vad.tf0.getText()).intValue(); } catch (NumberFormatException nfe) {temp = v0; } if (temp < 0 || temp >= tnv) temp = v0; v0 = temp; try {temp = Integer.valueOf(vad.tf1.getText()).intValue(); } catch (NumberFormatException nfe) {temp = nv; } if (temp <= 0 || temp > tnv) temp = nv; nv = temp; try {temp = Integer.valueOf(vad.tf2.getText()).intValue(); } catch (NumberFormatException nfe) {temp = dv; } if (temp <= 0 || temp > tnv) temp = dv; dv = temp; try {temp = Integer.valueOf(vad.tf3.getText()).intValue(); } catch (NumberFormatException nfe) {temp = e0; } if (temp < 0 || temp >= tne) temp = e0; e0 = temp; try {temp = Integer.valueOf(vad.tf4.getText()).intValue(); } catch (NumberFormatException nfe) {temp = ne; } if (temp <= 0 || temp > tne) temp = ne; ne = temp; try {temp = Integer.valueOf(vad.tf5.getText()).intValue(); } catch (NumberFormatException nfe) {temp = de; } if (temp <= 0 || temp > tne) temp = de; de = temp; if (v0+nv*dv > tnv) nv = (tnv-v0)/dv; if (e0+ne*de > tne) ne = (tne-e0)/de; FltPlane tfp = new FltPlane(nv, ne); tfp.windowof(this, p0, v0, dv, e0, de); return tfp; } public FltVol docutTimeVol(ViewmatAction vad) { int ne, tne, e0, nv, np; float dt, t0, tt0, T, tT; String tunits; np = this.planes; ne = this.ne; nv = this.nv; dt = f.vm.fvol.getDUnitofDim(0); t0 = f.vm.fvol.getUnit0ofDim(0); tunits = f.vm.fvol.getUnitsofDim(0); T = ne*dt; tt0 = t0; tT = T; tne = ne; try {tt0 = Float.valueOf(vad.tf0.getText()).floatValue(); } catch (NumberFormatException nfe) {tt0 = t0; } if (tt0 < t0) tt0 = t0; try {tT = Float.valueOf(vad.tf1.getText()).floatValue(); } catch (NumberFormatException nfe) {tT = T; } if (tT < 0F) tT = -tT; if (tT < dt) tT = dt; e0 = (int)((tt0-t0)/dt); if (e0 >= ne) e0 = 0; tne = (int)(tT/dt); if ((e0+tne) > ne) tne = ne - e0; ne = tne; FltVol tfvol = new FltVol(np, nv, ne); tfvol.windowof(this, 0, 1, 0, 1, e0, 1); return tfvol; } public FltVol padVol(int pad) { int ne, nv, np; np = this.planes; nv = this.nv; ne = this.ne + pad; FltVol fvol = new FltVol(np, nv, ne); fvol.copyvals(this); fvol.ne = ne; for (int l=0; l 1e10) temp = 0; pad = temp; return this.padVol(pad); } public FltVol dostackHitsVol(ViewmatAction vad) { int ne, e0, nv, np, npicked, i, j, k, p, iv[], minne[], wne; float dt, t0, tt0, T, tT; String tunits, message, picktext; Vector parsed; PickData pick, opick; np = this.planes; nv = this.nv; ne = this.ne; dt = this.getDUnitofDim(0); t0 = this.getUnit0ofDim(0); tunits = this.getUnitsofDim(0); npicked = ViewmatPicks.getNPicked(this); picktext = new String(f.picks.planetext[0]); for (i=1; i= ne || pick.ivec < 0 || pick.ivec >= nv || pick.iplane < 0 || pick.iplane >= np) continue; if (iv[pick.iplane] == -1) { iv[pick.iplane] = pick.ivec; continue; } if (pick.ivec != iv[pick.iplane]) { npicked = np+1; break; } } /* Find shortest interval between picks on any plane, or from pick to end */ minne = new int[np]; for (i=0; i= ne || pick.ivec < 0 || pick.ivec >= nv || pick.iplane < 0 || pick.iplane >= np) continue; if ((ne - pick.isamp) < minne[pick.iplane]) minne[pick.iplane] = ne - pick.isamp; for (j=0; j= ne || opick.ivec < 0 || opick.ivec >= nv || opick.iplane < 0 || opick.iplane >= np) continue; if (pick.iplane != opick.iplane) continue; if (opick.isamp <= pick.isamp) continue; if ((opick.isamp - pick.isamp) < minne[pick.iplane]) minne[pick.iplane] = opick.isamp - pick.isamp; } } wne = minne[0]; for (i=1; i np) { Errout("stackHits: " + npicked + " traces are picked; pick at most\n" + np + ", or one trace for each plane. \n" + "Make picks of hit times on one\n" + "zero-offset trace per record plane.\n"); return null; } Notice("stackHitsVol: cutting out records " + wne + " samples (" + (wne*dt) + " " + tunits + ") long after each pick,\n" + "\tand summing them to create " + npicked + " stacked " + "hammer shot records..."); for (i=0, p=0; i -1) { p = i; break; } } FltVol tfvol = new FltVol(npicked, nv, wne); tfvol.setNoticeOn(false); if (this.headers == null) tfvol.headers = null; else { tfvol.headers = new RgHead[tfvol.vecs]; for (i=0; i= ne || pick.ivec < 0 || pick.ivec >= nv || pick.iplane < 0 || pick.iplane >= np) continue; for (j=0; iv[pick.iplane] >= 0 && j < nv; j++) { for (k=0; k < wne; k++) tfvol.vec[(iv[pick.iplane])*nv*wne + j*wne + k] += this.vec[pick.iplane*nv*ne + j*ne + pick.isamp + k]; if (tfvol.headers[(iv[pick.iplane])*nv + j] == null) tfvol.headers[(iv[pick.iplane])*nv + j] = new RgHead(this.headers[(pick.iplane)*nv + j]); } } tfvol.copyunits(this); tfvol.geogr = this.geogr; tfvol.Elem0 = 0F; tfvol.PlaneUnits = new String(this.PlaneUnits); tfvol.Plane0 = this.Plane0 + p*this.DPlane; tfvol.DPlane = this.DPlane; Noticeln(" done."); return tfvol; } static void reduceTPanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label) { int ne, e0; float dt, t0, tt0, T, tT; String tunits; ne = f.vm.fvol.ne; dt = f.vm.fvol.getDUnitofDim(0); t0 = f.vm.fvol.getUnit0ofDim(0); tunits = f.vm.fvol.getUnitsofDim(0); T = ne*dt; tt0 = t0; tT = T; vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "The " + label + " method on class FltVol data\n" + "cuts each trace on each plane down to a reduced\n" + "time t=off/v using the reduction velocity v,\n" + "and length you specify. The true starting\n" + "time of each trace is not saved.", 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label("Traces Start at Intercept Time:"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("" + t0, 8); vad.pp.add(vad.tf0); vad.lab1 = new Label("Trace Length:"); vad.pp.add(vad.lab1); vad.tf1 = new TextField("" + T, 8); vad.pp.add(vad.tf1); vad.lab2 = new Label("Reduction Velocity, km/s:"); vad.pp.add(vad.lab2); vad.tf2 = new TextField("7.8", 4); vad.pp.add(vad.tf2); vad.lab3 = new Label("(Trace Units are " + tunits + ")"); vad.pp.add(vad.lab3); } public FltVol doreduceTPlanes(ViewmatAction vad) { int ne, tne, e0, nv; float dt, t0, tt0, T, tT, v, temp; String tunits; ne = f.vm.fvol.ne; nv = f.vm.fvol.vecs; dt = f.vm.fvol.getDUnitofDim(0); t0 = f.vm.fvol.getUnit0ofDim(0); tunits = f.vm.fvol.getUnitsofDim(0); T = ne*dt; tt0 = t0; tT = T; tne = ne; try {tt0 = Float.valueOf(vad.tf0.getText()).floatValue(); } catch (NumberFormatException nfe) {tt0 = t0; } try {tT = Float.valueOf(vad.tf1.getText()).floatValue(); } catch (NumberFormatException nfe) {tT = T; } if (tT < 0F) tT = -tT; if (tT < dt) tT = dt; tne = (int)(tT/dt); if (tne > 10*ne) tne = 10*ne; ne = tne; v = 7.8F; try {temp = Float.valueOf(vad.tf2.getText()).floatValue(); } catch (NumberFormatException nfe) {temp = v; } if (temp == 0F || temp > 1e10F) temp = v; v = temp; FltVol tfv = new FltVol(this.planes, nv, ne); tfv.copyunits(this); tfv.copyheaders(this); tfv.Elem0 = tt0; tfv.ElemUnits = new String(this.ElemUnits + " Reduced: T - Offset/" + v + " km/s"); tfv.setNoticeOn(false); float offset=0F; for (int k=0; k= this.ne) break; tfv.vec[k*tfv.nv*tfv.ne + j*tfv.ne + i] = this.vec[k*this.nv*this.ne + j*this.ne + e0 + i]; } } return tfv; } public FltVol dodecimateVol(ViewmatAction vad) { int temp, p0, np, dp, v0, nv, dv, e0, ne, de, tnp, tnv, tne, xw, tw; ne = f.vm.fvol.ne; nv = f.vm.fvol.nv; np = f.vm.fvol.planes; tnp = np; tnv = nv; tne = ne; p0 = 0; dp = 1; v0 = 0; dv = 1; e0 = 0; de = 1; try {temp = Integer.valueOf(vad.tf0.getText()).intValue(); } catch (NumberFormatException nfe) {temp = dv; } if (temp <= 0 || temp > tnv) temp = dv; dv = temp; try {temp = Integer.valueOf(vad.tf1.getText()).intValue(); } catch (NumberFormatException nfe) {temp = de; } if (temp <= 0 || temp > tne) temp = de; de = temp; try {temp = Integer.valueOf(vad.tf2.getText()).intValue(); } catch (NumberFormatException nfe) {temp = dp; } if (temp <= 0 || temp > tnp) temp = dp; dp = temp; return decimateVol(dp, dv, de); } public FltVol decimateVol(int dp, int dv, int de) { int temp, p0, np, v0, nv, e0, ne, tnp, tnv, tne, xw, tw; ne = f.vm.fvol.ne; nv = f.vm.fvol.nv; np = f.vm.fvol.planes; if (dp < 1 || dp > np || dv < 1 || dv > nv || de < 1 || de > ne) { Noticeln("FltVol.decimateVol: dp=" + dp + ", dv=" + dv + ", de=" + de + " but all must be >0 and <(np, nv, ne)=(" + np + ", " + nv + ", " + ne + "), aborting to return copy volume."); return new FltVol(this); } Noticeln("Decimating with dp=" + dp + ", dv=" + dv + ", de=" + de + " ... "); tnp = np; tnv = nv; tne = ne; p0 = 0; v0 = 0; e0 = 0; if (p0+np*dp > tnp) np = (tnp-p0)/dp; if (v0+nv*dv > tnv) nv = (tnv-v0)/dv; if (e0+ne*de > tne) ne = (tne-e0)/de; xw = dv; tw = de; if (xw%2 == 0) xw++; if (tw%2 == 0) tw++; FltVol smfv = null; FltVol tfvol = new FltVol(np, nv, ne); if (xw > 1 && tw > 1) { smfv = new FltVol(this); smfv.smooth(xw, tw, 2); tfvol.windowof(smfv, p0, dp, v0, dv, e0, de); smfv = null; tfvol.setAmpUnits(this.getAmpUnits()); } else tfvol.windowof(this, p0, dp, v0, dv, e0, de); Noticeln("decimateVol done."); return tfvol; } static void xcorInterfPanel(ViewmatAction vad, ViewmatFrame f, boolean inplace, String label) { int nvec = f.vm.fvol.nv; vad.expl = new TextArea(label + " of " + f.getTitle() + (inplace ? " in-place\n" : " in new window\n") + "\n" + "The " + label + " method on class FltVol data\n" + "cross-correlates each trace of each plane\n" + "against the single traces at the designated\n" + "index for each plane.", 5, 35); vad.pp.add(vad.expl); vad.lab0 = new Label("Trace Index (0-" + (nvec-1) + "):"); vad.pp.add(vad.lab0); vad.tf0 = new TextField("0", 4); vad.pp.add(vad.tf0); } public void doxcorInterf(ViewmatAction vad) { int index=0, temp; int nvec = this.nv; try {temp = Integer.valueOf(vad.tf0.getText()).intValue(); } catch (NumberFormatException nfe) {temp = index; } if (temp < 0) temp = 0; if (temp > nvec-1) temp = nvec-1; index = temp; this.xcorInterf(index); } public void xcorInterf(int index) { int nvec = this.nv; if (index < 0 || index >= nvec) { Noticeln( "FltVol.xcorInterf: cannot correlate against trace at index " + nvec + ", must be 0-" + (nvec-1) + " ... "); return; } Noticeln("Cross-correlating " + this.vecs + " vectors of " + this.ne + " elements each against trace at index " + index + " of each plane... "); FltPlane trace = new FltPlane(1, this.ne); trace.setNoticeOn(false); int l; for (int k=0; k= NDims) return(1); else return(0); } public String getUnitsofDim(int Dim) { if (Dim == 0) return(ElemUnits); else if (Dim == 1) return(VecUnits); else if (Dim == 2) return(PlaneUnits); return(""); } public void setUnitsofDim(int Dim, String Dimunits) { if (Dim == 0) ElemUnits = new String(Dimunits); else if (Dim == 1) VecUnits = new String(Dimunits); else if (Dim == 2) PlaneUnits = new String(Dimunits); } public float getUnit0ofDim(int Dim) { if (Dim == 0) return Elem0; else if (Dim == 1) return Vec0; else if (Dim == 2) return Plane0; return 0F; } public void setUnit0ofDim(int Dim, float Unit0) { if (Dim == 0) Elem0 = Unit0; else if (Dim == 1) Vec0 = Unit0; else if (Dim == 2) Plane0 = Unit0; } public float getDUnitofDim(int Dim) { if (Dim == 0) return DElem; else if (Dim == 1) return DVec; else if (Dim == 2) return DPlane; return 1F; } public void setDUnitofDim(int Dim, float DUnit) { if (Dim == 0) DElem = DUnit; else if (Dim == 1) DVec = DUnit; else if (Dim == 2) DPlane = DUnit; } }