From bc8a163b1009d4c82e3beec25c2858a74d1fefa0 Mon Sep 17 00:00:00 2001 From: Chris DiCaprio Date: Fri, 19 Jul 2024 15:56:24 +1200 Subject: [PATCH] increase precision of hazard curve and UHS csv files (#467) * increase precision of hazard curve and UHS csv files * bump version and update changelog --- package.json | 2 +- src/CHANGELOG.md | 6 ++++++ src/services/spectralAccel/spectralAccel.service.ts | 2 +- src/views/hazardCharts/hazardPage.service.ts | 2 +- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 89f4cb5..234f6b2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "kororaa", - "version": "1.2.4", + "version": "1.2.5", "private": true, "type": "module", "dependencies": { diff --git a/src/CHANGELOG.md b/src/CHANGELOG.md index dbeb759..2d6990e 100644 --- a/src/CHANGELOG.md +++ b/src/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [v1.2.5](https://github.com/GNS-Science/kororaa/compare/v1.2.4...v1.2.5) - 2024-07-19 + +### Changed + - higher floating point precision for csv files of hazard curves and UHS + + ## [v1.2.4](https://github.com/GNS-Science/kororaa/compare/v1.2.3...v1.2.4) - 2024-07-02 ### Changed diff --git a/src/services/spectralAccel/spectralAccel.service.ts b/src/services/spectralAccel/spectralAccel.service.ts index 2398042..58b92f3 100644 --- a/src/services/spectralAccel/spectralAccel.service.ts +++ b/src/services/spectralAccel/spectralAccel.service.ts @@ -222,7 +222,7 @@ export const getSpectralCSVData = ( curveCSVData.push(convertAgg(value[0])); if (value) { value[1].data.forEach((point) => { - curveCSVData.push(point[1].toFixed(2).toString()); + curveCSVData.push(point[1].toPrecision(4).toString()); }); } csvData.push(curveCSVData); diff --git a/src/views/hazardCharts/hazardPage.service.ts b/src/views/hazardCharts/hazardPage.service.ts index ebf5813..38debf9 100644 --- a/src/views/hazardCharts/hazardPage.service.ts +++ b/src/views/hazardCharts/hazardPage.service.ts @@ -152,7 +152,7 @@ export const getHazardCSVData = (data: HazardChartsPlotsViewQuery$data): string[ const curveCSVData = [latLonArray[0], latLonArray[1], curve?.vs30.toString(), curve?.imt, curve?.agg]; curve?.curve?.values.forEach((value) => { if (value) { - curveCSVData.push(value.toFixed(6).toString()); + curveCSVData.push(value.toPrecision(6).toString()); } }); return curveCSVData;