From d09bf7c40c842fa08172c0066ff5b7936ef9fcaf Mon Sep 17 00:00:00 2001 From: Vincent Fazio Date: Tue, 29 Nov 2022 16:55:45 +1100 Subject: [PATCH 1/2] AUS-3693 Suppport GeoSciML v4.1 complex boreholes with petrophysics data --- src/app/app.module.ts | 3 +- .../downloadpanel/downloadpanel.component.ts | 2 +- .../mscl/mscl.analytic.component.ts | 9 +- .../layeranalytic/mscl/mscl.service.ts | 96 +++++++++++++++- .../customanalytic/mscl/mscl.component.ts | 20 +++- .../querier/dynamic.analytic.component.ts | 9 +- .../querier/querier.modal.component.html | 20 ++-- .../querier/querier.modal.component.ts | 106 ++++++++++-------- src/environments/config.ts | 4 +- src/environments/ref.ts | 3 +- 10 files changed, 195 insertions(+), 77 deletions(-) diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 225f1d077..a763ef295 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -60,6 +60,7 @@ import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BsDropdownModule } from 'ngx-bootstrap/dropdown'; import { MSCLComponent } from './modalwindow/querier/customanalytic/mscl/mscl.component'; import { MSCLAnalyticComponent } from './modalwindow/layeranalytic/mscl/mscl.analytic.component'; +import { MSCLService } from './modalwindow/layeranalytic/mscl/mscl.service'; import { HelpMenuComponent } from './toppanel/help-menu/help-menu.component'; @@ -133,7 +134,7 @@ PlotlyModule.plotlyjs = PlotlyJS; DataExplorerComponent, RecordModalComponent ], - providers: [ AuscopeApiService, FilterService, RectanglesEditorService, AdvancedComponentService, SearchService, NVCLService, GraceService, {provide: SAVER, useFactory: getSaver} ], + providers: [ AuscopeApiService, FilterService, RectanglesEditorService, AdvancedComponentService, SearchService, NVCLService, MSCLService, GraceService, {provide: SAVER, useFactory: getSaver} ], imports: [ PortalCoreModule.forRoot(environment, config), PortalCorePipesModule, diff --git a/src/app/menupanel/common/downloadpanel/downloadpanel.component.ts b/src/app/menupanel/common/downloadpanel/downloadpanel.component.ts index 8495b00e9..c25471e01 100644 --- a/src/app/menupanel/common/downloadpanel/downloadpanel.component.ts +++ b/src/app/menupanel/common/downloadpanel/downloadpanel.component.ts @@ -720,7 +720,7 @@ export class DownloadPanelComponent implements OnInit { if (UtilitiesService.isEmpty(err.message)) { alert('An error has occurred whilst attempting to download. Please contact cg-admin@csiro.au'); } else { - alert('An error has occurred whilst attempting to download (' + err.message + '). Plese contact cg-admin@csiro.au'); + alert('An error has occurred whilst attempting to download (' + err.message + '). Please contact cg-admin@csiro.au'); } }); diff --git a/src/app/modalwindow/layeranalytic/mscl/mscl.analytic.component.ts b/src/app/modalwindow/layeranalytic/mscl/mscl.analytic.component.ts index c17c0bc37..531a2c643 100644 --- a/src/app/modalwindow/layeranalytic/mscl/mscl.analytic.component.ts +++ b/src/app/modalwindow/layeranalytic/mscl/mscl.analytic.component.ts @@ -15,6 +15,7 @@ export class MSCLAnalyticComponent implements OnInit { featureId: string; // Identifier of the borehole metricList: string[]; // List of metric enums to plot closeGraphModal: () => null; // Function to call when the modal dialogue must be closed + usesGMLObs: boolean; // Response has values nested within GeoSciML observations serviceUrl: string; // URL of MSCL service processingData = false; @@ -42,7 +43,7 @@ export class MSCLAnalyticComponent implements OnInit { const error_display = this.error_display.nativeElement; // Fetch data from MSCL service this.processingData = true; - this.msclService.getMSCLDownload(this.serviceUrl, this.featureId, this.startDepth, this.endDepth, this.metricList).subscribe(valuesList => { + this.msclService.getMSCLDownload(this.serviceUrl, this.featureId, this.startDepth, this.endDepth, this.usesGMLObs, this.metricList).subscribe(valuesList => { // Check response if (valuesList == null || !(Symbol.iterator in Object(valuesList))) { this.processingData = false; @@ -60,7 +61,11 @@ export class MSCLAnalyticComponent implements OnInit { for (const values of valuesList) { for (const metricEnum of this.metricList) { const featName = this.msclService.getMetricInfoAttr(metricEnum, 'feat_elem'); - xLists[metricEnum].push(values[featName]); + if (this.usesGMLObs) { + xLists[metricEnum].push(values[featName.replace(/_/g, ' ')]); + } else { + xLists[metricEnum].push(values[featName]); + } } yList.push(values.depth); } diff --git a/src/app/modalwindow/layeranalytic/mscl/mscl.service.ts b/src/app/modalwindow/layeranalytic/mscl/mscl.service.ts index f9276d43d..37f513499 100644 --- a/src/app/modalwindow/layeranalytic/mscl/mscl.service.ts +++ b/src/app/modalwindow/layeranalytic/mscl/mscl.service.ts @@ -5,6 +5,7 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpParams, HttpHeaders, HttpResponse } from '@angular/common/http'; import { environment } from '../../../../environments/environment'; import { Layout, Data } from 'plotly.js-dist-min'; +import { SimpleXMLService } from '@auscope/portal-core-ui'; // Elements detectable via XRF const XRFElem = ['Ti', 'V', 'Cr', 'Mn', 'Fe', 'Co', 'Ni', 'Cu', 'Zn', 'As', 'Se', 'Rb', 'Sr', 'Y', 'Zr', 'Nb', 'Mo', @@ -20,6 +21,7 @@ export enum Metric { diameter = "diameter", pWaveAmp = "pWaveAmp", pWaveVel = "pWaveVel", density = "density", + specificGravity = "specificGravity", magSuscPoint = "magSuscPoint", magSuscLoopVC = "magSuscLoopVC", magSuscLoopDC = "magSuscLoopDC", @@ -61,6 +63,7 @@ let metricMap: Map = new Map( [ [ Metric.pWaveVel, { pname: 'P-Wave Vel.', group: 'P-Wave', desc: 'P-Wave Velocity', units: 'm/s', feat_elem: 'p_wave_velocity'}], [ Metric.pWaveAmp, { pname: 'P-Wave Amp.', group: 'P-Wave', desc: 'P-Wave Amplitude', units: '', feat_elem: 'p_wave_amplitude'}], [ Metric.density, { pname: 'Density', group: '', desc: 'Density', units: '', feat_elem: 'density'} ], + [ Metric.specificGravity, { pname: 'Specific Gravity', group: '', desc: 'Specfic Gravity', units: '', feat_elem: 'specific_gravity'} ], [ Metric.magSuscPoint, { pname: 'Mag. Susc. Point', group: '', desc: 'Magnetic Susceptibility Point', units: 'SI x 10^-5', feat_elem: 'magnetic_susc_point'} ], [ Metric.magSuscLoopVC, { pname: 'Mag. Susc. LoopVC', group: '', desc: 'Magnetic Susceptibility Loop Volume Corrected', units: 'SI x 10^-5', feat_elem: 'magnetic_susceptibility'} ], [ Metric.magSuscLoopDC, { pname: 'Mag. Susc. LoopDC', group: '', desc: 'Magnetic Susceptibility Loop Density Corrected', units: 'SI x 10^-5', feat_elem: 'magnetic_susc_loop_dc'} ], @@ -134,7 +137,7 @@ export class MSCLService { // Convert feature name list to a list of names and group names for (let featElem of featList) { for (let mm of metricMap.values()) { - if (mm.feat_elem === featElem) { + if (mm.feat_elem === featElem.replace(/ /g, '_')) { if (!retList.includes(mm.pname)) { retList.push(mm.pname); } @@ -441,6 +444,83 @@ export class MSCLService { return traceList; } + /** + * Checks to see if there are petrophysics observation sample values + * Assumes GeoSciML v4.1 WFS response format + * + * @param XML string WFS response + * @returns true if values could be found + */ + public usesGMLObs(xmlStr: string): boolean { + const obsIdx = xmlStr.search(/