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

geomagnetism

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geomagnetism - npm Package Compare versions

Comparing version 0.0.2 to 0.1.0

data/wmm-2015.json

0

bin/convert.js

@@ -0,0 +0,0 @@ var fs = require('fs');

var Model = require('./lib/model.js');
var geomagnetism = module.exports = {};
var models = null;
var modelData = [
require('./data/wmm-2015v2.json'),
require('./data/wmm-2015.json'),
];
var base_model;

@@ -8,6 +14,21 @@

date = date || new Date();
if (!base_model) {
base_model = new Model();
if (!models) {
models = modelData.map(function(data) {
return new Model(data);
});
}
return base_model.getTimedModel(date);
};
var ts = date.getTime();
var matchingModel;
for (var i = 0, n = models.length; i < n; ++i) {
if (models[i].start_date.getTime() > ts) continue;
if (models[i].end_date.getTime() < ts) continue;
matchingModel = models[i];
break;
}
if (!matchingModel) {
matchingModel = models[0]; // latest (will throw error)
}
return matchingModel.getTimedModel(date);
};

@@ -0,0 +0,0 @@ var GeodeticCoord = require('./geodetic.js');

@@ -0,0 +0,0 @@ var SphericalCoord = require('./spherical.js');

@@ -0,0 +0,0 @@ module.exports = {

@@ -0,0 +0,0 @@ var CartesianCoord = require('./cartesian.js');

@@ -0,0 +0,0 @@ module.exports = Ellipsoid;

@@ -0,0 +0,0 @@ module.exports = LegendreFunction;

@@ -0,0 +0,0 @@ module.exports = MagneticElements;

@@ -0,0 +0,0 @@ module.exports = MagneticVector;

1

lib/model.js

@@ -11,3 +11,2 @@ var path = require('path');

function Model(options){
options = options || require('../wmm.json');
this.epoch = options.epoch;

@@ -14,0 +13,0 @@ this.start_date = new Date(options.start_date);

@@ -0,0 +0,0 @@ module.exports = function(str){

{
"name": "geomagnetism",
"version": "0.0.2",
"version": "0.1.0",
"description": "Computes geomagnetic field information",

@@ -24,7 +24,7 @@ "main": "index.js",

"devDependencies": {
"mocha": "~1.x",
"chai": "~1.9.1"
"mocha": "~5.x",
"chai": "~4.2.0"
},
"author": "Brandon Reavis",
"license": "Apache License, v2.0",
"license": "Apache-2.0",
"bugs": {

@@ -31,0 +31,0 @@ "url": "https://github.com/naturalatlas/geomagnetism/issues"

@@ -29,3 +29,3 @@ # geomagnetism

Copyright &copy; 2015 [Natural Atlas, Inc.](https://naturalatlas.com/) & [Contributors](https://github.com/naturalatlas/tilestrata-sharp/graphs/contributors)
Copyright &copy; 2015–2018 [Natural Atlas, Inc.](https://naturalatlas.com/) & [Contributors](https://github.com/naturalatlas/geomagnetism/graphs/contributors)

@@ -32,0 +32,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0

@@ -63,2 +63,10 @@ var geomagnetism = require('../index.js');

});
it("should return value for current date", function(){
var date = new Date();
var info = geomagnetism.model(date).point([44.53461, -109.05572]);
});
it("should return value for current date + 1 year", function(){
var date = new Date(Date.now() + 1000 * 3600 * 24 * 365);
var info = geomagnetism.model(date).point([44.53461, -109.05572]);
});
});

@@ -65,0 +73,0 @@ describe("getTimedModel()", function(){

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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