hypergas.hyper module
Hyper object to hold hyperspectral satellite data.
- class hypergas.hyper.Hyper(filename=None, reader=None)[source]
Bases:
objectThe Hyper Class.
Example usage:
from hypergas import Hyper # create Hyper and open files hyp = Hyper(filenames='/path/to/file/*') # load datasets from input files hyp.load() # retrieve ch4 hyp.retrieve(self, wvl_intervals=[2110, 2450], species='ch4') # orthorectification hyp.terrain_corr(varname='rgb') # export to NetCDF file hyp.scene.save_datasets(datasets=['u10', 'v10', 'rgb', 'ch4'], filename='output.nc', writer='cf')
Initialize Hyper.
To load Hyper data,
filenameandreadermust be specified:hyp = Hyper(filenames=glob('/path/to/hyper/files/*'), reader='hsi_l1b')
- Parameters:
- denoise(varname='ch4', method='calibrated_tv_filter', weight=None)[source]
Denoise the input data using
hypergas.denoise.Denoise.- Parameters:
varname (str) – The variable to be denoised.
method (str) – The denoising method: “tv_filter” and “calibrated_tv_filter” (default).
weight (int) – The weight for denoise_tv_chambolle. It would be neglected if method is “calibrated_tv_filter”. If
weightisNone(default) andmethodis “tv_filter”, the denoise_tv_chambolle will use the default value (0.1) which is too low for hyperspectral noisy gas field.
- Returns:
da_denoise (
DataArray) – Denoised data.
- load(drop_waterbands=True)[source]
Load data into xarray Dataset using Satpy.
- Parameters:
drop_waterbands (bool) – whether to drop bands affected by water. Default: True.
- plume_mask(varname='ch4_comb_denoise', n_min_threshold=5, sigma_threshold=1)[source]
Create a priori plume masks using
hypergas.a_priori_mask.Mask.- Parameters:
scn (Satpy Scene) – Scene including one variable named
segmentationwhich is calculated byhypergas.landmask.Land_mask(). segmentation (DataArray): 0: ocean, >0: landvarname (str) – The variable used to create plume mask. (Recommend:
<gas>_comb_denoise)n_min_threshold (int) – The minimum number of pixels per threshold for detecting features. (Default: 5).
sigma_threshold (int) – Gaussian filter sigma for smoothing field. Default: 1. Because the
<gas>_comb_denoisefield is already smoothed, 1 should be high enough.
- retrieve(wvl_intervals=None, species='ch4', algo='smf', mode='column', rad_dist='normal', land_mask=True, land_mask_source='OSM', cluster=False, plume_mask=None)[source]
Retrieve trace gas enhancements.
- Parameters:
wvl_intervals (list) – The wavelength range (nm) used in matched filter. It can be one list or nested list. e.g.
[2110, 2450]or[[1600, 1750], [2110, 2450]]. Deafult:[2110, 2450]for ch4 and[1930, 2200]for co2.species (str) – The species (“ch4”, “co2”) to be retrieved. Default: “ch4”.
algo (str) – The matched filter algorithm, currently supporting only one algorithm: simple matched filter (smf). This is the original matched filter algorithm.
mode (str) – The mode (“column” or “scene”) to apply matched filter. Default: “column”. Be careful of noise if you apply the matched filter for the whole scene.
rad_dist (str) – The assumed rads distribution (“normal” or “lognormal”) Default: “normal”.
land_mask (bool) – Whether apply the matched filter to continental and oceanic pixels seperately. Default: True.
land_mask_source (str) – The data source of land mask (“OSM”, “GSHHS” or “Natural Earth”). Default: OSM.
cluster (bool) – Whether apply the pixel classification. Default: False.
plume_mask (
numpy.ndarray) – 2D manual mask. 0: neglected pixels, 1: valid pixels. Default:None.
- terrain_corr(varname='rgb', rpcs=None, gcps=None, gcp_crs=None)[source]
Apply orthorectification using
hypergas.orthorectification.Ortho.