1 srf

srf

1.1 Functions

Name Description
download_extract Download a tar.gz file, and extract it to directory
filter_bands Filter the bands in srf to keep only the bands defined between wav_min and wav_max
get_SRF Get a SRF for the product ds
get_SRF_NASA Download and read Spectral Response Function (SRF) from NASA ocean color
get_SRF_eumetsat Download and read Spectral Response Function (SRF) from EUMETSAT database
get_SRF_landsat8_oli Get SRF for LANDSAT8 OLI
get_SRF_meris Get SRF for MERIS
get_SRF_misr Get SRF for MISR
get_SRF_msi Get SRF for Sentinel-2 MSI
get_SRF_olci Read OLCI SRF from EUM database
get_SRF_olci_full Get SRF for OLCI
get_SRF_olci_single Get the OLCI Spectral Response Function for a single (central) detector.
get_SRF_probav Get SRF for Proba-V
get_SRF_seviri Read SEVIRI SRF from EUMETSAT database, and rename with shorter band names
get_SRF_vgt Get SRF for VGT
get_band Returns the SRF DataArray for a given band identifier.
get_bands Returns the identifiers of the bands of a srf object
integrate_srf Integrate the quantity x over each spectral band in srf
nbands Returns the number of bands of a SRF object
plot_srf Plot a SRF Dataset
rename Rename bands in a SRF object
select Apply an index selection on the srf object.
select_first Select the first N variables in srf
squeeze Remove the “id” variable if it has only a single dimension, and rename the
to_tuple Convert an srf to a tuple for compatibility with codes that use such srf

1.1.1 download_extract

srf.download_extract(directory, url, verbose=False)

Download a tar.gz file, and extract it to directory

1.1.2 filter_bands

srf.filter_bands(srf, wav_min=None, wav_max=None, use_cwav=True)

Filter the bands in srf to keep only the bands defined between wav_min and wav_max

If use_cwav is True, filtering is based on the central wavelength of each band. If use_cwav is False, filtering requires the entire wavelength range of each SRF to fall within the specified bounds.

1.1.3 get_SRF

srf.get_SRF(
    platform_sensor=None,
    srf_getter=None,
    srf_getter_arg=None,
    fuzzy=True,
    rename_method='none',
    **kwargs,
)

Get a SRF for the product ds

Args: platform_sensor: sensor and platform definition - if a xr.Dataset, use the platform and sensor attributes of the Dataset - if a Tuple, it is (platform, sensor) - if a string, it is “” - if None (default, use srf_getter/srf_getter_arg) srf_getter (str): name of custom function to override the function for SRF reading. Example: ”eotools.srf.get_SRF_eumetsat” If None, srf_getter and srf_getter_arg are searched in the srf.csv file for the sensor/platform specified in ds. srf_getter_arg (str): argument passed to the srf_getter function, if any Example: ”dscovr_1_epic” fuzzy (bool): whether to apply fuzzy search to the sensor and platform (don’t match case, ignore whitespaces, ”-” and ””) rename_method (str): method to rename SRF band identifiers - ‘none’ (default): keep original band names from the SRF source - ‘bands’: rename SRF bands to match the bands dimension of the Dataset given in platform_sensor; panchromatic bands are excluded from the matching if the SRF has one more band than the Dataset - ‘cwav’: rename SRF bands to their central wavelength identifiers

Return a xr.Dataset with the SRF for each band, defined by default identifiers.

1.1.4 get_SRF_NASA

srf.get_SRF_NASA(id_sensor)

Download and read Spectral Response Function (SRF) from NASA ocean color website.

https://oceancolor.gsfc.nasa.gov/resources/docs/rsr_tables/

Args: id_sensor (str): identifier of the sensor/platform.

Returns: xr.Dataset: A dataset with the SRF for each band, defined by default identifiers.

1.1.5 get_SRF_eumetsat

srf.get_SRF_eumetsat(id_sensor='')

Download and read Spectral Response Function (SRF) from EUMETSAT database -> https://nwp-saf.eumetsat.int/site/software/rttov/download/coefficients/spectral-response-functions/

Args: id_sensor: identifier of the sensor/platform (as in the srf.csv file) Provide an empty string to list available id_sensors (default).

Returns a xr.Dataset with the SRF for each band.

1.1.6 get_SRF_landsat8_oli

srf.get_SRF_landsat8_oli()

Get SRF for LANDSAT8 OLI

1.1.7 get_SRF_meris

srf.get_SRF_meris()

Get SRF for MERIS

1.1.8 get_SRF_misr

srf.get_SRF_misr()

Get SRF for MISR

1.1.9 get_SRF_msi

srf.get_SRF_msi(platform)

Get SRF for Sentinel-2 MSI

platform: “S2A”, “S2B”, “S2C”

1.1.10 get_SRF_olci

srf.get_SRF_olci(sensor)

Read OLCI SRF from EUM database

Add the “id” variable for indexing Provide a mapping of (band, camera, ccd_col) to the corresponding variable name https://nwp-saf.eumetsat.int/downloads/rtcoef_rttov13/ir_srf/rtcoef_sentinel3_1_olci_srf.html

1.1.11 get_SRF_olci_full

srf.get_SRF_olci_full(platform)

Get SRF for OLCI

platform: one of “SENTINEL3_1”, “SENTINEL3_2”

1.1.12 get_SRF_olci_single

srf.get_SRF_olci_single(sensor)

Get the OLCI Spectral Response Function for a single (central) detector.

Selects the central detector element (camera FM7, CCD column 374) and removes single-valued coordinates and the ‘id’ field from the result.

1.1.12.1 Parameters

Name Type Description Default
sensor str OLCI sensor identifier. One of: - ‘sentinel3_1_olci’ - ‘sentinel3_2_olci’ required

1.1.12.2 Returns

Name Type Description
xr.DataArray The SRF data array for the central detector, with single-valued coordinates and the ‘id’ field removed.

1.1.13 get_SRF_probav

srf.get_SRF_probav()

Get SRF for Proba-V

1.1.14 get_SRF_seviri

srf.get_SRF_seviri(sensor)

Read SEVIRI SRF from EUMETSAT database, and rename with shorter band names

Sensor: msg_1_seviri msg_2_seviri msg_3_seviri msg_4_seviri

1.1.15 get_SRF_vgt

srf.get_SRF_vgt(sensor)

Get SRF for VGT

sensor: VGT1 or VGT2

1.1.16 get_band

srf.get_band(srf, band_id)

Returns the SRF DataArray for a given band identifier.

1.1.16.1 Parameters

Name Type Description Default
srf xr.Dataset Spectral response functions dataset. required
band_id str Band identifier (as returned by :func:get_bands). required

1.1.16.2 Returns

Name Type Description
xr.DataArray The SRF DataArray for the requested band.

1.1.17 get_bands

srf.get_bands(srf)

Returns the identifiers of the bands of a srf object

1.1.18 integrate_srf

srf.integrate_srf(
    srf,
    x,
    integration_function=simpson,
    integration_dimension=None,
    integration_dim_srf=None,
    integration_dim_x=None,
    resample=None,
)

Integrate the quantity x over each spectral band in srf

If x is a Callable, it is assumed to take inputs in the same unit as defined in srf. If x is a DataArray, it should have a dimension “wav” and an associated unit corresponding to the unit on which the srf is defined. In this case, either the srf is resampled to the wav dimension of x (resample=“x”) or x is resampled to the wav dimension of the srf (resample=“srf”).

integration_function: can be one of: - np.trapz - scipy.integrate.simpson

If the SRFs are defined over more than 1 dimension, the spectral dimension is specified through the integration_dim_srf argument.

Returns a Dataset of integrated values

1.1.19 nbands

srf.nbands(srf)

Returns the number of bands of a SRF object

1.1.20 plot_srf

srf.plot_srf(srf)

Plot a SRF Dataset

1.1.21 rename

srf.rename(srf, band_ids, thres_check=None)

Rename bands in a SRF object

Args: srf: the input srf object, with arbitrary band names band_ids: the new band identifiers. if list or array, they are defined as the central if str: “cwav”: define the bands as their central wavelength “trim”: trim the variable names start and end to keep only the variable part “enum”: enumerate the bands, starting from 1 thres_check: check that the integrated srf is within a distance of thres_check of band_id (assumed integer) If None, this test is disactivated.

1.1.22 select

srf.select(srf, **kwargs)

Apply an index selection on the srf object.

If srf contains an “id” variable, it is used to trim down the variables.

The kwargs are used for the selection based on the dimensions present in srf.

Example: select(srf, camera=1) returns a subset of the srf for camera 1.

1.1.23 select_first

srf.select_first(srf, N)

Select the first N variables in srf

1.1.24 squeeze

srf.squeeze(ds)

Remove the “id” variable if it has only a single dimension, and rename the main variables accordingly

1.1.25 to_tuple

srf.to_tuple(srf, minT=0.005, func_odr=_Func_ODR.simpson)

Convert an srf to a tuple for compatibility with codes that use such srf representation (from smaclib)

Arguments: srf: a dataset coming from get_SRF minT: threshold for minimum transmission subsetting. 0.005 by default (legacy) func_odr: the function used for ODR integration, can either be _Func_ODR.simpson or _Func_ODR.trapz, _Func_ODR.simpson by default (legacy)

returns: (wvn_limits, wvl_limits, fwhm, wvl_central, rod_effective, srf_wvl, rsrf) with wvn in cm-1, wvl in nm, fwhm in nm, wvl_central in nm, SRF weighted Rayleigh optical depth, reference wavelegnth of the rsrf in nm, rsrf, name (string)