Site‑level properties parsed from the J‑format information block.
This module defines a lightweight container for the metadata
exposed in lines beginning with >KEY=VALUE in A.G. Jones J files.
It focuses on robust parsing and normalization (e.g., azimuth
wrapping, latitude/longitude hemispheres, and missing sentinels).
Container for site properties parsed from J-format info.
This class stores site-level metadata such as latitude,
longitude, azimuth, and elevation that are declared in the
J-format information block as >KEY=VALUE lines.
Parameters:
azimuth (float or None, optional) – Site X-axis azimuth in degrees, referenced to true
north. Values are wrapped to [0,360) when parsed.
latitude (float or None, optional) – Latitude in decimal degrees. Inputs may include DMS or
hemisphere suffixes and are normalized to [-90,90].
longitude (float or None, optional) – Longitude in decimal degrees. Inputs may include DMS or
hemisphere suffixes and are normalized to [-180,180).
elevation (float or None, optional) – Elevation in metres. Missing sentinels are mapped to
None.
extra (dict of (str -> str), optional) – Unrecognized >KEY=VALUE pairs preserved verbatim.
verbose (int or bool, default 0) – Verbosity for non-fatal parsing warnings.
strict (bool, default False) – If True, out-of-range coordinates raise errors
instead of being coerced to valid bounds.
Variables:
location (tuple of (float, float) or None) – Convenience property returning (lat,lon) when both
are available, else None.
azimuth_rad (float or None) – Azimuth converted to radians when available.
Notes
Parsing leverages robust coordinate helpers that accept DMS,
hemisphere letters, and free whitespace. Longitudes are
normalized into the half-open interval [-180,180).
The parser reads sequentially and collects >KEY=VALUE
pairs as long as lines are comments, blanks, or info
records. It stops at the first non-conforming line.
Parameters:
lines (iterable of str) – Lines that include the information block content.
strict (bool, default False) – If True, invalid coordinates raise. If False,
out-of-range values are coerced with a warning.
verbose (int or bool, default 0) – Verbosity for non-fatal parsing warnings.
Build a JSiteProperty from a dict of key-value
pairs.
Keys can be any case and will be normalized to the upper
case tokens used by J files. Values can be strings or
numbers. Unknown keys are preserved in extra.
Parameters:
mapping (Mapping[str, Any]) – Pairs like {\"latitude\":41.9,\"longitude\":140.8}.
strict (bool, default False) – If True, invalid coordinates raise. If False,
out-of-range values are coerced with a warning.
verbose (int or bool, default 0) – Verbosity for non-fatal parsing warnings.