asp_plot.sensors.worldview#
Metadata reader for WorldView / DigitalGlobe-heritage XML camera files.
Attributes#
Classes#
Metadata reader for WorldView satellite XML camera files. |
Module Contents#
- class asp_plot.sensors.worldview.WorldViewMetadata(directory=None, image_list=None)#
Bases:
asp_plot.sensors.base.SensorMetadataMetadata reader for WorldView satellite XML camera files.
Parses WorldView (and other DigitalGlobe-heritage products that share the same XML format, e.g. GeoEye-1, QuickBird, IKONOS) satellite XML files to extract per-scene metadata, handling both single XML files and multiple XML tiles per scene (mosaicked with
dg_mosaic).This class is named for the sensor family (the stable WorldView name) and governs which reader parses the XML. It is intentionally distinct from the attribution check
asp_plot.utils.detect_vantor_satellite(), which is named for the rights-holder (Vantor) and decides whether the “© Vantor” overlay applies. The two concerns use different names on purpose; see #137.- getAtt(xml)#
Extract attitude data from XML file.
Retrieves satellite attitude (orientation quaternion and covariance) data from the XML file.
- Parameters:
xml (str) – Path to the XML file
- Returns:
Array of shape (N, 15) containing attitude data with columns: point_num, q1, q2, q3, q4, and 10 covariance matrix elements (upper triangle of 4x4 matrix)
- Return type:
- getAtt_df(xml)#
Create a DataFrame from attitude data.
Converts attitude data to a DataFrame with time index.
- Parameters:
xml (str) – Path to the XML file
- Returns:
DataFrame with attitude quaternions and covariance, time-indexed
- Return type:
pandas.DataFrame
- getEphem(xml)#
Extract ephemeris data from XML file.
Retrieves satellite ephemeris (position and velocity) data from the XML file.
- Parameters:
xml (str) – Path to the XML file
- Returns:
Array containing ephemeris data with columns: point_num, Xpos, Ypos, Zpos, Xvel, Yvel, Zvel, and covariance matrix elements
- Return type:
Notes
All coordinates are in Earth-Centered Fixed (ECF) reference frame. Units are meters for positions, meters/sec for velocities, and m^2 for covariance.
- getEphem_gdf(xml)#
Create a GeoDataFrame from ephemeris data.
Converts ephemeris data to a GeoDataFrame with time index and Point geometry.
- Parameters:
xml (str) – Path to the XML file
- Returns:
GeoDataFrame with ephemeris data and Point geometries in EPSG:4978
- Return type:
geopandas.GeoDataFrame
Notes
The GeoDataFrame uses EPSG:4978 (Earth-Centered Earth-Fixed) CRS and has a time index corresponding to the acquisition times.
- get_catid_xmls()#
Get a single representative XML file for each catalog ID.
Groups the discovered XML files by their catalog ID (read from the XML content, not the filename) and resolves each scene to one XML: a scene delivered as a single XML is used as-is, while a scene tiled across multiple XMLs is mosaicked into one with
dg_mosaic.- Returns:
Dictionary mapping catalog IDs to a single XML file path.
- Return type:
- Raises:
ValueError – If none of the discovered XML files contain a
CATIDtag.
Notes
Mosaicking is decided per catalog ID, so a directory holding many distinct single-tile scenes is not mosaicked just because it contains more than two XML files. Mosaicking a tiled scene requires
dg_mosaicfrom the NASA Ames Stereo Pipeline on the system path.
- get_id_dict(catid, xml, geteph=True)#
Get a dictionary of metadata for a specific catalog ID.
Extracts metadata from XML file for a given catalog ID, including satellite parameters, acquisition angles, and geometry.
- Parameters:
- Returns:
Dictionary containing metadata for the catalog ID
- Return type:
Notes
The dictionary includes satellite ID, acquisition date, scan direction, TDI level, geometry information, and various mean angles and parameters. If geteph is True, also includes ephemeris and footprint GeoDataFrames.
The identity core (xml_fn, catid, sensor, date, geom) is read strictly — a camera XML without those is an error. The summary fields degrade to “not provided” (None/NaN) when their tags are absent (issue #163):
dg_mosaiccan strip image tags, and Multi products carry per-band TDI instead of a singleTDILEVEL.
- get_scene_dicts()#
Get dictionaries of metadata for each catalog ID.
Builds dictionaries of metadata for each catalog ID found in the XML files.
- Returns:
List of dictionaries, one for each catalog ID, containing metadata
- Return type:
- xml2poly(xml)#
Convert XML corner coordinates to Shapely Polygon.
Reads XML file and converts corner coordinates to a Shapely Polygon geometry.
- Parameters:
xml (str) – Path to the XML file
- Returns:
Polygon geometry representing the image footprint
- Return type:
shapely.geometry.Polygon
- xml2wkt(xml)#
Convert XML corner coordinates to WKT polygon string.
Extracts corner coordinates from XML file and converts them to a Well-Known Text (WKT) polygon string.
- Parameters:
xml (str) – Path to the XML file
- Returns:
WKT polygon string representation of image footprint
- Return type:
Notes
Uses ULLON/ULLAT, URLON/URLAT, LRLON/LRLAT, LLLON/LLLAT tags (Upper-Left, Upper-Right, Lower-Right, Lower-Left corners).
- name = 'WorldView'#
- asp_plot.sensors.worldview.logger#