Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geomagnetic-coords

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geomagnetic-coords - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

13

dist/findMagneticPole.js

@@ -1,13 +0,6 @@

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.findMagneticPole = void 0;
const magnetic_north_json_1 = __importDefault(require("./magnetic_north.json"));
const findMagneticPole = (date) => {
import MAGNETIC_NORTH from './magnetic_north.json';
export const findMagneticPole = (date) => {
const year = (date || new Date()).getFullYear();
const magNorth = magnetic_north_json_1.default.find(entry => entry.year === year);
const magNorth = MAGNETIC_NORTH.find(entry => entry.year === year);
return magNorth || { latitude: 80.8, longitude: 287.4 }; // 2024
};
exports.findMagneticPole = findMagneticPole;

@@ -1,6 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.geo2mag = void 0;
const findMagneticPole_1 = require("./findMagneticPole");
const multiplyVectorByMatrix_1 = require("./multiplyVectorByMatrix");
import { findMagneticPole } from './findMagneticPole';
import { multiplyVectorByMatrix } from './multiplyVectorByMatrix';
const HALF_PI = Math.PI / 2;

@@ -14,4 +11,4 @@ const TO_RADIANS = Math.PI / 180;

// ; array [2,n] of n such coordinates.
const geo2mag = (request) => {
const magNorth = (0, findMagneticPole_1.findMagneticPole)(request.date);
export const geo2mag = (request) => {
const magNorth = findMagneticPole(request.date);
// ; SOME 'constants'...

@@ -70,3 +67,3 @@ // Dlong=288.59D ; longitude (in degrees) of Earth's magnetic south pole

// out=geolong2maglong # [x,y,z]
let out = (0, multiplyVectorByMatrix_1.multiplyVectorByMatrix)([x, y, z], geolong2maglong);
let out = multiplyVectorByMatrix([x, y, z], geolong2maglong);
// ;Second rotation : in the plane of the current meridian from geographic

@@ -91,3 +88,3 @@ // ; pole to magnetic dipole pole.

// out= tomaglat # out
out = (0, multiplyVectorByMatrix_1.multiplyVectorByMatrix)(out, tomaglat);
out = multiplyVectorByMatrix(out, tomaglat);
// ;convert back to latitude, longitude and altitude

@@ -107,2 +104,1 @@ // mlat=atan(out[2,*],sqrt(out[0,*]^2+out[1,*]^2))

};
exports.geo2mag = geo2mag;

@@ -1,18 +0,2 @@

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./geo2mag"), exports);
__exportStar(require("./mag2geo"), exports);
export * from "./geo2mag";
export * from "./mag2geo";

@@ -1,6 +0,3 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.mag2geo = void 0;
const findMagneticPole_1 = require("./findMagneticPole");
const multiplyVectorByMatrix_1 = require("./multiplyVectorByMatrix");
import { findMagneticPole } from './findMagneticPole';
import { multiplyVectorByMatrix } from './multiplyVectorByMatrix';
const HALF_PI = Math.PI / 2;

@@ -11,4 +8,4 @@ const TO_RADIANS = Math.PI / 180;

// FUNCTION mag2geo,incoord
const mag2geo = (request) => {
const magNorth = (0, findMagneticPole_1.findMagneticPole)(request.date);
export const mag2geo = (request) => {
const magNorth = findMagneticPole(request.date);
// ; SOME 'constants'...

@@ -65,3 +62,3 @@ // Dlong=288.59D ; longitude (in degrees) of Earth's magnetic south pole

// out= togeolat # [x,y,z]
let out = (0, multiplyVectorByMatrix_1.multiplyVectorByMatrix)([x, y, z], togeolat);
let out = multiplyVectorByMatrix([x, y, z], togeolat);
// ;Second rotation matrix : rotation around plane of the equator, from

@@ -86,3 +83,3 @@ // ;the meridian containing the magnetic poles to the Greenwich meridian.

// out=maglong2geolong # out
out = (0, multiplyVectorByMatrix_1.multiplyVectorByMatrix)(out, maglong2geolong);
out = multiplyVectorByMatrix(out, maglong2geolong);
// ;convert back to latitude, longitude and altitude

@@ -101,2 +98,1 @@ // glat=atan(out[2,*],sqrt(out[0,*]^2+out[1,*]^2))

};
exports.mag2geo = mag2geo;

@@ -1,5 +0,2 @@

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.multiplyVectorByMatrix = void 0;
function multiplyVectorByMatrix(vector, matrix) {
export function multiplyVectorByMatrix(vector, matrix) {
// Check if the vector and matrix are compatible for multiplication

@@ -19,2 +16,1 @@ if (vector.length !== matrix[0].length) {

}
exports.multiplyVectorByMatrix = multiplyVectorByMatrix;
{
"name": "geomagnetic-coords",
"description": "Dependency-free geomagnetic<-->geographic coordinate transformer ",
"version": "0.0.3",
"version": "0.0.4",
"author": "Joseph Beuckman <joebeuckman@gmail.com> (jbeuckm.github.io)",

@@ -6,0 +6,0 @@ "repository": {

@@ -28,5 +28,5 @@ {

/* Modules */
"module": "commonjs", /* Specify what module code is generated. */
"module": "es6", /* Specify what module code is generated. */
// "rootDir": "./", /* Specify the root folder within your source files. */
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
"moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */

@@ -33,0 +33,0 @@ // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc