diff --git a/datasets/datasets_local.json b/datasets/datasets_local.json index 913fe16..6225dd5 100644 --- a/datasets/datasets_local.json +++ b/datasets/datasets_local.json @@ -30,21 +30,27 @@ "drop_variables": ["Itime2"] }, "ngofs2_2d": { - "path": "s3://nextgen-dmac-cloud-ingest/nos/ngofs2/nos.ngofs2.2ds.best.nc.zarr", + "path": "s3://nextgen-dmac-cloud-ingest-nosofs/nos/ngofs2/nos.ngofs2.2ds.best.nc.zarr", "type": "kerchunk", "chunks": {}, "drop_variables": ["Itime2"] }, - "hrrr": { - "path": "./datasets/hrrr.dswrf.nc", - "type": "netcdf", + "nyofs": { + "path": "s3://nextgen-dmac-cloud-ingest-nosofs/nos/nyofs/nos.nyofs.fields.forecast.20240409.t23z.nc.zarr", + "type": "kerchunk", "chunks": {}, "drop_variables": [] }, - "hrrr_subhourly": { - "path": "s3://nextgen-dmac/kerchunk/hrrr_subhourly.json", + "sscofs": { + "path": "s3://nextgen-dmac-cloud-ingest-nosofs/nos/sscofs/sscofs.fields.best.nc.zarr", "type": "kerchunk", "chunks": {}, + "drop_variables": ["Itime", "Itime2"] + }, + "hrrr": { + "path": "./datasets/hrrr.dswrf.nc", + "type": "netcdf", + "chunks": {}, "drop_variables": [] } } diff --git a/viewer/package-lock.json b/viewer/package-lock.json index 23ae491..b6e7b0c 100644 --- a/viewer/package-lock.json +++ b/viewer/package-lock.json @@ -8,7 +8,7 @@ "name": "xreds-viewer", "version": "0.0.0", "dependencies": { - "fast-xml-parser": "^3.21.1", + "fast-xml-parser": "^4.3.2", "he": "^1.2.0", "maplibre-gl": "^2.4.0", "material-icons": "^1.12.2", @@ -1149,19 +1149,24 @@ } }, "node_modules/fast-xml-parser": { - "version": "3.21.1", - "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-3.21.1.tgz", - "integrity": "sha512-FTFVjYoBOZTJekiUsawGsSYV9QL0A+zDYCRj7y34IO6Jg+2IMYEtQa+bbictpdpV8dHxXywqU7C0gRDEOFtBFg==", - "license": "MIT", + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/fast-xml-parser/-/fast-xml-parser-4.3.6.tgz", + "integrity": "sha512-M2SovcRxD4+vC493Uc2GZVcZaj66CCJhWurC4viynVSTvrpErCShNcDz1lAho6n9REQKvL/ll4A4/fw6Y9z8nw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/NaturalIntelligence" + }, + { + "type": "paypal", + "url": "https://paypal.me/naturalintelligence" + } + ], "dependencies": { - "strnum": "^1.0.4" + "strnum": "^1.0.5" }, "bin": { - "xml2js": "cli.js" - }, - "funding": { - "type": "paypal", - "url": "https://paypal.me/naturalintelligence" + "fxparser": "src/cli/cli.js" } }, "node_modules/fastq": { diff --git a/viewer/package.json b/viewer/package.json index 1c0619c..4866445 100644 --- a/viewer/package.json +++ b/viewer/package.json @@ -9,7 +9,7 @@ "preview": "vite preview" }, "dependencies": { - "fast-xml-parser": "^3.21.1", + "fast-xml-parser": "^4.3.2", "he": "^1.2.0", "maplibre-gl": "^2.4.0", "material-icons": "^1.12.2", diff --git a/viewer/src/tools.tsx b/viewer/src/tools.tsx index 66d0846..5b2ccc1 100644 --- a/viewer/src/tools.tsx +++ b/viewer/src/tools.tsx @@ -1,21 +1,21 @@ -import { parse, X2jOptions } from 'fast-xml-parser'; +import { XMLParser, X2jOptions } from 'fast-xml-parser'; import { Map, LngLat, LngLatBounds } from "maplibre-gl"; import he from 'he'; const XML_PARSER_OPTIONS: Partial = { ignoreAttributes: false, parseAttributeValue: true, - tagValueProcessor: a => he.decode(a), - attrValueProcessor: a => he.decode(a, { isAttributeValue: true }) + tagValueProcessor: (_, tagValue) => he.decode(tagValue), }; /** * Parses XML data to a javascript object - * @param data + * @param data * @returns a javascript object representation of the xml data tree */ export function xmlToJSON(data: any): any { - return parse(data, XML_PARSER_OPTIONS); + const parser = new XMLParser(XML_PARSER_OPTIONS); + return parser.parse(data, false); } /** @@ -36,7 +36,7 @@ export function bboxContainsPoint(bbox: [number, number, number, number], point: if (bbox[0] === -180 && bbox[2] === -180) { inLon = true; } - + return (inLon && inLat); } catch (e) { console.error(e);