Skip to content

Commit 542c7f2

Browse files
committed
fix: grib layer defintitions
1 parent e40306e commit 542c7f2

1 file changed

Lines changed: 4 additions & 15 deletions

File tree

src/utils/stac.js

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,10 @@ StacFields.Registry.addMetadataField("ecmwf:types", {
523523
StacFields.Registry.addMetadataField("ecmwf:pressure_levels", {
524524
label: "Pressure levels",
525525
});
526+
StacFields.Registry.addMetadataField("grib:layer_definitions", {
527+
label: "GRIB layer definitions",
528+
formatter: value => ", ".join(Object.keys(value))
529+
})
526530

527531
export const mediaTypeOverride = value => {
528532
switch (value) {
@@ -682,24 +686,9 @@ export const renderItemColumn = (item, _, column) => {
682686
default:
683687
if (Array.isArray(fieldContent)) {
684688
fieldContent = fieldContent.join(", ");
685-
} else if (isObject(fieldContent)) {
686-
return formatObject(fieldContent);
687-
}
688689
return stacFormatter.format(fieldContent, column.fieldName);
689690
}
690691
};
691692

692-
const formatValue = value => {
693-
if (Array.isArray(value)) return value.join(", ");
694-
if (isObject(value)) return formatObject(value);
695-
return String(value);
696-
};
697-
698-
const formatObject = obj => {
699-
return Object.entries(obj)
700-
.map(([k, v]) => `${stacFormatter.label(k)}: ${formatValue(v)}`)
701-
.join(", ");
702-
};
703-
704693
const boldStyle = { root: { fontWeight: "bold" } };
705694
const gap4 = { childrenGap: 4 };

0 commit comments

Comments
 (0)