Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core-spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
"required": "true",
"schema": {
"type": "string",
"enum": ["rg09", "kg21", "localGPspace", "localGPintegral", "glodap"]
"enum": ["rg09", "localGPintegral", "glodap"]
}
},
{
Expand Down Expand Up @@ -534,7 +534,7 @@
"required": "true",
"schema": {
"type": "string",
"enum": ["rg09", "kg21", "localGPspace", "localGPintegral", "glodap"]
"enum": ["rg09", "localGPintegral", "glodap"]
}
},
{
Expand Down
4 changes: 0 additions & 4 deletions nodejs-server/api/openapi.core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -529,8 +529,6 @@ paths:
type: string
enum:
- rg09
- kg21
- localGPspace
- localGPintegral
- glodap
- name: id
Expand Down Expand Up @@ -768,8 +766,6 @@ paths:
type: string
enum:
- rg09
- kg21
- localGPspace
- localGPintegral
- glodap
- name: parameter
Expand Down
20 changes: 1 addition & 19 deletions nodejs-server/controllers/Grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,7 @@ var helpers = require('../helpers/helpers')

module.exports.findgrid = function findgrid (req, res, next, id, startDate, endDate, polygon, box, center, radius, compression, data, presRange, verticalRange, batchmeta, gridName) {
apihits.apihits.create({metadata: req.openapi.openApiRoute, query: req.query, product: gridName, isWeb: req.headers.origin === 'https://argovis.colorado.edu', avhTelemetry: req.headers.hasOwnProperty('x-avh-telemetry') ? req.headers['x-avh-telemetry'] : null})

// redirect kg21 -> localGPspace
if (gridName === 'kg21') {
gridName = 'localGPspace';
}
if (data){
data = data.map(x => x.replaceAll("kg21","localGPspace"));
}


Grid.findgrid(res,gridName, id, startDate, endDate, polygon, box, center, radius, compression, data, presRange, verticalRange, batchmeta)
.then(
pipefittings => helpers.data_pipeline.bind(null, req, res, batchmeta)(pipefittings),
Expand All @@ -26,11 +18,6 @@ module.exports.findgridMeta = function findgridMeta (req, res, next, id) {

apihits.apihits.create({metadata: req.openapi.openApiRoute, query: req.query, isWeb: req.headers.origin === 'https://argovis.colorado.edu', avhTelemetry: req.headers.hasOwnProperty('x-avh-telemetry') ? req.headers['x-avh-telemetry'] : null})

// redirect kg21 -> localGPspace
if (id === 'kg21_ohc15to300') {
id = 'localGPspace_ohc15to300';
}

Grid.findgridMeta(res,id)
.then(
pipefittings => helpers.data_pipeline.bind(null, req, res, false)(pipefittings),
Expand All @@ -43,11 +30,6 @@ module.exports.gridVocab = function gridVocab (req, res, next, parameter, gridNa

apihits.apihits.create({metadata: req.openapi.openApiRoute, query: req.query, product: gridName, isWeb: req.headers.origin === 'https://argovis.colorado.edu', avhTelemetry: req.headers.hasOwnProperty('x-avh-telemetry') ? req.headers['x-avh-telemetry'] : null})

// redirect kg21 -> localGPspace
if (gridName === 'kg21') {
gridName = 'localGPspace';
}

Grid.gridVocab(gridName, parameter)
.then(
helpers.simpleWrite.bind(null, req, res),
Expand Down
4 changes: 1 addition & 3 deletions nodejs-server/helpers/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ module.exports.cost = function(url, c, cellprice, metaDiscount, maxbulk, maxbulk
}
//// core data routes
if( path.length==1 ||
(path.length==2 && path[0]=='grids' && (path[1]=='rg09' || path[1]=='kg21' || path[1]=='localGPspace' || path[1]=='glodap')) ||
(path.length==2 && path[0]=='grids' && (path[1]=='rg09' || path[1]=='localGPintegral' || path[1]=='glodap')) ||
(path.length==2 && path[0]=='timeseries' && (path[1]=='noaasst' || path[1]=='copernicussla' || path[1]=='ccmpwind')) ||
(path.length==2 && path[0]=='extended' && (path[1]=='ar')) ){
let params = module.exports.parameter_sanitization(path[path.length-1], null,qString.get('startDate'),qString.get('endDate'),qString.get('polygon'),qString.get('box'),false,qString.get('center'),qString.get('radius'), true)
Expand Down Expand Up @@ -989,8 +989,6 @@ module.exports.find_grid_metacollection = function(token){
// given the ID of a document in a grid metadata collection, return the metadata collection name.
if (token.includes("rg09")){
return "rg09Meta"
} else if (token.includes("kg21") || token.includes("localGPspace")){
return "localGPspaceMeta"
} else if (token.includes("localGPintegral")){
return "localGPMeta"
} else if (token.includes("glodap")){
Expand Down
4 changes: 0 additions & 4 deletions nodejs-server/models/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ const GridMetaSchema = Schema({
module.exports = {}
module.exports['rg09Meta'] = mongoose.model('rg09Meta', GridMetaSchema, 'rg09Meta');
module.exports['rg09'] = mongoose.model('rg09', GridSchema, 'rg09');
module.exports['kg21Meta'] = mongoose.model('kg21Meta', GridMetaSchema, 'kg21Meta');
module.exports['kg21'] = mongoose.model('kg21', GridSchema, 'kg21');
module.exports['localGPspaceMeta'] = mongoose.model('localGPspaceMeta', GridMetaSchema, 'localGPspaceMeta');
module.exports['localGPspace'] = mongoose.model('localGPspace', GridSchema, 'localGPspace');
module.exports['localGPMeta'] = mongoose.model('localGPMeta', GridMetaSchema, 'localGPMeta');
module.exports['localGPintegral'] = mongoose.model('localGPintegral', GridSchema, 'localGPintegral');
module.exports['glodapMeta'] = mongoose.model('glodapMeta', GridMetaSchema, 'glodapMeta');
Expand Down
2 changes: 1 addition & 1 deletion tests/tests/core/grid.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe("GET /grids/rg09", function () {

describe("GET /grids/rg09", function () {
it("grids profile should be dropped if no requested data is available", async function () {
const response = await request.get("/grids/rg09?id=20040115000000_20.5_-64.5&data=localGPspace_ohc15to300").set({'x-argokey': 'developer'});
const response = await request.get("/grids/rg09?id=20040115000000_20.5_-64.5&data=potential_temperature").set({'x-argokey': 'developer'});
expect(response.status).to.eql(404);
});
});
Expand Down
4 changes: 2 additions & 2 deletions tests/tests/helpers.tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const metaDiscount = 100
const maxbulk = 1000000
const maxbulk_timeseries = 50
const bucketSize = 100
const ratelimiter = {"_id" : "ratelimiter","metadata" : {"ar" : {"metagroups" : ["id"],"startDate" : "2000-01-01T00:00:00Z","endDate" : "2021-12-31T21:00:00Z"},"argo" : {"metagroups" : ["id","metadata","platform"],"startDate" : "1997-07-28T20:26:20.002000Z","endDate" : "2025-01-14T03:49:20Z","qc" : "timestamp_argoqc"},"cchdo" : {"metagroups" : ["id","metadata","woceline","cchdo_cruise"],"startDate" : "1972-07-24T09:11:00Z","endDate" : "2024-03-28T05:31:00Z"},"easyocean" : {"metagroups" : ["id"],"startDate" : "1983-10-08T00:00:00Z","endDate" : "2022-10-16T00:00:00Z"},"rg09" : {"metagroups" : ["id"],"startDate" : "2004-01-15T00:00:00Z","endDate" : "2024-10-15T00:00:00Z"},"localGPspace" : {"metagroups" : ["id"],"startDate" : "2005-01-15T00:00:00Z","endDate" : "2020-12-15T00:00:00Z"},"glodap" : {"metagroups" : ["id"],"startDate" : "1000-01-01T00:00:00Z","endDate" : "1000-01-01T00:00:00Z"},"tc" : {"metagroups" : ["id","metadata","name"],"startDate" : "1851-06-25T00:00:00Z","endDate" : "2023-11-27T12:00:00Z"},"noaasst" : {"metagroups" : ["id"],"startDate" : "1989-12-31T00:00:00Z","endDate" : "2023-01-29T00:00:00Z"},"copernicussla" : {"metagroups" : ["id"],"startDate" : "1993-01-03T00:00:00Z","endDate" : "2022-07-24T00:00:00Z"},"ccmpwind" : {"metagroups" : ["id"],"startDate" : "1993-01-03T00:00:00Z","endDate" : "2019-12-29T00:00:00Z"},"argotrajectories" : {"metagroups" : ["id","metadata","platform"],"startDate" : "2001-01-04T22:46:33Z","endDate" : "2022-12-31T23:48:28Z"}}}
const ratelimiter = {"_id" : "ratelimiter","metadata" : {"ar" : {"metagroups" : ["id"],"startDate" : "2000-01-01T00:00:00Z","endDate" : "2021-12-31T21:00:00Z"},"argo" : {"metagroups" : ["id","metadata","platform"],"startDate" : "1997-07-28T20:26:20.002000Z","endDate" : "2025-01-14T03:49:20Z","qc" : "timestamp_argoqc"},"cchdo" : {"metagroups" : ["id","metadata","woceline","cchdo_cruise"],"startDate" : "1972-07-24T09:11:00Z","endDate" : "2024-03-28T05:31:00Z"},"easyocean" : {"metagroups" : ["id"],"startDate" : "1983-10-08T00:00:00Z","endDate" : "2022-10-16T00:00:00Z"},"rg09" : {"metagroups" : ["id"],"startDate" : "2004-01-15T00:00:00Z","endDate" : "2024-10-15T00:00:00Z"},"glodap" : {"metagroups" : ["id"],"startDate" : "1000-01-01T00:00:00Z","endDate" : "1000-01-01T00:00:00Z"},"tc" : {"metagroups" : ["id","metadata","name"],"startDate" : "1851-06-25T00:00:00Z","endDate" : "2023-11-27T12:00:00Z"},"noaasst" : {"metagroups" : ["id"],"startDate" : "1989-12-31T00:00:00Z","endDate" : "2023-01-29T00:00:00Z"},"copernicussla" : {"metagroups" : ["id"],"startDate" : "1993-01-03T00:00:00Z","endDate" : "2022-07-24T00:00:00Z"},"ccmpwind" : {"metagroups" : ["id"],"startDate" : "1993-01-03T00:00:00Z","endDate" : "2019-12-29T00:00:00Z"},"argotrajectories" : {"metagroups" : ["id","metadata","platform"],"startDate" : "2001-01-04T22:46:33Z","endDate" : "2022-12-31T23:48:28Z"}}}

const dereferenceSchema = async (rawspec) => {
return new Promise((resolve, reject) => {
Expand Down Expand Up @@ -86,7 +86,7 @@ describe("cost functions", function () {

describe("cost functions", function () {
it("cost of metadata request should be scaled my metaDiscount", async function () {
expect(helpers.cost('/grids/meta?id=localGPspace_ohc15to300', c, cellprice, metaDiscount, maxbulk, maxbulk_timeseries, ratelimiter)).to.eql(c/metaDiscount);
expect(helpers.cost('/grids/meta?id=localGPintegral', c, cellprice, metaDiscount, maxbulk, maxbulk_timeseries, ratelimiter)).to.eql(c/metaDiscount);
});
});

Expand Down