Skip to content

Commit 8c99a63

Browse files
committed
Version 1 initial release logging removed
1 parent 47c4173 commit 8c99a63

6 files changed

Lines changed: 335 additions & 1137 deletions

File tree

SedimentDataExplorer.html

Lines changed: 55 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -218,12 +218,6 @@
218218
color: var(--primary-color);
219219
}
220220

221-
.input-group {
222-
display: flex;
223-
flex-direction: column;
224-
gap: 0.4rem;
225-
}
226-
227221
label {
228222
font-size: 0.85rem;
229223
font-weight: 500;
@@ -558,18 +552,55 @@
558552
/* Other sidebar styles (width, etc.) go here */
559553
}
560554

555+
/* Add this new class for horizontal layouts */
556+
.horizontal-group {
557+
flex-direction: row;
558+
display: flex;
559+
flex-wrap: wrap;
560+
gap: 15px; /* Adds space between items */
561+
align-items: center; /* Vertically aligns elements */
562+
}
563+
564+
565+
.input-group {
566+
display: flex;
567+
flex-direction: row; /* Change to row to align items horizontally */
568+
flex-wrap: wrap; /* Allows items to wrap onto a new line if the container is too narrow */
569+
gap: 15px; /* Adds horizontal space between the elements */
570+
align-items: center; /* Vertically aligns the labels and inputs */
571+
margin-bottom: 15px; /* Adds space between lines */
572+
}
573+
574+
.input-line {
575+
/* Make this container a flexbox container */
576+
display: flex;
577+
/* This aligns the items horizontally */
578+
flex-wrap: wrap;
579+
/* This adds space between the items */
580+
gap: 15px;
581+
/* This vertically centers the labels and inputs */
582+
align-items: center;
583+
/* Adds vertical space between the lines of inputs */
584+
margin-bottom: 15px;
585+
}
586+
587+
.input-line label {
588+
white-space: nowrap; /* Prevents the label text from wrapping */
589+
}
590+
561591
</style>
562592
</head>
563593

564594
<body>
565595
<div id="everything" style="display: none;"></div>
566596

567597
<header>
568-
<h1>Sediment Data Explorer <small style="font-weight: normal; opacity: 0.8;">v0.20250919</small></h1>
598+
<h1>Sediment Data Explorer <small style="font-weight: normal; opacity: 0.8;">v1.20250928</small></h1>
569599
<div class="header-actions">
570600
<button onclick="updateChart()">(Re)Plot Chart</button>
571601
<button onclick="exportCharts()" class="secondary">Export Chart</button>
572602
<button onclick="clearData()" class="secondary">Clear Data</button>
603+
<button id="toggleMapBtn" onclick="toggleMap()">Hide Map</button>
573604
</div>
574605
</header>
575606

@@ -681,8 +712,6 @@ <h1>Sediment Data Explorer <small style="font-weight: normal; opacity: 0.8;">v0.
681712
</div>
682713
</div>
683714
</fieldset>
684-
<button id="toggleMapBtn" onclick="toggleMap()">Hide Map</button>
685-
686715
</aside>
687716

688717
<main class="output-area">
@@ -751,16 +780,24 @@ <h2>Filter Datasets</h2>
751780
<h2>Select Samples</h2>
752781
<div style="display: flex; gap: 0.5rem; flex-wrap: wrap;"><button onclick="flipSampleSelections(true)">Select All</button><button onclick="flipSampleSelections(false)">Select None</button><button onclick="selectHighlighted()">Select Highlighted</button></div>
753782
<hr>
783+
754784
<p><strong>Filter Samples:</strong></p>
755-
<div class="input-group">
756-
<label for="centreLat">Centre latitude:</label><input type="number" id="centreLat" placeholder="Leave blank for location">
757-
<label for="centreLon">Centre longitude:</label><input type="number" id="centreLon" placeholder="Leave blank for location">
758-
<label for="centreDist">Distance (m):</label><input type="number" id="centreDist" placeholder="Select 1 location">
759-
<br>
760-
<label for="minDepth">Minimum depth:</label><input type="number" id="minDepth">
761-
<label for="maxDepth">Maximum depth:</label><input type="number" id="maxDepth">
762-
<label for="containsText">Filter by name (contains text):</label><input type="text" id="containsText">
763-
</div>
785+
786+
<div class="horizontal-group">
787+
<label for="centreLat">Centre latitude:</label><input type="number" id="centreLat" placeholder="Leave blank for location">
788+
<label for="centreLon">Centre longitude:</label><input type="number" id="centreLon" placeholder="Leave blank for location">
789+
<label for="centreDist">Distance (m):</label><input type="number" id="centreDist" placeholder="Select 1 location">
790+
</div>
791+
792+
<div class="horizontal-group">
793+
<label for="minDepth">Minimum depth:</label><input type="number" id="minDepth">
794+
<label for="maxDepth">Maximum depth:</label><input type="number" id="maxDepth">
795+
</div>
796+
797+
<div class="input-group">
798+
<label for="containsText">Filter by name (contains text):</label><input type="text" id="containsText">
799+
</div>
800+
764801
<div>Must have measurement of - <input type="checkbox" id="tracemetaldatasample"><label for="tracemetaldatasample">Trace metal data</label>
765802
<input type="checkbox" id="pahdatasample"><label for="pahdatasample">PAH data</label>
766803
<input type="checkbox" id="pcbdatasample"><label for="pcbdatasample">PCB data</label>

SedimentDataExplorer.js

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -445,10 +445,14 @@ function postLoadSnapShot() {
445445
const jsonData = JSON.parse(decodedData);
446446

447447
// Now jsonData contains the loaded data
448-
sampleInfo = jsonData.sampleInfo;
448+
/* sampleInfo = jsonData.sampleInfo;
449449
sampleMeasurements = jsonData.sampleMeasurements;
450450
selectedSampleInfo = jsonData.selectedSampleInfo;
451-
selectedSampleMeasurements = jsonData.selectedSampleMeasurements;
451+
selectedSampleMeasurements = jsonData.selectedSampleMeasurements;*/
452+
Object.assign(sampleInfo, jsonData.sampleInfo);
453+
Object.assign(sampleMeasurements, jsonData.sampleMeasurements);
454+
Object.assign(selectedSampleInfo, jsonData.selectedSampleInfo);
455+
Object.assign(selectedSampleMeasurements, jsonData.selectedSampleMeasurements);
452456
postLoadSnapShot();
453457
updateChart();
454458
return jsonData;
@@ -773,12 +777,12 @@ function importData() {
773777
const statusParam = suppliedParams.get('status');
774778
if (statusParam) {
775779
loadStatus(statusParam);
776-
} else {
780+
}// else {
777781
const urlParam = suppliedParams.get('urls');
778782
if (urlParam) {
779783
urls = urlParam.split(',').map(url => url.trim()); // Split comma-separated URLs
780784
}
781-
}
785+
// }
782786
checkboxParameters(suppliedParams, 'selcharts', dataSheetNamesCheckboxes);
783787
checkboxParameters(suppliedParams, 'subcharts', subChartNames);
784788
const featuresParams = suppliedParams.get('features');
@@ -1131,8 +1135,8 @@ function processExcelData(data, url, fileNumber) {
11311135
}
11321136
}
11331137
}
1134-
console.log('meas ',meas,sheetName,dateSampled);
1135-
fred = df;
1138+
//console.log('meas ',meas,sheetName,dateSampled);
1139+
//fred = df;
11361140
if ('total' in meas) {
11371141

11381142
allSamples = Object.keys(meas.total);
@@ -1141,13 +1145,13 @@ fred = df;
11411145
//fred = sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]];
11421146
// if (!sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)']) {
11431147
// if (sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)'] === undefined) {
1144-
console.log('New test: No total solids',dateSampled, sheetName, allSamples[0]);
1148+
//console.log('New test: No total solids',dateSampled, sheetName, allSamples[0]);
11451149
//console.log(sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]);
11461150
// Code that reads Total Solids column into physical data
11471151
if (!(sampleMeasurements[dateSampled]?.['Physical Data']?.samples?.[allSamples[0]]?.['Total solids (% total sediment)'])) {
11481152
col = startCol + 3;
11491153
row = startRow - 2;
1150-
console.log('col ',col,' row ',row, df[row][col]);
1154+
//console.log('col ',col,' row ',row, df[row][col]);
11511155
if(!(df[row][col] === undefined)) {
11521156
if (df[row][col].includes('Total Solids (%)')) {
11531157
//console.log('Total Solids found column found');
@@ -1255,9 +1259,14 @@ let missingTotalSolids = true;
12551259
break;
12561260
}
12571261
}
1262+
//console.log(sample);
1263+
if (!(sample in sampleInfo[dateSampled].position)) {
1264+
break;
1265+
}
12581266
}
12591267
}
12601268
totalOfTotalArea = 0;
1269+
//console.log(meas.samples);
12611270
for (sample in meas.samples) {
12621271
currentPsd = meas.samples[sample].psd;
12631272
retData = psdPostProcess(currentPsd,meas.sizes);
@@ -1272,6 +1281,7 @@ let missingTotalSolids = true;
12721281
meas.samples[sample].totalArea = retData['totalArea'];
12731282
// totalOfTotalArea += retData['totalArea'];
12741283
totalSum += retData['totalArea'];
1284+
//console.log(totalSum);
12751285
}
12761286
meas.sizes = [...standard_phiSizes, 0];
12771287
}
@@ -1285,25 +1295,16 @@ let missingTotalSolids = true;
12851295
meas['Date analysed'] = dateAnalysed;
12861296
meas['Unit of measurement'] = measurementUnit;
12871297
meas['Laboratory/contractor'] = contractor;
1298+
//if (sheetName === 'Physical Data') {console.log(meas,totalSum);}
12881299
// if (!(sheetName === 'Physical Data')) {
12891300
if (!totalSum > 0) {
12901301
disableRadioButtons(sortButtonGroups[sheetName], true);
12911302
return 'No data for ' + sheetName;
1292-
} /*else {
1293-
disableRadioButtons(sortButtonGroups[sheetName], false);
1294-
}*/
1295-
/* }
1296-
// if (sheetName === 'Physical Data' && Object.keys(meas.samples).length === 0) {
1297-
if (sheetName === 'Physical Data') {
1298-
if (totalOfTotalArea === 0) {
1299-
return 'No data for ' + sheetName;
1300-
} else {
1301-
disableRadioButtons(sortButtonGroups[sheetName], false);
13021303
}
1303-
}*/
13041304
//console.log(dateSampled, sheetName, 'meas ', meas);
13051305
// if (!(meas.samples === undefined || meas.samples === null)) {
13061306
if (sheetName === 'Physical Data') {
1307+
//console.log(meas);
13071308
for (sample in meas.samples) {
13081309
if (missingVisualAppearance) {
13091310
delete meas.samples[sample]['Visual Appearance'];
@@ -1316,6 +1317,7 @@ let missingTotalSolids = true;
13161317
}
13171318
}
13181319
}
1320+
//if (sheetName === 'Physical Data') {console.log(meas);}
13191321
sampleMeasurements[dateSampled][sheetName] = meas;
13201322
const sums = {};
13211323
//console.log(meas);

sdeCalcs4Charts.js

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -337,82 +337,6 @@ function dataForScatterCharting(sheetName) {
337337
return {unitTitle, scatterData, chemicalData}
338338
}
339339

340-
341-
/*function dataForTotalScatterCharting(sheetName, chartType) {
342-
let datesSampled = Object.keys(selectedSampleMeasurements);
343-
let ct = sheetName;
344-
let unitTitle = blankSheets[ct]['Unit of measurement'];
345-
let scatterData = {};
346-
let chemicalData = {};
347-
let fitConcentration = {};
348-
let fitPredictors = {};
349-
350-
datesSampled.forEach(ds => {
351-
if (ct in selectedSampleMeasurements[ds]) {
352-
let allChemicals = Object.keys(selectedSampleMeasurements[ds][ct].chemicals);
353-
for (const c in selectedSampleMeasurements[ds][ct].chemicals) {
354-
let i = 0;
355-
356-
if (!(scatterData[c])) scatterData[c] = [];
357-
if (chemicalData[c] == undefined || chemicalData[c] == null) chemicalData[c] = [];
358-
if (fitConcentration[c] == undefined || fitPredictors[c] == null) {
359-
fitConcentration[c] = {};
360-
fitPredictors[c] = {};
361-
}
362-
363-
let currentChemical = selectedSampleMeasurements[ds][ct].chemicals[c];
364-
for (const s in currentChemical.samples) {
365-
//console.log(ds,c,s);
366-
//let xValue;
367-
switch (chartType) {
368-
case "totalArea":
369-
//console.log(ds,s);
370-
xValue = sampleMeasurements[ds]['Physical Data'].samples[s].totalArea;
371-
break;
372-
373-
case "totalHC":
374-
xValue = sampleMeasurements[ds]['PAH data'].totalHC[s];
375-
break;
376-
377-
case "totalSolids":
378-
xValue = sampleMeasurements[ds]['Physical Data'].samples[s]['Total solids (% total sediment)'];
379-
break;
380-
381-
case "organicCarbon":
382-
xValue = sampleMeasurements[ds]['Physical Data'].samples[s]['Organic matter (total organic carbon)'];
383-
break;
384-
385-
default:
386-
console.error(`Unknown chart type: ${chartType}`);
387-
return;
388-
}
389-
scatterData[c][i] = {
390-
x: Number(xValue),
391-
y: currentChemical.samples[s],
392-
label: ds + ' : ' + s
393-
};
394-
if (!xValue) {
395-
console.log('Total scatter charting not possible for ', chartType, ' as no data available');
396-
unitTitle = 'No data';
397-
return { unitTitle };
398-
}
399-
chemicalData[c][i] = currentChemical.samples[s];
400-
fitConcentration[c][ds + ' : ' + s] = currentChemical.samples[s];
401-
fitPredictors[c][ds + ' : ' + s] = [xValue];
402-
i += 1;
403-
}
404-
}
405-
}
406-
});
407-
408-
// Return the result based on the chart type requirements
409-
// if (chartType === "totalHC") {
410-
// return { unitTitle, scatterData, chemicalData };
411-
// } else {
412-
return { unitTitle, scatterData, chemicalData, fitConcentration, fitPredictors };
413-
// }
414-
}*/
415-
416340
function dataForTotalScatterCharting(sheetName, chartType) {
417341
let datesSampled = Object.keys(selectedSampleMeasurements);
418342
let ct = sheetName;
@@ -477,7 +401,7 @@ function dataForTotalScatterCharting(sheetName, chartType) {
477401
y: currentChemical.samples[s],
478402
label: selectedSampleInfo[ds].label + ': ' + selectedSampleInfo[ds].position[s].label,
479403
};
480-
console.log(xValue);
404+
//console.log(xValue);
481405
ii += 1;
482406
if (!xValue) {
483407
// reverted to 250502 version of test not sure why? if (!(typeof xValue === "number")) {
@@ -527,9 +451,6 @@ console.log(xValue);
527451
// }
528452
}
529453

530-
531-
532-
533454
function sumsForCongenerCharting() {
534455
let datesSampled = Object.keys(selectedSampleMeasurements);
535456
let measChart = {};

0 commit comments

Comments
 (0)