;plot all mass
;this procedure is designed to print the containant distribution
;for all chemicals and all cells on the default windows printer at one time
; Procedure was last edited by CGE on 2/12/98
pro plot_all_mass
test_type='core_data'
;set up string arrays with hard wired values to pass to
;routines
cell_c=strarr(9,4)
cell_c(1,*)=['1','Sparging/venting','4767','4782']
cell_c(3,*)=['3','Co-Solvent Mobilization','4764','4775.5']
cell_c(4,*)=['4','Macro-Molecular','4765.5','4774.5']
cell_c(5,*)=['5','Surfactant Mobilization','4762','4777']
cell_c(6,*)=['6','Surfactant Solubilization','4765','4777.5']
cell_c(7,*)=['7','Steam','4762','4778']
cell_c(8,*)=['8','Micro Emulsion','4766','4779']
cell_c(2,*)=['2','In Well Aeration','4766','4775']
cell_c(0,*)=['f','Co-Solvent Solubilization','4769.5','4773.5']
chem=strarr(10,2)
chem(0,*)=[ 'und','undecane']
chem(1,*)=[ 'nap','napthalene']
chem(2,*)=[ 'dec','decane']
chem(3,*)=[ 'm_xyl','meta-xylene']
chem(4,*)=[ 'tol','toulene']
chem(5,*)=[ 'dcb','dichlorobenzene']
chem(6,*)=[ 'tmb','trimethylbenzene']
chem(7,*)=[ 'o_xyl','ortho-xylene']
chem(8,*)=[ 'eb','ethylbenzene']
chem(9,*)=[ 'tca','1,1,1-trichloroethane']
krig_pre=strarr(10,10); kriged mean soil concentration mg/kg
krig_pre(0,*)=[ 'und','0','41.032031','63.883609','86.92417','231.905918','35.071435','53.502323','58.329541','40.127114']
krig_pre(1,*)=[ 'nap','2.78115','0.783405','0.823806','2.248333','7.447288','2.088006','1.651732','1.708537','0.628251']
krig_pre(2,*)=[ 'dec','64.767439','19.625278','34.165992','38.978019','60.851636','27.456046','18.82177','25.043297','16.236405']
krig_pre(3,*)=[ 'm_xyl','0','0.208925','0.509399','1.239108','8.826385','0','0.042474','1.851181','0.087751']
krig_pre(4,*)=[ 'tol','2.373441','0.029456','0.089127','2.699888','32.636179','2.244092','2.095833','2.118972','0.012994']
krig_pre(5,*)=[ 'dcb','30.855228','0.32658','0.557589','1.658072','60.851636','3.799149','0.458856','11.157544','0.734234']
krig_pre(6,*)=[ 'tmb','0','2.943949','2.817546','4.892661','8.617004','2.349489','2.05087','2.260693','1.370034']
krig_pre(7,*)=[ 'o_xyl','0','0.564703','1.107348','3.999851','20.1279','2.659549','0.844116','3.624566','0.122064']
krig_pre(8,*)=[ 'eb','0','0.154712','0.135446','0.609842','3.365879','0.476565','0.153942','0.710655','0.048146']
krig_pre(9,*)=[ 'tca','0.576465','0.023387','0.0010083','0.527832','4.789681','0.886146','0.080005','0.637491','0.004193']
krig_pre_sd=strarr(10,10); kriged standard deviation * 2
krig_pre_sd(0,*)=[ 'und','0','17.45888335','28.849503','28.298975','70.943985','13.684662','15.967078','20.02877','11.897858']
krig_pre_sd(1,*)=[ 'nap','1.850179','0.307870102','0.329912','0.579098','5.21441','1.509392','0.459211','0.480815','0.261173']
krig_pre_sd(2,*)=[ 'dec','77.222255','9.697085748','12.754042','10.362579','21.069322','9.765368','5.932326','8.139271','4.992966']
krig_pre_sd(3,*)=[ 'm_xyl','0','0.358179','0.171179','0.535878','0.511395','0','0.331372','0.586432','0.062334']
krig_pre_sd(4,*)=[ 'tol','0.008468','0.008718','0.065247','0.653112','21.966689','0.758544','0.025728','0.733815','0.008468']
krig_pre_sd(5,*)=[ 'dcb','23.041875','0.171476','0.148544','1.005333','71.956140','1.518587','0.128745','4.021278','0.452466']
krig_pre_sd(6,*)=[ 'tmb','0','1.143293','0.833809','2.861070','3.916701','0.774755','0.611205','0.896094','2.567533']
krig_pre_sd(7,*)=[ 'o_xyl','0','0.394152','0.452853','0.732469','6.640860','0.868397','0.187307','1.599556','0.155868']
krig_pre_sd(8,*)=[ 'eb','0','0.078026','0.054710','0.243757','1.810812','0.158883','0.037566','0.322296','0.036747']
krig_pre_sd(9,*)=[ 'tca','0.165418','0.021448','0.006927','0.174824','18.086380','0.451633','0.017897','0.335455','0.003605']
krig_post=strarr(10,10); kriged mean soil concentration mg/kg
krig_post(0,*)=[ 'und','0','25.478389','16.481243','8.981143','73.896283','3.699551','69.982384','4.517325','2.319824']
krig_post(1,*)=[ 'nap','0.381184','0.422513','0.300991','0.090363','1.26677','0.066418','0.504439','0.251032','0.072629']
krig_post(2,*)=[ 'dec','2.594285','12.386861','1.487038','10.499310','23.093347','1.428035','24.474771','9.035582','0.604886']
krig_post(3,*)=[ 'm_xyl','0','0.203143','0.155705','0.076774','1.015812','0','0','0.110149','0.014317']
krig_post(4,*)=[ 'tol','0.006471','0.010245','0.000037','0.066122','5.624042','0.059059','0.025339','0.051845','0.006471']
krig_post(5,*)=[ 'dcb','1.479223','0.172857','2.218463','1.796332','0','0.266483','0.141295','1.703586','0.024632']
krig_post(6,*)=[ 'tmb','0.186573','0.962342','0.033866','0.268181','1.938601','0.063873','1.088251','0.281166','0.231555']
krig_post(7,*)=[ 'o_xyl','0.040652','0.417487','0.238791','0.120687','2.534537','0.041309','0.315648','0.325529','0.036873']
krig_post(8,*)=[ 'eb','0','0.102475','0','0.027145','0.595257','0.009338','0.064274','0.064023','0.007178']
krig_post(9,*)=[ 'tca','0','0.006815','0','0.006618','1.685319','0.379791','0.033224','0.008685','0.005363']
krig_post_sd=strarr(10,10); kriged standard deviation * 2
krig_post_sd(0,*)=[ 'und','0','9.524178285','10.228792','9.885745','4.436049','6.223662','0.407433','20.443807','0.082181']
krig_post_sd(1,*)=[ 'nap','0.993803','0.295337096','0.168726','0.255245','0.38026','0.132843','0.37282','0.355209','0.032755']
krig_post_sd(2,*)=[ 'dec','1.46482','7.729916','2.702807','6.394626','0.992800','2.537875','9.060105','7.857048','0.958394']
krig_post_sd(3,*)=[ 'm_xyl','0','0.220109','0.086343','0.115415','0.331372','0','0','0.264992','0.012335']
krig_post_sd(4,*)=[ 'tol','0.001785','0.004000','0.007532','0.163606','1.198518','0.048660','0.012636','0.204660','0.001785']
krig_post_sd(5,*)=[ 'dcb','1.044261','0.274831','0.088003','1.636055','0','0.265561','0.078191','3.917831','0.023051']
krig_post_sd(6,*)=[ 'tmb','0.172996','0.637884','0.293056','0.363462','0.269828','0.157154','0.439280','0.554818','0.245272']
krig_post_sd(7,*)=[ 'o_xyl','0.040036','0.518995','0.156463','0.246356','0.185538','0.098225','0.189114','0.793473','0.038933']
krig_post_sd(8,*)=[ 'eb','0','0.063781','0','0.047899','0.376975','0.017452','0.035345','0.214184','0.005770']
krig_post_sd(9,*)=[ 'tca','0','0.007211','0','0.042612','0.175603','0.029737','0.717027','0.016066','0.004271']
sample_time=strarr(2,1)
sample_time(0,*)=['pre']
sample_time(1,*)=['post']
;produce the ploting routine
; subscript i is for the cell
; subscript j is for the chemical
; subscript tt_count is for sampling time
tek_color
Window,XSize=1000,YSize=900
for i=5,5 do begin
for j=1, 1 do begin
for tt_count=0, 1 do begin
;print,i,j,tt_count
if (tt_count eq 0) then begin
krig_mean = krig_pre(j,i+1)
; krig_pre_sd=float(krig_pre_sd)
krig_sd = float(krig_pre_sd(j,i+1))/2
endif else begin
krig_mean = krig_post(j,i+1)
; krig_post_sd=float(krig_post_sd)
krig_sd=float(krig_post_sd(j,i+1))/2
endelse
s_time = sample_time(tt_count)
c_id=cell_c(i,0)
c_des=cell_c(i,1)
t_top=cell_c(i,3)
t_bot=cell_c(i,2)
chem_p=chem(j,0)
chem_f=chem(j,0)+'_flag'
chem_name=chem(j,1)
;extract data from data base
env_handle=ODBC_INIT()
;connect to database
access_id=ODBC_CONNECT(env_handle,'MS Access 97 Database','Admin/')
cell = string(c_id, Format='(A1)')
;print, cell
;print, s_time
;print, chemical
;
;data required to make the sample have any value
;one needs to know at a minimum;
;field_vial_water_mecl_wt, and field_vial_water_mecl_solid_wt
;we will assume that concentrations that are not reported
;are not considered unless there is a flag indicating bdl or bql
;then nulls can be considered to be 0.0001 a number above
;zero was selected to permit doing a log transformation
;a flag aql will not be considered and deleted from the data set
;
data_sel = "SELECT northing,easting,elevation,sample_top,sample_bottom"+$
" ,lab_vial_water_wt, lab_vial_water_mecl_wt, "+$
" field_vial_water_mecl_wt,field_vial_water_mecl_solid_wt,"+$
" wet_wt_solid,dry_wt_solid,sample_category"
data_sel = data_sel + ", " + chem_p +", "+ chem_f
data_sel = data_sel + " FROM tblObjects_locations "+$
" INNER JOIN (tblCore_samples INNER JOIN tblCore_sample_chemistry "+$
" ON tblCore_samples.sample = tblCore_sample_chemistry.sample) ON (tblObjects_locations.key = "+$
" tblCore_samples.tblkey) AND (tblObjects_locations.key = tblCore_sample_chemistry.tblkey) "+$
" where "+$
" elevation is not null and field_vial_water_mecl_wt is not null"+$
" and field_vial_water_mecl_solid_wt is not null"
data_sel = data_sel + ' and tblCore_sample_chemistry.cell_id = ' + "'" + cell +"'"
data_sel = data_sel + ' and sample_category like '
data_sel = data_sel + "'%"+s_time+"%'"+ "ORDER BY elevation"
print, data_sel
borings=odbc_sql(access_id, data_sel)
print, borings
ODBC_DISCONNECT, access_id
;info
print, N_elements(borings)
on_error_GOTO, finish
if N_Elements(borings) lt 5 then goto, finish
;put borings data into arrays
boringsarrayx=borings.easting
boringsarrayy=borings.northing
boringsarrayz=borings.elevation-((borings.sample_top + borings.sample_bottom)/2)
boringsarraylww= borings.lab_vial_water_wt
boringsarraylwmw = borings.lab_vial_water_mecl_wt
boringsarrayfwmw = borings.field_vial_water_mecl_wt
boringsarrayfwmsw = borings.field_vial_water_mecl_solid_wt
boringsarraywws = borings.wet_wt_solid
boringsarraydws = borings.dry_wt_solid
;
; assume laboratory weights determine amount of mecl present
; and field weights determine the amount of soil and moisture in soil
; assume density of mec = 1.326
;
;
;The chemical concentration is in the 13 field of data so
;use the tag index to eatract the correct field for chemical
;concentration (field-1 or 12)
;
bchem=borings.(12)
flag=borings.(13)
;print,flag
;print, 'flag'
; set conc = 0.0001 if there is a flag equal to bdl
for m=0,N_Elements(flag)-1 DO BEGIN
if flag(m) eq 'bdl' then bchem(m)=0.0001
if flag(m) eq 'bql' then bchem(m)=0.0001
;print, flag(m),conc(m)
endfor
;print, bchem
;determine number of observations
;xx=size(borings)
;lastrow=xx(1)
lastrow=N_Elements(bchem)
;print,lastrow, 'lastrow'
for ii = 0,lastrow - 1 do begin
;print, ii
;print,bchem(ii),boringsarraylww(ii),boringsarraylwmw(ii),boringsarrayfwmsw(ii)
;
; everything was measured most likely moisture content of soil measured separately
;
if boringsarraylwmw(ii) ne 0.0 $
and boringsarraylww(ii) ne 0.0 $
and boringsarraydws(ii) ne 0.0 $
and boringsarraywws(ii) ne 0.0 $
and boringsarrayfwmsw(ii) ne 0.0 $
and boringsarrayfwmw(ii) ne 0.0 then begin
wmec=boringsarraylwmw(ii) - boringsarraylww(ii)
w_chem=bchem(ii)*wmec/1.326;wt is in micro grams
ww_sample_ext=boringsarrayfwmsw(ii) - boringsarrayfwmw(ii)
wat_cont=(boringsarraywws(ii) - boringsarraydws(ii))/boringsarraydws(ii)
wt_sample_ext=ww_sample_ext*(1-wat_cont)
bchem(ii)=w_chem/wt_sample_ext ; bchem is in mg/kg
goto, jump1
;
; now try assuming there was no lab measurements to determine weight of MEC and assume a
; volume of 5 ml but soil samples were collected and measured independently for moisture
; content
;
endif $
else if boringsarraylwmw(ii) eq 0.0 $
and boringsarrayfwmsw(ii) ne 0.0 $
and boringsarraywws(ii) ne 0.0 then begin
w_chem = bchem(ii)*5.
wat_cont=(boringsarraywws(ii) - boringsarraydws(ii))/boringsarraydws(ii)
ww_sample_ext=boringsarrayfwmsw(ii) - boringsarrayfwmw(ii)
wt_sample_ext=ww_sample_ext*(1-wat_cont)
bchem(ii)=w_chem/wt_sample_ext ; bchem is in mg/kg
goto, jump1
endif $
;
; as a final try assume the field vial water mec was measured, the field vial mce water solid
; was measured and some how they came up with a weight of soild and the dry soil weight is
; actually the weight of soil in the vial this means that I am assuming a volume of 5 ml of
; MEC and the core chemistry table only gives me the dry weight of soil
;
else if boringsarraydws(ii) ne 0.0 $
and boringsarrayfwmsw(ii) ne 0.0 $
and boringsarrayfwmw(ii) ne 0.0 then begin
bchem(ii)= bchem(ii)*5/boringsarraydws(ii)
goto, jump1
endif else begin
print, 'insuficient data to calculate'
endelse ;end of else clause
jump1: ;print,bchem(ii)
endfor
print,bchem
;
; this should have created an array of values in bchem which
; is all of the masses on a soil weight basis for the given
; sampling period and given cell for the contaminant of choice
conc_data= BUILD_TABLE('bchem,boringsarrayx,boringsarrayy,boringsarrayz')
;print,conc_data
conc_data=QUERY_TABLE(conc_data,'* Order By boringsarrayz')
;info, /Structure, conc_data
data_c=QUERY_TABLE(conc_data, '* where bchem ne "0"')
;print, data_c
;when interpolating data as a function of depth having values at the same elevation
;creates problems. Since the depth data is approximate values will be adjusted such
;that no two have the same value
nrows=N_elements(data_c)
;print,nrows
counter=0
value=data_c(0).boringsarrayz
;info, data_c
;info,value
;print,value
for n=1,nrows-1 do begin
start:
if data_c(n).boringsarrayz ne value then goto, no_dup
counter=counter+1
data_c(n).boringsarrayz=data_c(n).boringsarrayz+(0.001*counter)
n=n+1
if n gt (nrows-1) then goto, cont
goto, start
no_dup: counter=0
value=data_c(n).boringsarrayz
endfor
cont:
;print,data_c
;plot_concentration,data_c,tt_count
;now we need to
;determine extents of the cell by getting the coordinates of
;the cell we will determine the max and min northing and
;extend to the next whole integer so that we can grid the
;data
;
;
; get the extents of the cell such that an enclosing
; polygon can be drawn
;
data_sel = 'SELECT northing,easting,elevation,object_id,object_type'
data_sel = data_sel + ' FROM tblObjects_locations WHERE '
data_sel = data_sel + ' cell_id = ' + "'" + cell +"' and"
data_sel = data_sel + ' northing is not null and'
data_sel = data_sel + ' easting is not null and'
data_sel = data_sel + " object_type = 'c'"
data_sel = data_sel + ' ORDER BY object_id'
;print, data_sel
env_handle=ODBC_INIT()
;connect to database
access_id=ODBC_CONNECT(env_handle,'MS Access 97 Database','Admin/')
cell_b = odbc_sql(access_id,data_sel)
ODBC_DISCONNECT, access_id
;print,i,j,tt_count
plot_mass,data_c,tt_count,t_top,t_bot,c_id,chem_name,c_des,cell_b,krig_mean,krig_sd
;print, c_id_p,c_des_p,chem_p,chem_name_p,t_top,t_bot
;plot2,c_id_p,c_des_p,chem_p,chem_name_p,t_top,t_bot
;wshow,0,1
;wait,4
;wprint,0,printer_name='EPSON Stylus COLOR 1520'
f_name='e:\serdp\plots\'+string(test_type)+cell_c(i,0)+chem(j,0)+'.emf'
f_name2='d:\Projects\html_report\'+string(test_type)+cell_c(i,0)+chem(j,0)+'.emf'
;print,f_name
status=wwrite_meta(0,Filename=f_name)
status=wwrite_meta(0,Filename=f_name2)
info, /memory
endfor
finish:
;print,'pass first endfor'
endfor
;print,'pass second endfor'
;print, 'pass finish'
endfor
;print, 'pass third endfor'
end