validate_header

solarnet_metadata.validation.validate_header(header: Header, is_primary: bool = False, is_obs: bool = False, warn_empty_keyword: bool = False, warn_no_comment: bool = False, warn_data_type: bool = False, warn_missing_optional: bool = False, schema: SOLARNETSchema | None = None) List[str][source]

Validates a FITS header against the SOLARNET schema requirements.

This function performs multiple validation checks: 1. Verifies all required keywords are present based on HDU type 2. Checks for pattern-based keywords when specified in the schema 3. Validates each keyword, value, and comment according to FITS standards 4. Optionally validates data types against the schema specifications

Parameters:
  • header (fits.Header) – The FITS header to validate.

  • is_primary (bool, default False) – Whether this header belongs to a primary HDU, affecting which keywords are required.

  • is_obs (bool, default False) – Whether this header belongs to an observation HDU, affecting which keywords are required.

  • warn_empty_keyword (bool, default False) – Whether to report warnings for empty keywords.

  • warn_no_comment (bool, default False) – Whether to report warnings for keywords missing comments.

  • warn_data_type (bool, default False) – Whether to validate and report warnings about incorrect data types.

  • warn_missing_optional (bool, default False) – Whether to report warnings for optional keywords that aren’t included.

  • schema (Optional[SOLARNETSchema], default None) – The schema to validate against. If None, the default SOLARNET schema is used.

Returns:

validation_findings – A list of validation issues found; empty if the header is valid.

Return type:

List[str]