Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplified parameters of sunszonecsv and added functionality. #181

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Clean.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#! /bin/sh
# clean up files made by tests

rm -f qout*

exit
30 changes: 30 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

SUNEARQCSV - Assign Values To Target Q-file From Nearest In Another Q-file.

This program is similar to sunearcsv.c which
assigns values to trace header keys from nearest records in a q-file.


------------------------------------------------------------------------------
I advise running the scripts in the following order.
------------------------------------------------------------------------------

sh ./Sunearqcsv_test1

sh ./Sunearqcsv_test2

sh ./Sunearqcsv_test3

sh ./Sunearqcsv_test4


--- More realistic tests follow..

sh ./Sunearqcsv_test6

sh ./Sunearqcsv_test7

sh ./Sunearqcsv_test8

sh ./Sunearqcsv_test9

30 changes: 30 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test1
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh
# Sunearqcsv_test1 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- If you look at base1 you can easily see that the numbers are unique "
echo "--- and you can tell what columns and rows they come from. "
echo "--- Base2 has exactly the same numbers but the rows have been rearranged "
echo "--- and so have the columns INCLUDING THEIR NAMES. "
echo "--- The sunearqcsv program code is doing a lot of indexing to match names "
echo "--- between qin and tin q-files. Using the same options, base1 and base2 "
echo "--- should produce the same output - thus confirming that the indexing "
echo "--- has matched the same names despite the rearranged base2 rows/columns. "
echo "--- Note that target1 is the same as base1 except all numbers have an "
echo "--- extra 1 added to them (except column g which has an extra 5 added). "
echo "--- This makes it easy to see that oreps=d,c,m causes columns d,c,m "
echo "--- in target1 to be replaced with nearest from base1 or base2. "
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=base1.csv dimx=b dimy=e \
tin=target1.csv timx=b timy=e \
qout=qout001.csv oreps=d,c,m
#
sunearqcsv qin=base2.csv dimx=b dimy=e \
tin=target1.csv timx=b timy=e \
qout=qout001a.csv oreps=d,c,m
#
echo "--- Note, there should NOT be a difference next... "
diff qout001.csv qout001a.csv
#
25 changes: 25 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test2
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/sh
# Sunearqcsv_test2 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- Using base1 and target1 like test 1. "
echo "--- But finding nearest using just 1 dimension (name g). "
echo "--- Note that target g values end in 5. Which means they are exactly "
echo "--- half-way between the g values in base1. "
echo "--- For half-way, by default, the nearest is from higher numbered row. "
echo "--- But ordp=j option causes rows to be sorted internally by j resulting "
echo "--- in reversing this because j is high-to-low. Note columns c,d,m change. "
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=base1.csv dimx=g \
tin=target1.csv timx=g \
qout=qout002.csv oreps=m,d,c
#
sunearqcsv qin=base1.csv dimx=g \
tin=target1.csv timx=g \
qout=qout002a.csv oreps=m,d,c ordp=j
#
echo "--- Note, should be differences next (but easier to compare this way) "
diff qout002.csv qout002a.csv
#
33 changes: 33 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test3
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/sh
# Sunearqcsv_test3 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- Using base1,base2 and target2. "
echo "--- Target2 is rearranged/missing rows and renamed/missing some columns. "
echo "--- Remember, when oreps name exists in target it is REPLACED in output. "
echo "--- But if oreps name is missing from target, it is ADDED to output. "
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=base1.csv dimx=f \
tin=target2.csv timx=f \
qout=qout003.csv oreps=e,m,d,el,c,eye
#
sunearqcsv qin=base2.csv dimx=f \
tin=target2.csv timx=f \
qout=qout003a.csv oreps=e,m,d,el,c,eye
#
echo " Note, there should NOT be a difference next.... "
diff qout003.csv qout003a.csv
#
sunearqcsv qin=base1.csv dimx=f \
tin=target2.csv timx=f \
qout=qout003b.csv oreps=c
#
sunearqcsv qin=base2.csv dimx=f \
tin=target2.csv timx=f \
qout=qout003c.csv oreps=c
#
echo " Note, there should NOT be a difference next.... "
diff qout003b.csv qout003c.csv
#
23 changes: 23 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test4
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh
# Sunearqcsv_test4 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- Using base1 and target3. "
echo "--- Testing 3 dimensions with third dimension NOT used for nearest, "
echo "--- but used for relative-range-limit. Note that nopoint=0 means that "
echo "--- values for k are -9999 when there is no base point within range AND "
echo "--- several other names will retain their values. "
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=base1.csv dimx=h dimy=e dimr=c typer=-2 minr=-10 maxr=10 \
tin=target3.csv timx=xxh timy=xxe timr=xxc \
qout=qout004.csv nopoint=0 oreps=eye,f,g,k
#
sunearqcsv qin=base1.csv dimx=h dimy=e dimr=c typer=-2 minr=-200 maxr=200 \
tin=target3.csv timx=xxh timy=xxe timr=xxc \
qout=qout004a.csv nopoint=0 oreps=eye,f,g,k
#
echo " Note, there should be differences, just easier to check this way... "
diff qout004.csv qout004a.csv
#
27 changes: 27 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test6
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
# Sunearqcsv_test6 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- This is a test of varying-tuples with otuples options. "
echo "--- This copies the tuples from the tin file, nearest qin, or neither. "
echo "--- Note the vuma values are added to the output BEFORE the tuples. "
echo "--- Note the 4th setup, which inputs the same file and just deletes tuples."
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=vary6.csv dimx=cdp \
tin=varytin6.csv timx=cdp \
qout=qout006.csv otuples=1 oreps=vuma formxy=%.15g
#
sunearqcsv qin=vary6.csv dimx=cdp \
tin=varytin6.csv timx=cdp \
qout=qout006a.csv otuples=2 oreps=vuma formxy=%.15g
#
sunearqcsv qin=vary6.csv dimx=cdp \
tin=varytin6.csv timx=cdp \
qout=qout006b.csv otuples=0 oreps=vuma formxy=%.15g
#
sunearqcsv qin=varytin6.csv dimx=cdp \
tin=varytin6.csv timx=cdp \
qout=qout006c.csv otuples=0 formxy=%.15g
#
27 changes: 27 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test7
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh
# Sunearqcsv_test7 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- This is a test of fixed-tuples with otuples options. "
echo "--- This copies the tuples from the tin file, nearest qin, or neither. "
echo "--- Note that cdpt is replaced. And xxigi,xxigc are added before tuples. "
echo "--- Note the 4th setup, which inputs the same file and just deletes tuples."
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=fixed7.csv dimx=cdp \
tin=fixedtin7.csv timx=cdp \
qout=qout007.csv otuples=1 oreps=cdpt,xxigi,xxigc formxy=%.15g
#
sunearqcsv qin=fixed7.csv dimx=cdp \
tin=fixedtin7.csv timx=cdp \
qout=qout007a.csv otuples=2 oreps=cdpt,xxigi,xxigc formxy=%.15g
#
sunearqcsv qin=fixed7.csv dimx=cdp \
tin=fixedtin7.csv timx=cdp \
qout=qout007b.csv otuples=0 oreps=cdpt,xxigi,xxigc formxy=%.15g
#
sunearqcsv qin=fixedtin7.csv dimx=cdp \
tin=fixedtin7.csv timx=cdp \
qout=qout007c.csv otuples=0 formxy=%.15g
#
32 changes: 32 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test8
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/sh
# Sunearqcsv_test8 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- This tests combinations of varying-tuples, fixed-tuples, and no-tuples."
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=fixed7.csv dimx=cdp \
tin=vary6.csv timx=cdp \
qout=qout008.csv otuples=2 formxy=%.15g
#
sunearqcsv qin=vary6.csv dimx=cdp \
tin=fixed7.csv timx=cdp \
qout=qout008a.csv otuples=2 formxy=%.15g
#
sunearqcsv qin=notuple8.csv dimx=cdp \
tin=vary6.csv timx=cdp \
qout=qout008b.csv otuples=1 formxy=%.15g
#
sunearqcsv qin=notuple8.csv dimx=cdp \
tin=fixed7.csv timx=cdp \
qout=qout008c.csv otuples=1 formxy=%.15g
#
sunearqcsv qin=vary6.csv dimx=cdp \
tin=notuple8.csv timx=cdp \
qout=qout008d.csv otuples=2 formxy=%.15g
#
sunearqcsv qin=fixed7.csv dimx=cdp \
tin=notuple8.csv timx=cdp \
qout=qout008e.csv otuples=2 formxy=%.15g
#
29 changes: 29 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/Sunearqcsv_test9
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
# Sunearqcsv_test9 - for program SUNEARQCSV
# Author: Andre Latour, Nov 2024
#
echo "---------------------------------------------------------------------------"
echo "--- This test uses q-files of velocity stuff from the Sunmocsv tests. "
echo "--- It removes the varying tuples and then puts them back on again. "
echo "--- It removes the fixed tuples and then puts them back on again. "
echo "--- The resulting q-files should have the same values as the originals. "
echo "--- (You can replace qx1 with qoutqx1a and qx5 with qoutqx5a in the "
echo "--- tests within Sunmocsv to confirm they work the same). "
echo "---------------------------------------------------------------------------"
#
sunearqcsv qin=qx1.csv dimx=cdp \
tin=qx1.csv timx=cdp \
qout=qoutqx1.csv otuples=0 formxy=%.15g
#
sunearqcsv qin=qx5.csv dimx=cdp \
tin=qx5.csv timx=cdp \
qout=qoutqx5.csv otuples=0 formxy=%.15g
#
sunearqcsv qin=qx1.csv dimx=cdp \
tin=qoutqx1.csv timx=cdp \
qout=qoutqx1a.csv otuples=2 formxy=%.15g
#
sunearqcsv qin=qx5.csv dimx=cdp \
tin=qoutqx5.csv timx=cdp \
qout=qoutqx5a.csv otuples=2 formxy=%.15g
#
11 changes: 11 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/base1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
C_SU_SETID,Q,,,,,,,,,,,,
C_SU_NAMES,,,,,,,,,,,,,
C_SU_ID,b,c,d,e,f,g,h,eye,j,k,el,m,n
Q,10,110,210,310,410,510,610,710,880,910,1010,1110,1210
Q,20,120,220,320,420,520,620,720,870,920,1020,1120,1220
Q,30,130,230,330,430,530,630,730,860,930,1030,1130,1230
Q,40,140,240,340,440,540,640,740,850,940,1040,1140,1240
Q,50,150,250,350,450,550,650,750,840,950,1050,1150,1250
Q,60,160,260,360,460,560,660,760,830,960,1060,1160,1260
Q,70,170,270,370,470,570,670,770,820,970,1070,1170,1270
Q,80,180,280,380,480,580,680,780,810,980,1080,1180,1280
11 changes: 11 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/base2.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
C_SU_SETID,Q,,,,,,,,,,,,
C_SU_NAMES,,,,,,,,,,,,,
C_SU_ID,b,c,h,g,eye,el,m,n,d,e,f,j,k
Q,10,110,610,510,710,1010,1110,1210,210,310,410,880,910
Q,20,120,620,520,720,1020,1120,1220,220,320,420,870,920
Q,60,160,660,560,760,1060,1160,1260,260,360,460,830,960
Q,70,170,670,570,770,1070,1170,1270,270,370,470,820,970
Q,80,180,680,580,780,1080,1180,1280,280,380,480,810,980
Q,30,130,630,530,730,1030,1130,1230,230,330,430,860,930
Q,40,140,640,540,740,1040,1140,1240,240,340,440,850,940
Q,50,150,650,550,750,1050,1150,1250,250,350,450,840,950
18 changes: 18 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/fixed7.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
C_SU_SETID,Q
C_SU_FORMS
C_SU_ID,%.20g,%.20g,%.20g,%.20g,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f
C_SU_NDIMS,tims,,,,,,,,0,190,850,1800
C_SU_NAMES
C_SU_ID,cdp,cdpt,xxigi,xxigc,gx,gy,sx,sy,vnmo,vnmo,vnmo,vnmo
Q,21,7461,21,1,500.00,0.00,339049.86,5540266.91,1021.00,2000.00,4777.00,5000.00
Q,41,7921,41,1,1000.00,0.00,339299.72,5539833.81,1041.00,3500.00,4077.00,5000.00
Q,81,71841,81,1,2000.00,0.00,339799.44,5538967.63,1081.00,3500.00,4000.00,5077.00
Q,101,72301,101,1,2500.00,0.00,340049.31,5538534.54,1101.00,5500.00,6000.00,8777.00
Q,1473,7473,21,13,500.00,600.00,339569.57,5540566.74,2473.00,3333.00,5777.00,6666.00
Q,1493,7933,41,13,1000.00,600.00,339819.43,5540133.65,2493.00,3577.00,4000.00,5000.00
Q,1533,71853,81,13,2000.00,600.00,340319.16,5539267.46,2777.00,3500.00,4000.00,5000.00
Q,1553,72313,101,13,2500.00,600.00,340569.02,5538834.37,2553.00,3577.00,4000.00,5000.00
Q,2683,7483,21,23,500.00,1100.00,340002.67,5540816.60,3683.00,3700.00,4777.00,5000.00
Q,2703,7943,41,23,1000.00,1100.00,340252.53,5540383.51,3703.00,3800.00,4770.00,5000.00
Q,2743,71863,81,23,2000.00,1100.00,340752.25,5539517.32,3743.00,3800.00,4070.00,5500.00
Q,2763,72323,101,23,2500.00,1100.00,341002.11,5539084.23,3763.00,5000.00,6777.00,8000.00
16 changes: 16 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/fixedtin7.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
C_SU_SETID,Q
C_SU_FORMS
C_SU_ID,%.20g,%.20g,%.20g,%.20g,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f,%.2f
C_SU_NDIMS,tnmo,,,,,,,,0,222,888,1800
C_SU_NAMES
C_SU_ID,cdp,cdpt,igi,igc,gx,gy,sx,sy,vels,vels,vels,vels
Q,21,461,21,1,500.00,0.00,339049.86,5540266.91,1021.00,2000.00,4000.00,5000.00
Q,41,921,41,1,1000.00,0.00,339299.72,5539833.81,1041.00,3500.00,4000.00,5000.00
Q,101,2301,101,1,2500.00,0.00,340049.31,5538534.54,1101.00,5500.00,6000.00,8000.00
Q,1473,473,21,13,500.00,600.00,339569.57,5540566.74,2473.00,3333.00,5555.00,6666.00
Q,1493,933,41,13,1000.00,600.00,339819.43,5540133.65,2493.00,3500.00,4000.00,5000.00
Q,1533,1853,81,13,2000.00,600.00,340319.16,5539267.46,2533.00,3500.00,4000.00,5000.00
Q,2683,483,21,23,500.00,1100.00,340002.67,5540816.60,3683.00,3700.00,4000.00,5000.00
Q,2703,943,41,23,1000.00,1100.00,340252.53,5540383.51,3703.00,3800.00,4000.00,5000.00
Q,2743,1863,81,23,2000.00,1100.00,340752.25,5539517.32,3743.00,3800.00,4000.00,5500.00
Q,2763,2323,101,23,2500.00,1100.00,341002.11,5539084.23,3763.00,5000.00,6000.00,8000.00
15 changes: 15 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/notuple8.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
C_SU_SETID,Q
C_SU_FORMS
C_SU_ID,%.15g,%.15g,%.15g,%.15g,%.15g,%.15g,%.15g,%.15g
C_SU_NAMES
C_SU_ID,cdp,cdpt,igi,igc,gx,gy,sx,sy
Q,21,461,21,1,500,0,339049.86,5540266.91
Q,41,921,41,1,1000,0,339299.72,5539833.81
Q,101,2301,101,1,2500,0,340049.31,5538534.54
Q,1473,473,21,13,500,600,339569.57,5540566.74
Q,1493,933,41,13,1000,600,339819.43,5540133.65
Q,1533,1853,81,13,2000,600,340319.16,5539267.46
Q,2683,483,21,23,500,1100,340002.67,5540816.6
Q,2703,943,41,23,1000,1100,340252.53,5540383.51
Q,2743,1863,81,23,2000,1100,340752.25,5539517.32
Q,2763,2323,101,23,2500,1100,341002.11,5539084.23
17 changes: 17 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/qx1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
C_SU_SETID,Q
C_SU_FORMS
C_SU_ID,%.20g,%.20g,%g,%g,%g,%g,%g,%g,%g,%g
C_SU_NAMES
C_SU_ID,cdp,tnmo,vnmo,tnmo,vnmo,tnmo,vnmo,tnmo,vnmo
Q,21,0,1200,190,2000,450,4000,800,5000
Q,41,0,1800,190,3500,450,4000,800,5000
Q,81,0,1800,190,3500,450,4000,800,5000
Q,101,0,2800,190,5500,450,6000,800,8000
Q,1473,0,3333,200,5555,500,6666
Q,1493,0,1800,190,3500,450,4000,800,5000
Q,1533,0,1800,190,3500,450,4000,800,5000
Q,1553,0,1800,190,3500,450,4000,800,5000
Q,2683,0,1200,190,2000,450,4000,800,5000
Q,2703,0,1800,190,3500,450,4000,800,5000
Q,2743,0,1800,190,3500,450,4000,800,5000,900,5500
Q,2763,0,2800,190,5500,450,6000,800,8000
21 changes: 21 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/qx5.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
C_SU_SETID,Q
C_SU_FORMS
C_SU_ID,%.20g,%.20g,%8.0f,%8.0f,%8.0f,%8.0f
C_SU_NDIMS,tnmo,,0,0.004,0.008,0.012
C_SU_NAMES
C_SU_ID,cdp,cdpt,vnmo,vnmo,vnmo,vnmo
Q,136,1, 1000136, 2000015, 3000002, 4000000
Q,172,1, 1000172, 2000051, 3000002, 4000000
Q,182,1, 1000182, 2000061, 3000002, 4000000
Q,212,1, 1000212, 2000091, 3000002, 4000000
Q,232,1, 1000232, 2000111, 3000002, 4000000
Q,257,1, 1000257, 2000015, 3000003, 4000000
Q,293,1, 1000293, 2000051, 3000003, 4000000
Q,303,1, 1000303, 2000061, 3000003, 4000000
Q,333,1, 1000333, 2000091, 3000003, 4000000
Q,353,1, 1000353, 2000111, 3000003, 4000000
Q,620,1, 1000620, 2000015, 3000006, 4000000
Q,656,1, 1000656, 2000051, 3000006, 4000000
Q,666,1, 1000666, 2000061, 3000006, 4000000
Q,696,1, 1000696, 2000091, 3000006, 4000000
Q,716,1, 1000716, 2000111, 3000006, 4000000
11 changes: 11 additions & 0 deletions src/demos/Geom3D/Sunearqcsv/target1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
C_SU_SETID,Q,,,,,,,,,,,,
C_SU_NAMES,,,,,,,,,,,,,
C_SU_ID,b,c,d,e,f,g,h,eye,j,k,el,m,n
Q,11,111,211,311,411,515,611,711,881,911,1011,1111,1211
Q,21,121,221,321,421,525,621,721,871,921,1021,1121,1221
Q,31,131,231,331,431,535,631,731,861,931,1031,1131,1231
Q,41,141,241,341,441,545,641,741,851,941,1041,1141,1241
Q,51,151,251,351,451,555,651,751,841,951,1051,1151,1251
Q,61,161,261,361,461,565,661,761,831,961,1061,1161,1261
Q,71,171,271,371,471,575,671,771,821,971,1071,1171,1271
Q,81,181,281,381,481,585,681,781,811,981,1081,1181,1281
Loading