s2d2.sensor_readings_sentinel2

Module Contents

Functions

get_flight_bearing_from_gnss_s2(path, spatialRef, rec_tim)

get the direction/argument/heading of the Sentinel-2 acquisition

get_flight_path_s2(ds_path[, fname, s2_dict])

It is also possible to only give the dictionary, as this has such metadata

get_flight_orientation_s2(ds_path[, fname, s2_dict])

get the flight path and orientations of the Sentinel-2 satellite during

s2d2.sensor_readings_sentinel2.get_flight_bearing_from_gnss_s2(path, spatialRef, rec_tim, fname='MTD_DS.xml')[source]

get the direction/argument/heading of the Sentinel-2 acquisition

Parameters:
  • path (string) – directory where the meta-data is located

  • spatialRef (osgeo.osr.SpatialReference) – projection system used

  • rec_tim ({integer,float}) – time stamp of interest

  • fname (string) – filename of the meta-data file

Returns:

az – array with argument values, based upon the map projection given

Return type:

numpy.array, size=(m,1), float

See also

get_s2_image_locations

to get the datastrip id

Notes

The metadata is scattered over the file structure of Sentinel-2, L1C

* S2X_MSIL1C_20XX...
├ AUX_DATA
├ DATASTRIP
│  └ DS_XXX_XXXX...
│     └ QI_DATA
│        └ MTD_DS.xml <- metadata about the data-strip
├ GRANULE
│  └ L1C_TXXXX_XXXX...
│     ├ AUX_DATA
│     ├ IMG_DATA
│     ├ QI_DATA
│     └ MTD_TL.xml <- metadata about the tile
├ HTML
├ rep_info
├ manifest.safe
├ INSPIRE.xml
└ MTD_MSIL1C.xml <- metadata about the product

The following acronyms are used:

  • DS : datastrip

  • TL : tile

  • QI : quality information

  • AUX : auxiliary

  • MTD : metadata

  • MSI : multi spectral instrument

  • L1C : product specification,i.e.: level 1, processing step C

s2d2.sensor_readings_sentinel2.get_flight_path_s2(ds_path, fname='MTD_DS.xml', s2_dict=None)[source]

It is also possible to only give the dictionary, as this has such metadata within.

Parameters:
  • ds_path (string) – location of the metadata file

  • fname (string, default='MTD_DS.xml') – name of the xml-file that has the metadata

  • s2_dict (dictonary) – metadata of the Sentinel-2 platform

Returns:

  • sat_time (numpy.array, size=(m,1), dtype=np.datetime64, unit=ns) – time stamp of the satellite positions

  • sat_xyz (numpy.array, size=(m,3), dtype=float, unit=meter) – 3D coordinates of the satellite within an Earth centered Earth fixed (ECEF) frame.

  • sat_err (numpy.array, size=(m,3), dtype=float, unit=meter) – error estimate of the 3D coordinates given by “sat_xyz”

  • sat_uvw (numpy.array, size=(m,3), dtype=float, unit=meter sec-1) – 3D velocity vectors of the satellite within an Earth centered Earth fixed (ECEF) frame.

  • s2_dict (dictonary) – updated with keys: “gps_xyz”, “gps_uvw”, “gps_tim”, “gps_err”, “altitude”, “speed”

See also

get_flight_orientation_s2

get the quaternions of the flight path

Examples

Following the file and metadata structure of scihub:

>>> import os
>>> import numpy as np
>>> from s2d2.read_sentinel2 import list_central_wavelength_msi
>>> from s2d2.handler.sentinel2 import get_s2_image_locations
>>> s2_dir = '/data-dump/examples/'
>>> s2_name = 'S2A_MSIL1C_20200923T163311_N0209_R140_T15MXV_20200923T200821.SAFE'
>>> fname = os.path.join(s2_dir, s2_name, 'MTD_MSIL1C.xml')
>>> s2_df = list_central_wavelength_s2()
>>> s2_df, datastrip = get_s2_image_locations(fname, s2_df)
>>> path_det = os.path.join(s2_dir, s2_name, 'DATASTRIP', datastrip[17:-7])
>>> sat_tim, sat_xyz, sat_err, sat_uvw = get_flight_path_s2(path_det)

Notes

The metadata structure of MTD_DS looks like:

* MTD_DS.xml
└ n1:Level-1C_DataStrip_ID
   ├ n1:General_Info
   ├ n1:Image_Data_Info
   ├ n1:Satellite_Ancillary_Data_Info
   │  ├ Time_Correlation_Data_List
   │  ├ Ephemeris
   │  │  ├ GPS_Number_List
   │  │  ├ GPS_Points_List
   │  │  │  └ GPS_Point
   │  │  │     ├ POSITION_VALUES
   │  │  │     ├ POSITION_ERRORS
   │  │  │     ├ VELOCITY_VALUES
   │  │  │     ├ VELOCITY_ERRORS
   │  │  │     ├ GPS_TIME
   │  │  │     ├ NSM
   │  │  │     ├ QUALITY_INDEX
   │  │  │     ├ GDOP
   │  │  │     ├ PDOP
   │  │  │     ├ TDOP
   │  │  │     ├ NOF_SV
   │  │  │     └ TIME_ERROR
   │  │  └ AOCS_Ephemeris_List
   │  ├ Attitudes
   │  ├ Thermal_Data
   │  └ ANC_DATA_REF
   │
   ├ n1:Quality_Indicators_Info
   └ n1:Auxiliary_Data_Info

The following acronyms are used:

  • AOCS : attitude and orbit control system

  • CAMS : Copernicus atmosphere monitoring service

  • DEM : digital elevation model

  • GDOP : geometric dilution of precision

  • GPS : global positioning system

  • GRI : global reference image

  • IERS : international earth rotation and reference systems service

  • IMT : instrument measurement time

  • NSM : navigation solution method

  • NOF SV : number of space vehicles

  • PDOP : position dilution of precision

  • TDOP : time dilution of precision

s2d2.sensor_readings_sentinel2.get_flight_orientation_s2(ds_path, fname='MTD_DS.xml', s2_dict=None)[source]

get the flight path and orientations of the Sentinel-2 satellite during acquisition.

It is also possible to only give the dictionary, as this has such metadata within.

Parameters:
  • ds_path (string) – directory where the meta-data is located

  • fname (string, default='MTD_DS.xml') – filename of the meta-data file

  • s2_dict (dictonary, default=None) – metadata of the Sentinel-2 platform

Returns:

  • sat_time (numpy.array, size=(m,1), unit=nanosec) – satellite timestamps

  • sat_angles (numpy.array, size=(m,3)) – satellite orientation angles, given in ECEF

  • s2_dict (dictonary) – updated with keys: “time”, “quat”

See also

get_flight_path_s2

get positions of the flight path