Skip to content

Commit

Permalink
Merge pull request #81 from Jollyfant/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Jollyfant authored Oct 27, 2021
2 parents ee77c92 + 6bd6644 commit 913ef0c
Show file tree
Hide file tree
Showing 13 changed files with 367 additions and 35 deletions.
38 changes: 35 additions & 3 deletions changelog/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,41 @@ <h5> Paleomagnetism.org 2 - Changelog </h5>

<div id="accordion">

<div class="card">
<div class="card-header" id="headingSix">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseSix" aria-expanded="true" aria-controls="collapseSix">
Paleomagnetism.org 2.3.0 - Bug Fixes and Features <small class="text-muted">&nbsp; 2021-10-27</small>
</button>
</div>
<div id="collapseSix" class="collapse show" aria-labelledby="headingSix" data-parent="#accordion">
<div class="card-body">
<b> Change Summary </b>
<p> Fixes were made to virtual geomagnetic pole calculations. The relative VGP distribution and cutoff algorithm use an arbitrary virtual site at location (0, 0). For the relative VGP distribution this does not matter. However, it means that for correct interpretation, all specimens in a collection should come from geographically adjacent areas.

<ul>
<p> <b> Features </b>
<li> Added VGP longitude, latitude to mean downloads CSV and JSON. This VGP is based on the mean of individual poles. It is not the VGP of the mean of directions which may differ slightly.
<li> Added option to show tick labels to Zijderveld plot.
<li> Added MAD angle in statistics portal directional tab CSV exporting. The MAD angle is only carried over from imported .col files since 2.2.1.
<li> Added option in settings tab to overlay individual samples in the collection mean tab.
<li> Added option in settings tab to set each mean collection to a random color.
<li> Added format for University of Helsinki (using block orientation).
</ul>

<ul>
<p> <b> Fixes </b>
<li> Fixed tooltip of site mean VGP in geography portal. The tooltip showed the projected equal area inclination instead of true inclination.
<li> Added disclaimer under the VGP distribution in the directions tab in the statistics portal to emphasize it is a relative distribution assuming a single site.
<li> Fixed bug in great circle PCA in geographic and tectonic coordinates where the pole to the plane was presented antipodal. The convention is that the pole is presented as negative (this has no effect on results).
<li> Swapped line styles for lower (solid) and upper (dashed) GC in hemisphere plot.
<li> Changed ordering of directions, mean and ellipse. Mean and ellipse should be on top in equal area plots.
<li> Fixed multiple problems with the Geological Survey of Finland format. Geographic coordinates were interpreted as specimen coordinates and some leading numerals were dropped reading the file. Data interpreted with this format before version 2.3.0 are therefore incorrect.
</ul>

</div>
</div>
</div>
<p>
<div class="card">
<div class="card-header" id="headingFive">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseFive" aria-expanded="true" aria-controls="collapseFive">
Expand Down Expand Up @@ -107,7 +142,6 @@ <h5> Paleomagnetism.org 2 - Changelog </h5>

<p>

<div id="accordion">

<div class="card">
<div class="card-header" id="headingFour">
Expand Down Expand Up @@ -173,8 +207,6 @@ <h5> Paleomagnetism.org 2 - Changelog </h5>

<p>

<div id="accordion">

<div class="card">
<div class="card-header" id="headingTwo">
<button class="btn btn-link" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="true" aria-controls="collapseTwo">
Expand Down
2 changes: 1 addition & 1 deletion geography/js/graphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ function plotPoles(dataSeries) {
"data": [{
"x": statistics.dir.mean.dec,
"y": projectInclination(statistics.dir.mean.inc),
"inc": projectInclination(statistics.dir.mean.inc),
"inc": statistics.dir.mean.inc,
"age": 0
}],
"lineWidth": 1,
Expand Down
5 changes: 4 additions & 1 deletion geography/js/magstrat.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,10 @@ function plotStrat() {
// Get all accepted/rejected directions and sort by strat. level
var stratigraphicData = new Array();

collections.pop().components.forEach(function(component) {
// Change to requested reference coordinates and apply the cutoff
var cutoff = doCutoff(collections.pop().components.map(x => x.inReferenceCoordinates()));

cutoff.components.forEach(function(component) {

var direction = component.coordinates.toVector(Direction);

Expand Down
6 changes: 6 additions & 0 deletions interpretation/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,10 @@ <h5> Paleomagnetism.org 2 - Interpretation </h5>
<option value="BCN2G">University of Barcelona</option>
<!-- Uses BCN2G -->
<option value="HELSINKI">University of Helsinki</option>
<option value="HELSINKIBLOCK">University of Helsinki (Block)</option>
<option value="MONTPELLIER">University of Montpellier</option>
<option value="OXFORD">University of Oxford</option>
<option value="ANGLIA">University of East Anglia</option>
<option value="RS3">University of Oslo</option>
<option value="MUNICH">University of Munich</option>
<option value="RENNES">University of Rennes</option>
Expand Down Expand Up @@ -416,6 +418,10 @@ <h5> Preferences </h5>
<input class="form-check-input" type="checkbox" id="show-labels" value="option1" checked>
<label class="form-check-label" for="show-labels"> Show labels</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="show-ticks" value="option1" checked>
<label class="form-check-label" for="show-ticks"> Show tick marks</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="checkbox" id="enable-sound" value="option1" checked>
<label class="form-check-label" for="enable-sound"> Sound </label>
Expand Down
2 changes: 1 addition & 1 deletion interpretation/js/graphs.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ function plotZijderveldDiagram(hover) {
});

var graphScale = Math.max.apply(Math, graphScale);
var tickFlag = false;
var tickFlag = document.getElementById("show-ticks").checked;
var enableLabels = document.getElementById("show-labels").checked;

var vHover;
Expand Down
167 changes: 162 additions & 5 deletions interpretation/js/importing.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function importGTK(file) {
let metadata = lines[7].split(/\s+/);
let latitude = Number(metadata[1]);
let longitude = Number(metadata[2]);
let coreAzimuth = Number(metadata[3]);
let coreAzimuth = (270 + Number(metadata[3])) % 360;
let coreDip = 90 - Number(metadata[4]);
let beddingStrike = Number(metadata[5]);
let beddingDip = Number(metadata[6]);
Expand All @@ -27,12 +27,25 @@ function importGTK(file) {
for(var i = 9; i < lines.length - 1; i++) {
let line = lines[i];
let step = line.slice(0, 4);
let dec = Number(line.slice(7, 12));
let dec = Number(line.slice(6, 12));
let inc = Number(line.slice(13, 19));
// Intensity in mA/m (Satu, pers. comm. 2020)
// Intensity in mA/m (Satu, pers. comm. 2020) (not used)
let intensity = 1E3 * Number(line.slice(24, 30));
let coordinates = new Direction(dec, inc, intensity).toCartesian();
steps.push(new Measurement(step, coordinates, null))

let y = 1E3 * Number(line.slice(50, 57));
let x = -1E3 * Number(line.slice(61, 68));
let z = 1E3 * Number(line.slice(72, 79));

let coordinates = new Coordinates(x, y, z);
let dir = coordinates.rotateTo(coreAzimuth, coreDip).toVector(Direction);

// Verify
if(dir.dec.toFixed(0) !== dec.toFixed(0) || dir.inc.toFixed(0) !== inc.toFixed(0)) {
throw("The given geographic coordinates do not match the rotated specimen coordinates for this file!");
}

steps.push(new Measurement(step, coordinates, null));

}

// Add the data to the application
Expand Down Expand Up @@ -1109,6 +1122,7 @@ function importPaleoMac(file) {
var x = 1E6 * Number(line.slice(5, 14)) / sampleVolume;
var y = 1E6 * Number(line.slice(15, 25)) / sampleVolume;
var z = 1E6 * Number(line.slice(25, 34)) / sampleVolume;

var a95 = Number(line.slice(69, 73));

var coordinates = new Coordinates(x, y, z);
Expand Down Expand Up @@ -1222,6 +1236,74 @@ function importOxford(file) {
}


function importAnglia(file) {


/*
* Function importAnglia
* Might be the same as NGU format (see below)
*/

var lines = file.data.split(LINE_REGEXP).filter(Boolean);
var parsedData = new Array();
var parameters = lines[0].split(/[,\s\t]+/);
var sampleName = parameters[0];

// Different convention for core orientation than Utrecht
var coreAzimuth = Number(parameters[1]);
var coreDip = Number(parameters[2]);
var sampleVolume = Number(parameters[5]);

// Bedding strike needs to be decreased by 90 for input convention
var beddingStrike = (Number(parameters[3]) + 270) % 360;
var beddingDip = Number(parameters[4]);
var info = parameters[5];

for(var i = 1; i < lines.length; i++) {

// Reduce empty lines
var parameters = lines[i].split(/[,\s\t]+/);
parameters = parameters.filter(function(x) {
return x !== "";
});

// Get Cartesian coordinates for specimen coordinates (intensities in mA -> bring to μA)
var intensity = 1E3 * Number(parameters[1]);
var dec = Number(parameters[5]);
var inc = Number(parameters[6]);

var coordinates = new Direction(dec, inc, intensity).toCartesian();
// Have to flip x coordinates. Old data format.. different convention?
coordinates = new Coordinates(-coordinates.x, coordinates.y, coordinates.z);
parsedData.push(new Measurement(parameters[0], coordinates, Number(parameters[4])));

}

specimens.push({
"demagnetizationType": null,
"coordinates": "specimen",
"format": "ANGLIA",
"version": __VERSION__,
"created": new Date().toISOString(),
"steps": parsedData,
"name": sampleName,
"longitude": null,
"latitude": null,
"age": null,
"ageMin": null,
"ageMax": null,
"sample": sampleName,
"volume": sampleVolume,
"lithology": null,
"beddingStrike": Number(beddingStrike),
"beddingDip": Number(beddingDip),
"coreAzimuth": Number(coreAzimuth),
"coreDip": Number(coreDip),
"interpretations": new Array()
});

}

function importNGU(file) {

/*
Expand Down Expand Up @@ -1276,6 +1358,7 @@ function importNGU(file) {
"created": new Date().toISOString(),
"steps": parsedData,
"name": sampleName,
"volume": sampleVolume,
"longitude": null,
"latitude": null,
"age": null,
Expand Down Expand Up @@ -1984,3 +2067,77 @@ function importHelsinki(file) {
});

}

function importHelsinkiBlock(file) {

/*
* Function importHelsinki
* Imports demagnetization data in the Helsinki format (plain-text csv)
*/

var lines = file.data.split(LINE_REGEXP);

// Get some header metadata
var sampleName = lines[5].split(";")[1]
// Strike not azimuth
var coreAzimuth = (Number(lines[5].split(";")[7]) - 90).toFixed(1);
// 90 is vertical, 0 is horizontal (other convention)
var coreDip = 90 - Number(lines[6].split(";")[7]);
var sampleVolume = Number(lines[7].split(";")[2]);
var demagnetizationType = lines[7].split(";")[7];

// Bedding is not included: always set to 0, 0
var beddingStrike = 0;
var beddingDip = 0;

var steps = new Array();

// Skip the header (12 lines)
lines.slice(12).forEach(function(line) {

var parameters = line.split(";");

if(parameters.length !== 24) {
return;
}

var step = parameters[1];

let dec = Number(parameters[5])
let inc = Number(parameters[6])

// Take mA/m and set to microamps (multiply by 1E3)
var y = Number(parameters[13]) * 1E3;
var x = -Number(parameters[14]) * 1E3;
var z = Number(parameters[15]) * 1E3;

var coordinates = new Coordinates(x, y, z);
steps.push(new Measurement(step, coordinates, null));

});

specimens.push({
"demagnetizationType": demagnetizationType,
"coordinates": "specimen",
"format": "HELSINKI",
"version": __VERSION__,
"created": new Date().toISOString(),
"steps": steps,
"level": null,
"longitude": null,
"latitude": null,
"age": null,
"ageMin": null,
"ageMax": null,
"lithology": null,
"sample": sampleName,
"name": sampleName,
"volume": Number(sampleVolume),
"beddingStrike": Number(beddingStrike),
"beddingDip": Number(beddingDip),
"coreAzimuth": Number(coreAzimuth),
"coreDip": Number(coreDip),
"interpretations": new Array()
});

}
22 changes: 22 additions & 0 deletions interpretation/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ function registerEventHandlers() {
document.getElementById("save-location").addEventListener("click", handleLocationSave);
document.getElementById("specimen-age-select").addEventListener("change", handleAgeSelection);

// Redraw on option change
document.getElementById("show-ticks").addEventListener("click", function() {
redrawCharts();
});
document.getElementById("show-labels").addEventListener("click", function() {
redrawCharts();
});

// Redraw when requested
document.getElementById("normalize-intensities").addEventListener("change", plotIntensityDiagram.bind(null, false));

Expand Down Expand Up @@ -94,6 +102,8 @@ function addDegmagnetizationFiles(format, files) {
return files.forEach(importApplicationSaveOld);
case "HELSINKI":
return files.forEach(importHelsinki);
case "HELSINKIBLOCK":
return files.forEach(importHelsinkiBlock);
case "GTK":
return files.forEach(importGTK);
case "CALTECH":
Expand All @@ -104,6 +114,8 @@ function addDegmagnetizationFiles(format, files) {
return files.forEach(importNGU);
case "PALEOMAC":
return files.forEach(importPaleoMac);
case "ANGLIA":
return files.forEach(importAnglia);
case "OXFORD":
return files.forEach(importOxford);
case "RS3":
Expand Down Expand Up @@ -2304,10 +2316,20 @@ function makeInterpretation(specimen, options) {
var geoCoordinates = inReferenceCoordinates("geographic", specimen, PCA.component.coordinates);
var geoMass = inReferenceCoordinates("geographic", specimen, PCA.component.centerMass);

// Bug fix when rotating the TAU3 pole may no longer be always negative..
if(options.type === "TAU3" && geoCoordinates.z > 0) {
geoCoordinates = geoCoordinates.reflect();
}

// Rotate component to tectonic coordinates
var tectCoordinates = inReferenceCoordinates("tectonic", specimen, PCA.component.coordinates);
var tectMass = inReferenceCoordinates("tectonic", specimen, PCA.component.centerMass);

// Bug fix when rotating the TAU3 pole may no longer be always negative..
if(options.type === "TAU3" && tectCoordinates.z > 0) {
tectCoordinates = tectCoordinates.reflect();
}

var comment;

if(document.getElementById("auto-comment").checked) {
Expand Down
Loading

0 comments on commit 913ef0c

Please sign in to comment.