Skip to content

Commit 0470588

Browse files
committed
small changes
1 parent f909d43 commit 0470588

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

xcube_eopf/constants.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from xcube.util.jsonschema import (
88
JsonArraySchema,
9+
JsonComplexSchema,
910
JsonDateSchema,
1011
JsonIntegerSchema,
1112
JsonNumberSchema,
@@ -54,19 +55,28 @@
5455
"Start and stop are inclusive."
5556
),
5657
)
57-
SCHEMA_VARIABLES = JsonArraySchema(
58-
items=(JsonStringSchema(min_length=0)),
59-
unique_items=True,
58+
SCHEMA_VARIABLES = JsonComplexSchema(
6059
title="Names of variables in dataset",
6160
description="Names of variables which will be included in the data cube.",
61+
one_of=[
62+
JsonStringSchema(
63+
title="Variable name or regex pattern",
64+
min_length=0,
65+
),
66+
JsonArraySchema(
67+
title="Iterable of variables",
68+
items=(JsonStringSchema(min_length=0)),
69+
unique_items=True,
70+
),
71+
],
6272
)
6373
SCHEMA_SPATIAL_RES = JsonNumberSchema(title="Spatial Resolution", exclusive_minimum=0.0)
6474
SCHEMA_CRS = JsonStringSchema(title="Coordinate reference system")
6575
SCHEMA_TILE_SIZE = JsonArraySchema(
6676
nullable=True,
6777
title="Tile size of returned dataset",
6878
description=(
69-
"Tile size in y and x (or lat and lon if crs is geographic) "
79+
"Spatial tile size in y and x (or lat and lon if crs is geographic) "
7080
"in returned dataset."
7181
),
7282
items=[JsonIntegerSchema(minimum=1), JsonIntegerSchema(minimum=1)],

xcube_eopf/prodhandlers/sentinel2.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@
5555
"flag_colors",
5656
"grid_mapping",
5757
]
58+
_LONG_NAME_TRANSLATION = {
59+
"cld": "Cloud probability, based on Sen2Cor processor",
60+
"scl": "Scene classification data, based on Sen2Cor processor",
61+
"snw": "Snow probability, based on Sen2Cor processor",
62+
}
5863
_INTERPOLATIONS = {0: "nearest", 2: "bilinear"}
5964
_SCHEMA_SPLINE_ORDERS = JsonComplexSchema(
6065
title="Spline orders for updampling",
@@ -727,5 +732,7 @@ def _create_empty_dataset(
727732
for k in _ATTRIBUTE_KEYS
728733
if k in sample_ds[key].attrs
729734
}
735+
if key in _LONG_NAME_TRANSLATION.keys():
736+
ds[key].attrs["long_name"] = _LONG_NAME_TRANSLATION[key]
730737

731738
return ds

0 commit comments

Comments
 (0)