hypso.device module

class hypso.device.Hypso(hypso_path, points_path=None)

Bases: object

Parameters:
  • hypso_path (str) –

  • points_path (Optional[str]) –

create_geotiff(product='L2-ACOLITE', force_reload=False, atmos_dict=None)

Create a GeoTIFF file for either the L1C or L2 products.

Parameters:
  • product (Literal['L2-ACOLITE', 'L2-6SV1', 'L1C']) – Product to be used to create the GeoTIFF file

  • force_reload (bool) – When True, deletes the file if it exists and forces the generation of a new one.

  • atmos_dict (Optional[dict]) –

    Dictionary of parameters if the L2 product is selected.

    * For ACOLITE *

    {'user':'alvarof', 'password':'nwz7xmu8dak.UDG9kqz'}

    (user and password from https://urs.earthdata.nasa.gov/profile)

    * For 6SV1 **

    {'aot550': 0.0580000256}

    (AOT550 parameter gotten from: https://giovanni.gsfc.nasa.gov/giovanni/)

Returns:

No return.

Return type:

None

create_l1b_nc_file()

Create a l1b.nc file using the radiometrically corrected data. Same structure from the original l1a.nc file is used. Required to run ACOLITE as the input is a radiometrically corrected .nc file.

Returns:

Nothing.

Return type:

None

delete_geotiff_dir()

Delete the GeoTiff directory. Used when force_reload is set to True in the “create_geotiff” method.

Returns:

No return.

Return type:

None

find_existing_l2_cube()

Recursively find the .npy files corresponding to previous runs of the atmospheric correction process. This saves time by loading the .npy files instead of correction again.

Returns:

The dictionary containing all .npy containing atmospherically corrected BOA reflectance. Could be either ACOLITE or 6SV1. Returns None if no .npy found.

Return type:

Optional[dict]

find_geotiffs()

Recursively find GeoTiffs inside the “top_folder_name” directory in the “info” dictionary from the Hypso class. GeoTiffs paths are stored in the Hypso object attribures, rgbGeotiffFilePath, l1cgeotiffFilePath and l2geotiffFilePath.

Returns:

No return.

Return type:

None

get_calibrated_and_corrected_cube()
Get calibrated and corrected cube. Includes Radiometric, Smile and Destriping Correction.

Assumes all coefficients has been adjusted to the frame size (cropped and binned), and that the data cube contains 12-bit values.

Returns:

Corrected Hyperspectral Cube as a Numpy Array

Return type:

ndarray

get_calibration_coefficients_path()

Get the absolute ath for the calibration coefficients included in the package. This includes radiometric, smile and destriping correction.

Returns:

Dictionary with paths for radiometric, smil and destriping correction.

Return type:

dict

get_projection_metadata()

Returns the projection metadata dictionary. This is either extracted from the RGBA, L1 or L1C GeoTiff

Returns:

Dictionary containing the projection information for the capture.

Return type:

dict

get_spectra(position_dict, product='L1C', filename=None, plot=True)

Get spectra values from the indicated coordinated or pixel.

Parameters:
  • position_dict (dict) –

    Dictionary with the inputs required.

    * If Coordinates are Input *

    {"lat":59.5,"lon":10}

    * If pixel location passed *

    {"X":200,"Y":83}

  • product (Literal['L1C', 'L2-6SV1', 'L2-ACOLITE']) – Product of which to retrieve the spectral signal. Can either be “L1C”, “L2-ACOLITE” or “L2-6SV1”

  • filename (Optional[str]) – Path on which to save the spectra as a .csv file. Filename should contain the “.csv” extension. Example: “/Documents/export_signal.csv”. If None, the spectral signal won´t be saved as a file.

  • plot (bool) – If True, the spectral signal will be plotted.

Returns:

None if the coordinates/pixel location are not withing the captured image. Otherwise, a pandas dataframe containing the spectral signal is returned.

Return type:

Optional[DataFrame]

get_spectral_coefficients_path()

Get the absolute path for the spectral coefficients (wavelengths).

Returns:

Absolute path for the spectral coefficients (wavelengths)

Return type:

str

get_srf()

Get Spectral Response Functions (SRF) from HYPSO for each of the 120 bands. Theoretical FWHM of 3.33nm is used to estimate Sigma for an assumed gaussian distribution of each SRF per band.

Returns:

List of SRF

Return type:

list

get_toa_reflectance()

Convert Top Of Atmosphere (TOA) Radiance to TOA Reflectance.

Returns:

Array with TOA Reflectance.

Return type:

ndarray

hypso.device.set_or_create_attr(var, attr_name, attr_value)

Set or create an attribute on “.nc” file.

Parameters:
  • var – Variable on to which assign the attribute

  • attr_name – Attribute name

  • attr_value – Attribute value

Returns:

No return value

Return type:

None