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

climate-data-crawler

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

climate-data-crawler - npm Package Compare versions

Comparing version 2.0.0 to 2.1.1

.travis.yml

11

helpers/httpClient.js

@@ -9,4 +9,7 @@ "use strict";

if (response.statusCode != 200){
errorCallback('Http status code: '
+ response.statusCode + ': ' + response.statusMessage);
console.log(response.statusCode);
if (errorCallback){
errorCallback('Http status code: '
+ response.statusCode + ': ' + response.statusMessage);
}
}

@@ -31,3 +34,5 @@

request.on('error', function(error){
errorCallback(error.message);
if (errorCallback){
errorCallback(error.message);
}
});

@@ -34,0 +39,0 @@

{
"name": "climate-data-crawler",
"version": "2.0.0",
"version": "2.1.1",
"description": "Data Crawler for CDO (Climate Data Online) web services",

@@ -10,3 +10,3 @@ "main": "app.js",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "mocha ./tests/*"
},

@@ -30,6 +30,8 @@ "repository": {

"command-line-args": "^0.5.9",
"mocha": "^2.2.1",
"readline-sync": "^1.2.15",
"sinon": "^1.14.1"
"readline-sync": "^1.2.15"
},
"devDependencies": {
"mocha": "^2.2.5",
"sinon": "^1.15.4"
}
}

@@ -136,3 +136,3 @@ # Climate Data Crawler - CDO (Climate Data Online) data crawler

### CdoApiClient
Use the CdoApiClient to get Brisbane's monthly mean temperatures between 01 January 2014 and 31 December 2014:
Get Brisbane's monthly mean temperatures between 01 January 2014 and 31 December 2014:
```

@@ -161,2 +161,15 @@ var CdoApiClient = require('./node_modules/climate-data-crawler/cdoApiClient');

Retrieve details of all registered stations:
```
var fs = require('fs');
var CdoApiClient = require('./node_modules/climate-data-crawler/cdoApiClient');
var queryPath = '/cdo-web/api/v2/stations?limit=1000';
var client = CdoApiClient.createInstance(queryPath);
client.query(function(result){
console.log(result);
fs.appendFileSync('./stations.json', JSON.stringify(result) + '\r\n');
});
```
## Error handling

@@ -182,3 +195,3 @@

GHCNDMS - Global Historical Climatology Network-Monthly data set:
GHCNDMS - Global Historical Climatology Network-Monthly Summaries data set:

@@ -202,1 +215,3 @@ * MNTM - Monthly mean temperature

[Wikipedia: Global Historical Climatology Network](http://en.wikipedia.org/wiki/Global_Historical_Climatology_Network)
[GHCND Global Historical Climatology Network)-Monthly Summaries documentation](http://www1.ncdc.noaa.gov/pub/data/cdo/documentation/GHCNDMS_documentation.pdf)

@@ -37,3 +37,3 @@ "use strict";

it('should raise done even also when api only returns an empty object', function(done){
it('should raise done event also when api only returns an empty object', function(done){
// arrange

@@ -44,4 +44,4 @@ this.timeout(120 * 1000);

var dataset = 'GHCNDMS';
var startDate = '2000-01-01';
var endDate = '2000-12-31';
var startDate = '1900-01-01';
var endDate = '1900-12-31';
var datatypeid = 'MNTM';

@@ -48,0 +48,0 @@

@@ -10,21 +10,11 @@ "use strict";

var options = {
host : 'www.ncdc.noaa.gov',
host : 'www.bt.no',
port : 80,
path : '/cdo-web/api/v2/locations/CITY:BR000023',
method : 'GET',
headers: {'token': 'xdZVZowcEuqclhVhBdziSjGXgHUVKHTD'}
method : 'GET'
};
var expected = {
"id": "CITY:BR000023",
"name": "Rio de Janeiro, BR",
"datacoverage": 1,
"mindate": "1938-01-01",
"maxdate": "1999-12-31"
};
var client = new HttpClient();
client.request(options, function(result){
assert.equal(result, JSON.stringify(expected));
assert.equal(!!result, true);
done();

@@ -39,4 +29,3 @@ });

path : '/undefined',
method : 'GET',
headers: {'token': 'xdZVZowcEuqclhVhBdziSjGXgHUVKHTD'}
method : 'GET'
};

@@ -43,0 +32,0 @@

@@ -10,3 +10,2 @@ "use strict";

var Timer = require('../../helpers/timer');
var fs = require('fs');

@@ -41,3 +40,3 @@ describe('CdoDataProbingQuery', function(){

timer = new Timer();
sinon.stub(timer, 'setTimeout', function(callback, delay){
sinon.stub(timer, 'setTimeout', function(callback){
callback();

@@ -124,3 +123,18 @@ });

// arrange
var resultFromApi = JSON.parse(fs.readFileSync('test-resources/dataset.json', {encoding: 'utf8'}));
var resultFromApi = [
{
"station": "GHCND:BR000083743",
"value": 268,
"attributes": "19,6",
"datatype": "MNTM",
"date": "2014-01-01T00:00:00"
},
{
"station": "GHCND:BR000083743",
"value": 278,
"attributes": "16,7",
"datatype": "MNTM",
"date": "2014-02-01T00:00:00"
}
];
var results = null;

@@ -154,3 +168,18 @@

// arrange
var runResults = JSON.parse(fs.readFileSync('test-resources/dataset.json', {encoding: 'utf8'}));
var runResults = [
{
"station": "GHCND:BR000083743",
"value": 268,
"attributes": "19,6",
"datatype": "MNTM",
"date": "2014-01-01T00:00:00"
},
{
"station": "GHCND:BR000083743",
"value": 278,
"attributes": "16,7",
"datatype": "MNTM",
"date": "2014-02-01T00:00:00"
}
]

@@ -157,0 +186,0 @@ sinon.stub(api, 'query', function(onApiCallComplete){

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