{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://github.com/ringsaturn/xue/blob/main/docs/schemas/polar-group.schema.json",
  "title": "PolarGroup",
  "description": "A polar store's root zarr.json (docs/zarr-profile.md, \"Polar store\"; docs/nexrad.md): radar sweeps in beam-and-gate coordinates, the xue_polar block in place of xue and xue_profile. A round store names its round, a window store its rounds. The readers' own checks: that the group carries no other branch's block and exactly one of round and rounds, and that the rounds ascend.",
  "type": "object",
  "required": ["zarr_format", "node_type", "attributes"],
  "properties": {
    "zarr_format": {"type": "integer", "const": 3},
    "node_type": {"type": "string", "const": "group"},
    "attributes": {
      "type": "object",
      "required": ["xue_polar"],
      "properties": {"xue_polar": {"$ref": "#/$defs/Polar"}}
    },
    "consolidated_metadata": {"$ref": "store-group.schema.json#/$defs/ConsolidatedMetadata"}
  },
  "$defs": {
    "Minute": {
      "description": "A round's UTC minute.",
      "type": "string",
      "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:00Z$",
      "format": "date-time"
    },
    "Polar": {
      "type": "object",
      "required": ["version", "product", "sites"],
      "properties": {
        "version": {"description": "This branch's version.", "type": "integer", "const": 1},
        "product": {"description": "The product, which names the data array.", "type": "string", "pattern": "^[a-z][a-z0-9]*$"},
        "round": {"$ref": "#/$defs/Minute"},
        "rounds": {"type": "array", "minItems": 1, "items": {"$ref": "#/$defs/Minute"}},
        "sites": {"description": "The radars in index order, by the source's own identifiers.", "type": "array", "minItems": 1, "items": {"type": "string", "minLength": 1}}
      },
      "anyOf": [
        {"type": "object", "required": ["round"]},
        {"type": "object", "required": ["rounds"]}
      ]
    }
  }
}
