|
120 | 120 | 'Total Hydrocarbon', 'Gorham LMW Sum', 'Gorham HMW Sum', 'ICES7 PCB Sum' |
121 | 121 | ]; |
122 | 122 |
|
123 | | - const primarySortingOptions = ['None', 'Date of Sampling', 'Sample Name', 'Date & Sample Name']; |
| 123 | + const primarySortingOptions = [ |
| 124 | + 'None', 'Date of Sampling', 'Sample Name', 'Date & Sample Name', 'Sample Name & Date', |
| 125 | + 'Dataset Name', 'Dataset Name & Sample Name ', 'Sample Name & Dataset Name']; |
124 | 126 | const secondarySortingOptions = [ |
125 | 127 | 'Latitude', 'Longitude', 'Min Depth', 'Max Depth', 'Mean Depth', |
126 | 128 | 'Total Area', 'Total Solids', 'Organic Matter', |
@@ -1137,7 +1139,7 @@ fred = df; |
1137 | 1139 | //fred = sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]; |
1138 | 1140 | // if (!sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)']) { |
1139 | 1141 | // if (sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]]['Total solids (% total sediment)'] === undefined) { |
1140 | | -console.log('New test: No total solids'); |
| 1142 | +console.log('New test: No total solids',dateSampled, sheetName); |
1141 | 1143 | // Code that reads Total Solids column into physical data |
1142 | 1144 | if (!('Total solids (% total sediment)' in sampleMeasurements[dateSampled]['Physical Data'].samples[allSamples[0]])) { |
1143 | 1145 | col = startCol + 3; |
@@ -1198,14 +1200,16 @@ let missingTotalSolids = true; |
1198 | 1200 | if (df[startRow - 3][startCol + 4].includes('Exempt')) { |
1199 | 1201 | deltaExempt = 1; |
1200 | 1202 | } |
| 1203 | + let blankLine = 0; |
1201 | 1204 | for (let col = startCol + 6 + deltaExempt; col < df[startRow - 1].length; col++) { |
1202 | 1205 | meas.sizes.push(parseFloat(df[startRow - 2][col]) || 0); |
1203 | | - for (let row = startRow; row < 38; row++) { |
| 1206 | + for (let row = startRow; row < df.length; row++) { |
1204 | 1207 | sample = df[row][startCol + 2]; //bodge to pick up sample id |
1205 | 1208 | // If sample id not present then use Laboratory sample number instead |
1206 | 1209 | if (sample == undefined || sample == null) { |
1207 | 1210 | sample = df[row][startCol]; |
1208 | 1211 | } |
| 1212 | + //Stop if no sample id - end of data - may break if blank rows in data |
1209 | 1213 | if (!(sample == undefined || sample == null)) { |
1210 | 1214 | //console.log(sheetName, col, row, sample); |
1211 | 1215 | if (!meas.samples) { |
@@ -1237,6 +1241,11 @@ let missingTotalSolids = true; |
1237 | 1241 | //console.log(sample); |
1238 | 1242 | meas.samples[sample].psd.push(parseFloat(df[row][col]) || 0); |
1239 | 1243 | //console.log('meas.psd ',df[row][col]); |
| 1244 | + } else { |
| 1245 | + blankLine += 1; |
| 1246 | + if (blankLine > 5) { // Allow for up to 5 blank lines in PSD data |
| 1247 | + break; |
| 1248 | + } |
1240 | 1249 | } |
1241 | 1250 | } |
1242 | 1251 | } |
|
0 commit comments