OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
create_images Namespace Reference

Functions

def gamma_stretch (data, gamma=2)
 
def extract_data (image, avail_bands, req_bands, allow_neg=False, key='Rrs')
 
def plot_product (ax, title, product, rgb, vmin, vmax)
 

Variables

string sensor = 'HICO'
 
dictionary kwargs
 
 req_bands = get_sensor_bands(sensor, get_args(**kwargs))
 
list rgb_bands = [660, 550, 440]
 
 time_start = time.time()
 
 image = Dataset(location.joinpath('l2gen.nc'))['geophysical_data']
 
 bands = sorted([int(k.replace('Rrs_', '')) for k in image.variables.keys() if 'Rrs_' in k])
 
def Rrs = extract_data(image, bands, req_bands)
 
def rgb = extract_data(image, bands, rgb_bands, key='rhos')
 
 products
 
 slices
 
 f
 
 axes
 
 figsize
 
dictionary bounds
 

Detailed Description

Mixture Density Network (MDN) ocean color water quality product retrieval 

MDN is a machine learning algorithm, trained to use remote sensing reflectance (Rrs) 
to estimate various water quality products. This package includes the model which
retrieves Chlorophyll-a (chl), Total Suspended Solids (tss), Colored Dissolved Organic 
Matter at 440nm (cdom), and Phycocyanin Concentration (pc) from HICO imagery. 

To utilize this package, activate the provided virtual environment and call the script:
$ source venv/Scripts/activate
$ python create_images.py

Code base can additionally be found at:
https://github.com/BrandonSmithJ/MDN
https://github.com/STREAM-RS/STREAM-RS

Brandon Smith, NASA Goddard Space Flight Center, October 2021

Function Documentation

◆ extract_data()

def create_images.extract_data (   image,
  avail_bands,
  req_bands,
  allow_neg = False,
  key = 'Rrs' 
)
Extract the requested bands from a given NetCDF object 

Definition at line 39 of file create_images.py.

◆ gamma_stretch()

def create_images.gamma_stretch (   data,
  gamma = 2 
)
Apply gamma stretching to brighten imagery 

Definition at line 33 of file create_images.py.

◆ plot_product()

def create_images.plot_product (   ax,
  title,
  product,
  rgb,
  vmin,
  vmax 
)
Plot a given product on the axis using vmin/vmax as the 
    colorbar min/max, and rgb as the visible background 

Definition at line 58 of file create_images.py.

Variable Documentation

◆ axes

axes

Definition at line 99 of file create_images.py.

◆ bands

bands = sorted([int(k.replace('Rrs_', '')) for k in image.variables.keys() if 'Rrs_' in k])

Definition at line 91 of file create_images.py.

◆ bounds

dictionary bounds
Initial value:
1 = {
2  'chl' : (1, 100),
3  'tss' : (1, 100),
4  'pc' : (1, 100),
5  'cdom': (0.1, 10),
6  }

Definition at line 100 of file create_images.py.

◆ f

f

Definition at line 99 of file create_images.py.

◆ figsize

figsize

Definition at line 99 of file create_images.py.

◆ image

image = Dataset(location.joinpath('l2gen.nc'))['geophysical_data']

Definition at line 90 of file create_images.py.

◆ kwargs

dictionary kwargs
Initial value:
1 = {
2  'sensor' : sensor,
3  'product' : 'chl,tss,cdom,pc',
4  'sat_bands' : True,
5  'use_ratio' : True,
6  'use_excl_Rrs' : True,
7  }

Definition at line 74 of file create_images.py.

◆ products

products

Definition at line 96 of file create_images.py.

◆ req_bands

req_bands = get_sensor_bands(sensor, get_args(**kwargs))

Definition at line 83 of file create_images.py.

◆ rgb

def rgb = extract_data(image, bands, rgb_bands, key='rhos')

Definition at line 93 of file create_images.py.

◆ rgb_bands

list rgb_bands = [660, 550, 440]

Definition at line 84 of file create_images.py.

◆ Rrs

Definition at line 92 of file create_images.py.

◆ sensor

string sensor = 'HICO'

Definition at line 73 of file create_images.py.

◆ slices

slices

Definition at line 96 of file create_images.py.

◆ time_start

time_start = time.time()

Definition at line 87 of file create_images.py.