pygmi.rsense.emit#

EMIT is used to import EMIT satellite data into PyGMI.

It uses code by Erik Bolch, ebolch@contractor.usgs.gov

Functions#

emit_xarray(filepath[, ortho, qmask, unpackedbmask])

EMIT xarray.

apply_glt(ds_array, glt_array[, fill_value, ...])

Apply GLT.

coord_vects(ds)

Calculate the Lat and Lon Vectors/Coordinate Grid.

ortho_xr(ds[, GLT_NODATA_VALUE, fill_value])

Use apply_glt to create an orthorectified xarray dataset.

xr_to_pygmi(xrds[, piter, showlog, tnames, metaonly])

Xarray to PyGMI dataset.

Module Contents#

pygmi.rsense.emit.emit_xarray(filepath, ortho=False, qmask=None, unpackedbmask=None)#

EMIT xarray.

This function utilizes other functions in this module to streamline opening an EMIT dataset as an xarray.Dataset.

Parameters:
  • filepath (str) – a file path to an EMIT netCDF file.

  • ortho (bool) – Whether to orthorectify the dataset or leave in crosstrack/downtrack coordinates. The default is False.

  • qmask (numpy.typing.NDArray | None) – Output from the quality_mask function used to mask pixels based on quality flags selected in that function. Any non-orthorectified array with the proper crosstrack and downtrack dimensions can also be used. The default is None.

  • unpackedbmask (numpy.typing.NDArray | None) – From the band_mask function, used to mask band-specific pixels that have been interpolated. The default is None.

Returns:

Dataset constructed based on the parameters provided.

Return type:

xarray.Dataset

pygmi.rsense.emit.apply_glt(ds_array, glt_array, fill_value=-9999, GLT_NODATA_VALUE=0)#

Apply GLT.

This function applies the GLT array to a numpy array of either 2 or 3 dimensions.

Parameters:
  • ds_array (numpy.typing.NDArray) – A numpy array of the desired variable.

  • glt_array (numpy.typing.NDArray) – A GLT array constructed from EMIT GLT data.

  • fill_value (int) – Fill value. The default is -9999.

  • GLT_NODATA_VALUE (int) – GLT nodata value. The default is 0.

Returns:

a numpy array of orthorectified data.

Return type:

ndarray

pygmi.rsense.emit.coord_vects(ds)#

Calculate the Lat and Lon Vectors/Coordinate Grid.

This function calculates the Lat and Lon Coordinate Vectors using the GLT and Metadata from an EMIT dataset read into xarray.

Parameters:

ds (xarray.Dataset) – an xarray.Dataset containing the root variable and metadata of an EMIT dataset.

Returns:

  • lon (ndarray) – Longitude.

  • lat (ndarray) – Latitude.

Return type:

tuple[numpy.typing.NDArray, numpy.typing.NDArray]

pygmi.rsense.emit.ortho_xr(ds, GLT_NODATA_VALUE=0, fill_value=-9999)#

Use apply_glt to create an orthorectified xarray dataset.

Parameters:
  • ds (xarray.Dataset) – Dataset produced by emit_xarray.

  • GLT_NODATA_VALUE (int) – No data value for the GLT tables. The default is 0.

  • fill_value (int) – The fill value for EMIT datasets. The default is -9999.

Returns:

an orthocorrected xarray dataset.

Return type:

xarray.Dataset

pygmi.rsense.emit.xr_to_pygmi(xrds, piter=iter, showlog=print, tnames=None, metaonly=False)#

Xarray to PyGMI dataset.

Takes an EMIT dataset read into an xarray dataset using the emit_xarray function and convert to PyGMI dataset.

Parameters:
  • xrds (xarray.Dataset) – an EMIT dataset read into xarray using the emit_xarray function.

  • piter (collections.abc.Iterable) – Progress bar iterator. The default is iter.

  • showlog (collections.abc.Callable[..., None]) – Display information. The default is print.

  • tnames (list[str] | None) – list of band names to import, in order. The default is None.

  • metaonly (bool) – Retrieve only the metadata for the file. The default is False.

Returns:

dat – list of pygmi raster Data.

Return type:

list of Data