Skip to content

Commit

Permalink
hitide-ui-15: removed usage of l2ss
Browse files Browse the repository at this point in the history
  • Loading branch information
jbyrne committed Aug 10, 2023
1 parent 0140aae commit a560b31
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 195 deletions.
5 changes: 0 additions & 5 deletions configs/hitideConfig-ops.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
var hitideProfileOrigin = "https://hitide.profile.podaac.earthdatacloud.nasa.gov/hitide/api";

window.hitideConfig = {
datasetSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
datasetMetadataService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
granuleSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/search",
granuleAvailabilityService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/availability",
variableService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/variable",
paletteService: "https://hitide.podaac.earthdatacloud.nasa.gov/palettes",

cmrDatasetSearchService: hitideProfileOrigin + "/cmr/search/collections.json?tool_name=HiTIDE",
Expand Down
5 changes: 0 additions & 5 deletions configs/hitideConfig-sit.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
var hitideProfileOrigin = "https://hitide.profile.podaac.sit.earthdatacloud.nasa.gov/hitide/api";

window.hitideConfig = {
datasetSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
datasetMetadataService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
granuleSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/search",
granuleAvailabilityService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/availability",
variableService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/variable",
paletteService: "https://hitide.podaac.sit.earthdatacloud.nasa.gov/palettes",

cmrDatasetSearchService: hitideProfileOrigin + "/cmr/search/collections.json?tool_name=HiTIDE",
Expand Down
6 changes: 1 addition & 5 deletions configs/hitideConfig-uat.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
var hitideProfileOrigin = "https://hitide.profile.podaac.uat.earthdatacloud.nasa.gov/hitide/api";

window.hitideConfig = {
datasetSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
datasetMetadataService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
granuleSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/search",
granuleAvailabilityService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/availability",
variableService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/variable",
// variableService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/variable",
paletteService: "https://hitide.podaac.uat.earthdatacloud.nasa.gov/palettes",

cmrDatasetSearchService: hitideProfileOrigin + "/cmr/search/collections.json?tool_name=HiTIDE",
Expand Down
5 changes: 0 additions & 5 deletions src/hitideConfig.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
var hitideProfileOrigin = "https://hitide.profile.podaac.uat.earthdatacloud.nasa.gov/hitide/api";

window.hitideConfig = {
datasetSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
datasetMetadataService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/search",
granuleSearchService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/search",
granuleAvailabilityService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/granule/availability",
variableService: "https://podaac-tools.jpl.nasa.gov/l2ss-services/l2ss/dataset/variable",
paletteService: "https://hitide.podaac.uat.earthdatacloud.nasa.gov/palettes",

cmrDatasetSearchService: hitideProfileOrigin + "/cmr/search/collections.json?tool_name=HiTIDE",
Expand Down
8 changes: 1 addition & 7 deletions src/hitideConfig.js.cm
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,9 @@
var hitideProfileOrigin = "$PROFILE_API";

window.hitideConfig = {

datasetSearchService: "$MIDDLEWARE_SERVICE/l2ss/dataset/search",
datasetMetadataService: "$MIDDLEWARE_SERVICE/l2ss/dataset/search",

granuleSearchService: "$MIDDLEWARE_SERVICE/l2ss/granule/search",
granuleAvailabilityService: "$MIDDLEWARE_SERVICE/l2ss/granule/availability",
variableService: "$MIDDLEWARE_SERVICE/l2ss/dataset/variable",
paletteService: "$MIDDLEWARE_SERVICE/l2ss/palettes",


authCodeUrl: "https://urs.earthdata.nasa.gov/oauth/authorize",
loginUrl: hitideProfileOrigin + "/hitide/api/session/login",
logoutUrl: hitideProfileOrigin + "/hitide/api/session/logout",
Expand Down
2 changes: 0 additions & 2 deletions src/jpl/dijit/DatasetAvailability.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,8 @@ define([
},

initializeAvailabilityApi: function() {
var l2ssAvailabilityApi = new L2ssAvailabilityApi(this.config.hitide.externalConfigurables.granuleAvailabilityService);
var cmrAvailabilityApi = new CmrAvailabilityApi(this.config.hitide.externalConfigurables.cmrGranuleAvailabilityService);
this.availability = new CombinedAvailabilityApi({
l2ssAvailabilityApi: l2ssAvailabilityApi,
cmrAvailabilityApi: cmrAvailabilityApi
});
},
Expand Down
13 changes: 0 additions & 13 deletions src/jpl/dijit/Downloads.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@ define([
mergeGranules: this.mergeGranulesSelection.checked
};

// Submit one job for ALL l2ss subjobs...
// And one job for EACH cloud subjob
var l2ssJob = {
email: this.downloadsSubmissionEmail.value,
subjobs: []
}

for (var subjobId in subjobs) {
if (subjobs.hasOwnProperty(subjobId)) {
var subjob = subjobs[subjobId];
Expand All @@ -140,14 +133,8 @@ define([
cloudJob.subjobs.push(subjob.getFullDownloadQuery(downloadOptions));
this.downloadsManager.submitJob(cloudJob);
}
else{
l2ssJob.subjobs.push(subjob.getFullDownloadQuery(downloadOptions));
}
}
}

if(l2ssJob.subjobs.length > 0)
this.downloadsManager.submitJob(l2ssJob);
}
},

Expand Down
8 changes: 0 additions & 8 deletions src/jpl/dijit/GranuleSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,14 +276,6 @@ define([
url += "&page_size=0"
withCredentials = this.config.hitide.externalConfigurables.crossOriginCmrCookies;
}
else{
url = this.config.hitide.externalConfigurables.granuleSearchService + "?";
url += "datasetId=" + datasetId;
url += "&startTime=" + DOMUtil.prototype.dateFormatISOBeginningOfDay(startTime);
url += "&endTime=" + DOMUtil.prototype.dateFormatISOEndOfDay(endTime);
url += "&bbox=" + (bbox ? bbox : "");
url += "&itemsPerPage=0";
}

var _context = this;

Expand Down
40 changes: 0 additions & 40 deletions src/jpl/dijit/GranulesController.js
Original file line number Diff line number Diff line change
Expand Up @@ -578,24 +578,6 @@ define([

return deferred.promise;
}

// console.warn("Warning, dataset variables hardcoded to a single variable");
var url = this.config.hitide.externalConfigurables.variableService + "?datasetId=" + datasetId;

var _context = this;
xhr.get(url, {
headers: {
"X-Requested-With": null
},
handleAs: "json",
method: "get"
}).then(function(response) {
deferred.resolve(response);
}, function(err) {
console.log("GranulesController – Variable request error");
deferred.reject(err);
});
return deferred.promise;
},

initializeVariablesGrid: function() {
Expand Down Expand Up @@ -662,17 +644,6 @@ define([

withCredentials = this.config.hitide.externalConfigurables.crossOriginCmrCookies;
}
else{
url = this.config.hitide.externalConfigurables.granuleSearchService + "?";
url += "datasetId=" + this.datasetId;
url += "&startTime=" + DOMUtil.prototype.dateFormatISOBeginningOfDay(this.startDateWidget.get("value"));
url += "&endTime=" + DOMUtil.prototype.dateFormatISOEndOfDay(this.endDateWidget.get("value"));
url += "&name=" + this.nameFilterBox.get("value");
url += "&bbox=" + (this.bbox || "");
url += "&itemsPerPage=" + this.availableGranules;
url += "&startIndex=" + this.currentSolrIdx;
url += "&sort=" + this.granuleGrid._sort[0].attribute + (this.granuleGrid._sort[0].descending ? " desc" : " asc");
}

var _context = this;
var r;
Expand Down Expand Up @@ -775,17 +746,6 @@ define([

withCredentials = this.config.hitide.externalConfigurables.crossOriginCmrCookies;
}
else{
url = this.config.hitide.externalConfigurables.granuleSearchService + "?";
url += "datasetId=" + this.datasetId;
url += "&startTime=" + DOMUtil.prototype.dateFormatISOBeginningOfDay(this.startDateWidget.get("value"));
url += "&endTime=" + DOMUtil.prototype.dateFormatISOEndOfDay(this.endDateWidget.get("value"));
url += "&name=" + this.nameFilterBox.get("value");
url += "&bbox=" + (this.bbox || "");
url += "&itemsPerPage=" + this.itemsPerPage;
url += "&startIndex=" + this.currentSolrIdx;
url += "&sort=" + this.granuleGrid._sort[0].attribute + (this.granuleGrid._sort[0].descending ? " desc" : " asc");
}

var _context = this;
var r;
Expand Down
3 changes: 0 additions & 3 deletions src/jpl/utils/GranuleAvailability/CombinedAvailabilityApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ define([
return declare(null, {
constructor: function (options) {
this.cmr = options.cmrAvailabilityApi;
this.l2ss = options.l2ssAvailabilityApi;
},

fetchAvailability: function (startTime, endTime, gap, datasets) {
Expand All @@ -19,8 +18,6 @@ define([
var id = dataset["Dataset-PersistentId"];
if (dataset.source === "cmr") {
return _context.cmr.fetchOne(startTimeString, endTimeString, gap, id);
} else {
return _context.l2ss.fetchOne(startTimeString, endTimeString, gap, id);
}
});
return all(requestPromises);
Expand Down
90 changes: 5 additions & 85 deletions src/jpl/utils/SearchDatasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ define([
"jpl/config/Config"
], function(request, all, Config){

var PODAAC_LABEL = " - PODAAC";
var POCLOUD_LABEL = " - POCLOUD";
var config = Config.getInstance();

/**
* Search L2SS and CMR datasets - returning datasets and facets
* Search CMR datasets - returning datasets and facets
*
* @param {Object} options
* @param {string} options.startTime
Expand All @@ -23,62 +22,33 @@ define([
if(typeof options !== "object")
throw new Error('Options object must be passed to SearchDatasets.search(options)');

var l2ssSearchUrl = config.hitide.externalConfigurables.datasetSearchService;
var cmrSearchUrl = config.hitide.externalConfigurables.cmrDatasetSearchService;

var promises = [];
if(typeof l2ssSearchUrl === 'string') promises.push(searchL2ss(options));
if(typeof cmrSearchUrl === 'string') promises.push(searchCmr(options));
if(promises.length === 0) {
console.log('Did not enable l2ss or cmr datasets');
console.log('Did not enable cmr datasets');
}

return all(promises).then(function(resultsArray) {
// get additional resolution info metadata for datasets
var additionalDataPromises = []
additionalDataPromises.push(getAdditionalCmrMetadata(resultsArray[1].response.docs))
additionalDataPromises.push(getAdditionalCmrMetadata(resultsArray[0].response.docs))
return all(additionalDataPromises).then(function() {
return resultsArray
})
}).then(function(resultsArray) {
if(promises.length === 1) {
return resultsArray[0];
}
return combineResults(resultsArray[0], resultsArray[1]);
return resultsArray[0];
})
}

function combineResults(first, second) {
var combined = {
response: {
docs: first.response.docs.concat(second.response.docs)
},
facet_counts: {
facet_fields: {
"DatasetParameter-Variable-Full":
first.facet_counts.facet_fields["DatasetParameter-Variable-Full"]
.concat(second.facet_counts.facet_fields["DatasetParameter-Variable-Full"]),
"DatasetSource-Sensor-LongName-Full":
first.facet_counts.facet_fields["DatasetSource-Sensor-LongName-Full"]
.concat(second.facet_counts.facet_fields["DatasetSource-Sensor-LongName-Full"]),
"Dataset-Provider-ShortName":
first.facet_counts.facet_fields["Dataset-Provider-ShortName"]
.concat(second.facet_counts.facet_fields["Dataset-Provider-ShortName"])

}
}
};

return combined;
}

/////////////////////////////////////////////////////////////////////
//
// CMR Functions
//
/////////////////////////////////////////////////////////////////////
function searchCmr(options) {
var url = constructCmrUrl(options);
// console.log(url)
return request(url, {
handleAs: 'json',
headers: {
Expand Down Expand Up @@ -207,56 +177,6 @@ define([
"Dataset-Provider-ShortName": providers
};
}


/////////////////////////////////////////////////////////////////////
//
// L2SS Functions
//
/////////////////////////////////////////////////////////////////////
function searchL2ss(options) {
var url = constructL2ssUrl(options);

return request(url, {
handleAs: 'json',
headers: {
"X-Requested-With": null
}
}).then(function(response) {
// console.log(response)
return processL2ssResponse(response);
});

}

function processL2ssResponse(response) {
Object.values(response.facet_counts.facet_fields).forEach(function(facet) {
for(var i = 0; i < facet.length; i+= 2) {
facet[i] += PODAAC_LABEL;
}
});
// console.log(response)
return response;
}

function constructL2ssUrl(options) {
var url = config.hitide.externalConfigurables.datasetSearchService;
var itemsPerPage = config.hitide.externalConfigurables.datasetSearchServiceItemsPerPage;
url += "?itemsPerPage=" + (itemsPerPage || 200);
if(options.startTime) url += "&startTime=" + options.startTime;
if(options.endTime) url += "&endTime=" + options.endTime;
if(options.bbox) url += "&bbox=" + options.bbox;
if(options.facets) {
Object.keys(options.facets).forEach(function(facetName) {
var facetArray = options.facets[facetName];
facetArray.forEach(function(facetValue) {
url += '&' + facetName + '=' + facetValue.replace(PODAAC_LABEL, '');
})
})
}
return url;
}


return {
search: search
Expand Down
18 changes: 1 addition & 17 deletions src/jpl/utils/SearchVariables.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ define([
/**
*
* @param {Object} dataset
* @param {string} dataset.source (optional) l2ss or cmr
* @param {string} dataset.source (optional) cmr
* @param {string} dataset [\"Dataset-PersistentId\"]
*
* @returns dojo promise containing response or error
Expand All @@ -21,22 +21,6 @@ define([
if(dataset.source === 'cmr') {
return searchCmr(dataset);
}
else {
return searchL2ss(dataset);
}
}

function searchL2ss(dataset) {
var url = config.hitide.externalConfigurables.variableService + "?datasetId=" + dataset["Dataset-PersistentId"];
return request(url, {
handleAs: 'json',
headers: { "X-Requested-With": null }
}).then(function(response) {
response.variables.sort(function (a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase());
});
return response.variables;
});
}

function searchCmr(dataset, customQuery) {
Expand Down

0 comments on commit a560b31

Please sign in to comment.