@@ -47,7 +47,8 @@ ddLookup.sheet = {'pcb101' : "PCB data" , 'pcb105' : "PCB data" , 'pcb110' : "PC
4747 'pcb66' : "PCB data" , 'acenapth' : "PAH data" , 'acenapthylene' : "PAH data" , 'anthracn' : "PAH data" , 'baa' : "PAH data" , 'bap' : "PAH data" ,
4848 'bbf' : "PAH data" , 'benzghip' : "PAH data" , 'bep' : "PAH data" , 'bkf' : "PAH data" , 'c1n' : "PAH data" , 'c1phen' : "PAH data" , 'c2n' : "PAH data" ,
4949 'c3n' : "PAH data" , 'chrysene' : "PAH data" , 'dibenzah' : "PAH data" , 'flurant' : "PAH data" , 'fluorene' : "PAH data" , 'indypr' : "PAH data" ,
50- 'napth' : "PAH data" , 'perylene' : "PAH data" , 'phenant' : "PAH data" , 'pyrene' : "PAH data" , 'thc' : "PAH data" , 'ahch' : "Organochlorine data" ,
50+ 'napth' : "PAH data" , 'perylene' : "PAH data" , 'phenant' : "PAH data" , 'pyrene' : "PAH data" , //'thc' : "PAH data" ,
51+ 'ahch' : "Organochlorine data" ,
5152 'bhch' : "Organochlorine data" , 'ghch' : "Organochlorine data" , 'dieldrin' : "Organochlorine data" , 'hcb' : "Organochlorine data" ,
5253 'dde' : "Organochlorine data" , 'ddt' : "Organochlorine data" , 'tde' : "Organochlorine data" , 'bde100' : "BDE data" , 'bde138' : "BDE data" ,
5354 'bde153' : "BDE data" , 'bde154' : "BDE data" , 'bde17' : "BDE data" , 'bde183' : "BDE data" , 'bde28' : "BDE data" , 'bde47' : "BDE data" ,
@@ -234,6 +235,7 @@ function processDDExcelData(data, url, mlaInput) {
234235 // dateAnalysed = extractDataFromSheet();
235236 selectedSampleInfo = sampleInfo ;
236237 selectedSampleMeasurements = sampleMeasurements ;
238+ postLoadSnapShot ( ) ;
237239 updateChart ( ) ;
238240}
239241
@@ -274,10 +276,14 @@ function extractDataFromSheet(sheetData, mlApplication) {
274276 sampleInfo [ dateSampled ] . position = { } ;
275277 sampleInfo [ dateSampled ] . label = dateSampled ;
276278 uniqueRows . forEach ( row => {
279+ let correctedDepth = parseFloat ( row [ CEFASdepth ] ) ;
280+ if ( correctedDepth < 0 ) {
281+ correctedDepth = 0 ;
282+ }
277283 sampleInfo [ dateSampled ] . position [ row [ CEFASsamplename ] ] = {
278- 'Position latitude' : row [ CEFASlatitude ] ,
279- 'Position longitude' : row [ CEFASlongitude ] ,
280- 'Sampling depth (m)' : row [ CEFASdepth ] ,
284+ 'Position latitude' : parseFloat ( row [ CEFASlatitude ] ) ,
285+ 'Position longitude' : parseFloat ( row [ CEFASlongitude ] ) ,
286+ 'Sampling depth (m)' : { minDepth : correctedDepth , maxDepth : correctedDepth } ,
281287 'label' : row [ CEFASsamplename ] ,
282288 } ;
283289 } ) ;
@@ -335,7 +341,7 @@ function extractDataFromSheet(sheetData, mlApplication) {
335341 } ) ;
336342 for ( const sheetName in meas ) {
337343 meas [ sheetName ] [ 'Unit of measurement' ] = CEFASMeasurementUnit [ sheetName ] ;
338- // Fill in 0 for missing positions
344+ /*SRG250920 // Fill in 0 for missing positions
339345// for (const chemical in determinands[sheetName]) {
340346 for (let i = 0; i < determinands[sheetName].length; i++) {
341347 const chemical = determinands[sheetName][i];
@@ -346,8 +352,8 @@ function extractDataFromSheet(sheetData, mlApplication) {
346352/* if(!(meas[sheetName].chemicals[chemical].samples[sample])) {
347353 meas[sheetName].chemicals[chemical].samples[sample] = 0;
348354 }*/
349- }
350- }
355+ // }
356+ // }
351357 }
352358 sampleMeasurements [ dateSampled ] = meas ;
353359 for ( const sheetName in meas ) {
@@ -388,16 +394,16 @@ function closeCEFASSearch(centreLat,centreLon,radius,startDate,finishDate) {
388394 }
389395 mlas = [ ] ;
390396 uniqueRows = CEFASUniqueRows ;
391- // console.log(uniqueRows);
397+ console . log ( uniqueRows ) ;
392398 uniqueRows . forEach ( row => {
393399 samplingDate = new Date ( parseDates ( row [ CEFASsampledate ] ) [ 0 ] ) ;
394400 sampleLat = row [ CEFASlatitude ] ;
395401 sampleLon = row [ CEFASlongitude ] ;
396402 distance = 1000 * haversineDistance ( sampleLat , sampleLon , centreLat , centreLon ) ;
397403 if ( distance <= radius ) {
398- // console.log(startDate);
404+ console . log ( startDate ) ;
399405 if ( startDate . toString ( ) === 'Invalid Date' || finishDate . toString ( ) === 'Invalid Date' ) {
400- // console.log('Pushing Invalid Date');
406+ console . log ( 'Pushing Invalid Date' ) ;
401407 mlas . push ( row [ CEFASmla ] ) ;
402408 } else {
403409 if ( isBetweenDates ( startDate , finishDate , samplingDate ) ) {
@@ -406,16 +412,24 @@ function closeCEFASSearch(centreLat,centreLon,radius,startDate,finishDate) {
406412 }
407413 }
408414 } ) ;
415+ // let mlaReturn = document.getElementById('mlApplications');
416+ // let mlaInput = mlaReturn.value;
417+ //console.log(mlaInput);
418+ // if (!(mlaInput === undefined || mlaInput === null)) {
419+ // let mlas = mlaInput.trim().split(',').map(mla => mla.trim()); // Split comma-separated URLs
409420console . log ( mlas ) ;
410- if ( mlas . length > 0 ) {
411- mlas . forEach ( mlApplication => {
421+ if ( mlas . length > 0 ) {
422+ mlas . forEach ( mlApplication => {
412423//console.log(mlApplication);
413424 extractDataFromSheet ( CEFASdata , mlApplication ) ;
414425 } ) ;
426+ }
427+ //}
415428 selectedSampleInfo = sampleInfo ;
416429 selectedSampleMeasurements = sampleMeasurements ;
430+ postLoadSnapShot ( ) ;
417431 updateChart ( ) ;
418- }
432+
419433}
420434
421435function sedDredgeDataDisplay ( noMLAs , noDatasets ) {
0 commit comments