OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
color_dtdb Namespace Reference

Functions

def rgb2ycbcr (r, g, b)
 
def ycbcr2rgb (y, cb, cr)
 
def rgb2yuv (r, g, b)
 
def yuv2rgb (y, u, v)
 
def rgb2ycbcr2 (r, g, b)
 
def ycbcr2rgb2 (y, pb, pr)
 
def histeq (im, nbr_bins=256)
 
def pseudocolor (val, minval, maxval)
 
def plot_scalar_array (ds_str, title_str, mina, maxa)
 
def plot_rgb ()
 

Variables

int W410 = 0
 
int W445 = 1
 
int W490 = 2
 
int W550 = 3
 
int W670 = 4
 
int W865 = 5
 
int W1240 = 6
 
int W1610 = 7
 
int W2250 = 8
 
int NWL = 9
 
list wlstr = ["410","445","490","550","670","865","1240","1610","2250"]
 
float Kb = 0.114
 
float Kr = 0.299
 
 RGB2YCbCr = np.array([[0.257, 0.504, 0.098],[-0.148, -0.291, 0.439],[0.439, -0.368, -0.071]])
 
 YCbCr2RGB = np.array([[1.0, 0.0, 1.596],[1.0, -0.392, -0.813],[1.0, 2.017, 0.0]])
 
 RGB2YUV = np.array([[0.299, 0.587, 0.114],[-0.14713, -0.28886, 0.436],[0.615, -0.51499, -0.10001]])
 
 YUV2RGB = np.array([[1.0, 0.0, 1.13983],[1.0, -0.39465, -0.58060],[1.0, 2.03211, 0.0]])
 
 args = sys.argv
 
 dtdb_dirpath = args[1]
 
 dataset = args[2]
 
string colors = "123"
 
int bc = np.int(args[3][0])-1
 
int gc = np.int(args[3][1])-1
 
int rc = np.int(args[3][2])-1
 
string logfile = ""
 
string command = "date > " + logfile
 
 result = os.system(command)
 
 dtdb_dircontents = os.listdir(dtdb_dirpath)
 
string filepath = dtdb_dirpath + "/" + x
 
string image_path = dtdb_dirpath + "/IMAGES"
 
string outfilename = x + "_" + dname + ".png"
 
string path = image_path + "_" + dname
 
string outpath = path + "/" + outfilename
 
string title_str = ' Angstrom Exponent'
 
string ds_str = 'ae'
 
float maxa = 2.0
 
float mina = 0.0
 
string image_path1 = image_path + "/histograms"
 
string outfilename1 = x + "_hist_410.png"
 
string outpath1 = image_path1 + "/" + outfilename1
 
string image_path2 = image_path + "/maps"
 
string outfilename2 = x + "_map.png"
 
string outpath2 = image_path2 + "/" + outfilename2
 
list ct = [3200,3200]
 
list st = [0,0]
 
int refwl = W865
 
int refbs = W410
 
int nbins = 100
 
int hmin = 0
 
int hmax = 10
 
float max0 = 0.0
 
float min0 = -2.0
 
float max1 = 2.5
 
float min1 = -0.5
 
 hist = np.zeros((NWL, nbins, nbins))
 
 cmap = cm.get_cmap('turbo')
 
 fig1 = plt.figure(figsize=(16,10))
 
 fig2 = plt.figure(figsize=(16,8))
 
def irgb = plot_rgb()
 
 ax2 = fig2.add_subplot(2,4,1)
 
 rfl0 = xr.load_dataset(filepath,group='/observations')['rhot_'+wlstr[refwl]].values[st[0]:st[0]+ct[0],st[1]:st[1]+ct[1]]
 
 lrfl0 = np.log10(np.clip(rfl0, a_min=0.0001, a_max=1.0))
 
 rflbs = xr.load_dataset(filepath,group='/observations')['rhot_'+wlstr[refbs]].values[st[0]:st[0]+ct[0],st[1]:st[1]+ct[1]]
 
 lrflbs = np.log10(np.clip(rflbs, a_min=0.0001, a_max=1.0))
 
 ml = mpl.cm.ScalarMappable(norm=None, cmap=cmap)
 
 aec = ml.to_rgba(lrfl0, alpha=None)
 
int wl1 = 1
 
int wl2 = 1
 
bool bwl2 = False
 
 rfl1 = xr.load_dataset(filepath,group='/observations')['rhot_'+wlstr[wl]].values[st[0]:st[0]+ct[0],st[1]:st[1]+ct[1]]
 
 lrfl1 = lrflbs - np.log10(np.clip(rfl1, a_min=0.0001, a_max=1.0))
 
 edges
 
 range
 
 bins
 
 density
 
 ax1 = fig1.add_subplot(2,4,wl1)
 
 xpos0
 
 ypos0
 
 cp1 = ax1.contourf(xpos0/2, ypos0/2, np.clip(hist[wl].T, a_min=hmin, a_max=hmax), levels=100, cmap=cmap)
 
bool bticks = True
 
 labelleft
 
 left
 
 b
 
 True
 
 which
 
 color
 
 linestyle
 
 alpha
 
 facecolor
 
 loc = plt.LinearLocator(11)
 
 tvals = loc.tick_values(hmin, hmax)
 
 bottom
 
 top
 
 right
 
 wspace
 
 hspace
 
 cb_ax = fig1.add_axes([0.93, 0.1, 0.02, 0.8])
 
 cax
 
 ticks
 
 bluec = xr.load_dataset(filepath,group='/observations',mask_and_scale=True)['rhot_490'].values
 
 greenc = xr.load_dataset(filepath,group='/observations',mask_and_scale=True)['rhot_550'].values
 
 redc = xr.load_dataset(filepath,group='/observations',mask_and_scale=True)['rhot_670'].values
 
 ocean = xr.load_dataset(filepath,group='/geophysical_data')['AOT_ocean']
 
 land = xr.load_dataset(filepath,group='/geophysical_data')['AOT_land']
 
 cldmsk = xr.load_dataset(filepath,group='/meteorology')['cloud_mask']
 
 cldtst = xr.load_dataset(filepath,group='/quality')['cloud_test']
 
 nomask = np.zeros_like(cldmsk, dtype=np.int16)
 
 ro = np.clip(np.nan_to_num(redc),0,10.0)
 
 go = np.clip(np.nan_to_num(greenc),0,10.0)
 
 bo = np.clip(np.nan_to_num(bluec),0,10.0)
 
 y = y/np.max(y)
 
 u
 
 v
 
 yh
 
 Y_cdf
 
 mino_all = min(np.min(ro), np.min(go), np.min(bo))
 
float maxo_all = max(np.max(ro), np.max(go), np.max(bo)) + 0.001
 
float gamma = 1.0
 
float ga = np.ones_like(ro)*gamma
 
 rg = np.power(ro, ga)
 
 gg = np.power(go, ga)
 
 bg = np.power(bo, ga)
 
 yg = np.power(yh, ga)
 
 ys = np.divide(yg,y)
 
int scale = 255
 
 im_red = im.fromarray(np.uint8(np.clip(rg,0,1.0)*scale))
 
 im_green = im.fromarray(np.uint8(np.clip(gg,0,1.0)*scale))
 
 im_blue = im.fromarray(np.uint8(np.clip(bg,0,1.0)*scale))
 
 im_rgb = im.merge("RGB", (im_red, im_green, im_blue))
 
 set = dataset.partition("/")
 

Function Documentation

◆ histeq()

def color_dtdb.histeq (   im,
  nbr_bins = 256 
)

Definition at line 84 of file color_dtdb.py.

◆ plot_rgb()

def color_dtdb.plot_rgb ( )

Definition at line 136 of file color_dtdb.py.

◆ plot_scalar_array()

def color_dtdb.plot_scalar_array (   ds_str,
  title_str,
  mina,
  maxa 
)

Definition at line 113 of file color_dtdb.py.

◆ pseudocolor()

def color_dtdb.pseudocolor (   val,
  minval,
  maxval 
)

Definition at line 107 of file color_dtdb.py.

◆ rgb2ycbcr()

def color_dtdb.rgb2ycbcr (   r,
  g,
  b 
)

Definition at line 42 of file color_dtdb.py.

◆ rgb2ycbcr2()

def color_dtdb.rgb2ycbcr2 (   r,
  g,
  b 
)

Definition at line 71 of file color_dtdb.py.

◆ rgb2yuv()

def color_dtdb.rgb2yuv (   r,
  g,
  b 
)

Definition at line 58 of file color_dtdb.py.

◆ ycbcr2rgb()

def color_dtdb.ycbcr2rgb (   y,
  cb,
  cr 
)

Definition at line 48 of file color_dtdb.py.

◆ ycbcr2rgb2()

def color_dtdb.ycbcr2rgb2 (   y,
  pb,
  pr 
)

Definition at line 77 of file color_dtdb.py.

◆ yuv2rgb()

def color_dtdb.yuv2rgb (   y,
  u,
  v 
)

Definition at line 64 of file color_dtdb.py.

Variable Documentation

◆ aec

aec = ml.to_rgba(lrfl0, alpha=None)

Definition at line 305 of file color_dtdb.py.

◆ alpha

alpha

Definition at line 352 of file color_dtdb.py.

◆ args

args = sys.argv

Definition at line 177 of file color_dtdb.py.

◆ ax1

ax1 = fig1.add_subplot(2,4,wl1)

Definition at line 338 of file color_dtdb.py.

◆ ax2

ax2 = fig2.add_subplot(2,4,1)

Definition at line 290 of file color_dtdb.py.

◆ b

b

Definition at line 350 of file color_dtdb.py.

◆ bc

int bc = np.int(args[3][0])-1

Definition at line 185 of file color_dtdb.py.

◆ bg

bg = np.power(bo, ga)

Definition at line 451 of file color_dtdb.py.

◆ bins

bins

Definition at line 331 of file color_dtdb.py.

◆ bluec

bluec = xr.load_dataset(filepath,group='/observations',mask_and_scale=True)['rhot_490'].values

Definition at line 391 of file color_dtdb.py.

◆ bo

bo = np.clip(np.nan_to_num(bluec),0,10.0)

Definition at line 424 of file color_dtdb.py.

◆ bottom

bottom

Definition at line 376 of file color_dtdb.py.

◆ bticks

bool bticks = True

Definition at line 345 of file color_dtdb.py.

◆ bwl2

bool bwl2 = False

Definition at line 317 of file color_dtdb.py.

◆ cax

cax

Definition at line 378 of file color_dtdb.py.

◆ cb_ax

cb_ax = fig1.add_axes([0.93, 0.1, 0.02, 0.8])

Definition at line 377 of file color_dtdb.py.

◆ cldmsk

cldmsk = xr.load_dataset(filepath,group='/meteorology')['cloud_mask']

Definition at line 405 of file color_dtdb.py.

◆ cldtst

cldtst = xr.load_dataset(filepath,group='/quality')['cloud_test']

Definition at line 406 of file color_dtdb.py.

◆ cmap

cmap = cm.get_cmap('turbo')

Definition at line 285 of file color_dtdb.py.

◆ color

color

Definition at line 350 of file color_dtdb.py.

◆ colors

string colors = "123"

Definition at line 182 of file color_dtdb.py.

◆ command

string command = "date > " + logfile

Definition at line 196 of file color_dtdb.py.

◆ cp1

cp1 = ax1.contourf(xpos0/2, ypos0/2, np.clip(hist[wl].T, a_min=hmin, a_max=hmax), levels=100, cmap=cmap)

Definition at line 340 of file color_dtdb.py.

◆ ct

list ct = [3200,3200]

Definition at line 272 of file color_dtdb.py.

◆ dataset

dataset = args[2]

Definition at line 180 of file color_dtdb.py.

◆ density

density

Definition at line 331 of file color_dtdb.py.

◆ ds_str

string ds_str = 'ae'

Definition at line 228 of file color_dtdb.py.

◆ dtdb_dircontents

dtdb_dircontents = os.listdir(dtdb_dirpath)

Definition at line 199 of file color_dtdb.py.

◆ dtdb_dirpath

dtdb_dirpath = args[1]

Definition at line 179 of file color_dtdb.py.

◆ edges

edges

Definition at line 331 of file color_dtdb.py.

◆ facecolor

facecolor

Definition at line 367 of file color_dtdb.py.

◆ fig1

fig1 = plt.figure(figsize=(16,10))

Definition at line 286 of file color_dtdb.py.

◆ fig2

fig2 = plt.figure(figsize=(16,8))

Definition at line 287 of file color_dtdb.py.

◆ filepath

string filepath = dtdb_dirpath + "/" + x

Definition at line 207 of file color_dtdb.py.

◆ ga

float ga = np.ones_like(ro)*gamma

Definition at line 448 of file color_dtdb.py.

◆ gamma

float gamma = 1.0

Definition at line 447 of file color_dtdb.py.

◆ gc

int gc = np.int(args[3][1])-1

Definition at line 186 of file color_dtdb.py.

◆ gg

gg = np.power(go, ga)

Definition at line 450 of file color_dtdb.py.

◆ go

go = np.clip(np.nan_to_num(greenc),0,10.0)

Definition at line 423 of file color_dtdb.py.

◆ greenc

greenc = xr.load_dataset(filepath,group='/observations',mask_and_scale=True)['rhot_550'].values

Definition at line 392 of file color_dtdb.py.

◆ hist

hist = np.zeros((NWL, nbins, nbins))

Definition at line 284 of file color_dtdb.py.

◆ hmax

int hmax = 10

Definition at line 279 of file color_dtdb.py.

◆ hmin

int hmin = 0

Definition at line 278 of file color_dtdb.py.

◆ hspace

hspace

Definition at line 376 of file color_dtdb.py.

◆ im_blue

im_blue = im.fromarray(np.uint8(np.clip(bg,0,1.0)*scale))

Definition at line 462 of file color_dtdb.py.

◆ im_green

im_green = im.fromarray(np.uint8(np.clip(gg,0,1.0)*scale))

Definition at line 461 of file color_dtdb.py.

◆ im_red

im_red = im.fromarray(np.uint8(np.clip(rg,0,1.0)*scale))

Definition at line 460 of file color_dtdb.py.

◆ im_rgb

im_rgb = im.merge("RGB", (im_red, im_green, im_blue))

Definition at line 464 of file color_dtdb.py.

◆ image_path

string image_path = dtdb_dirpath + "/IMAGES"

Definition at line 213 of file color_dtdb.py.

◆ image_path1

string image_path1 = image_path + "/histograms"

Definition at line 262 of file color_dtdb.py.

◆ image_path2

string image_path2 = image_path + "/maps"

Definition at line 267 of file color_dtdb.py.

◆ irgb

def irgb = plot_rgb()

Definition at line 289 of file color_dtdb.py.

◆ Kb

float Kb = 0.114

Definition at line 36 of file color_dtdb.py.

◆ Kr

float Kr = 0.299

Definition at line 37 of file color_dtdb.py.

◆ labelleft

labelleft

Definition at line 349 of file color_dtdb.py.

◆ land

land = xr.load_dataset(filepath,group='/geophysical_data')['AOT_land']

Definition at line 396 of file color_dtdb.py.

◆ left

left

Definition at line 349 of file color_dtdb.py.

◆ linestyle

linestyle

Definition at line 350 of file color_dtdb.py.

◆ loc

loc = plt.LinearLocator(11)

Definition at line 372 of file color_dtdb.py.

◆ logfile

logfile = ""

Definition at line 193 of file color_dtdb.py.

◆ lrfl0

lrfl0 = np.log10(np.clip(rfl0, a_min=0.0001, a_max=1.0))

Definition at line 297 of file color_dtdb.py.

◆ lrfl1

lrfl1 = lrflbs - np.log10(np.clip(rfl1, a_min=0.0001, a_max=1.0))

Definition at line 328 of file color_dtdb.py.

◆ lrflbs

lrflbs = np.log10(np.clip(rflbs, a_min=0.0001, a_max=1.0))

Definition at line 299 of file color_dtdb.py.

◆ max0

float max0 = 0.0

Definition at line 280 of file color_dtdb.py.

◆ max1

float max1 = 2.5

Definition at line 282 of file color_dtdb.py.

◆ maxa

float maxa = 2.0

Definition at line 229 of file color_dtdb.py.

◆ maxo_all

float maxo_all = max(np.max(ro), np.max(go), np.max(bo)) + 0.001

Definition at line 442 of file color_dtdb.py.

◆ min0

float min0 = -2.0

Definition at line 281 of file color_dtdb.py.

◆ min1

float min1 = -0.5

Definition at line 283 of file color_dtdb.py.

◆ mina

float mina = 0.0

Definition at line 230 of file color_dtdb.py.

◆ mino_all

mino_all = min(np.min(ro), np.min(go), np.min(bo))

Definition at line 438 of file color_dtdb.py.

◆ ml

ml = mpl.cm.ScalarMappable(norm=None, cmap=cmap)

Definition at line 302 of file color_dtdb.py.

◆ nbins

nbins = 100

Definition at line 277 of file color_dtdb.py.

◆ nomask

nomask = np.zeros_like(cldmsk, dtype=np.int16)

Definition at line 410 of file color_dtdb.py.

◆ NWL

int NWL = 9

Definition at line 32 of file color_dtdb.py.

◆ ocean

ocean = xr.load_dataset(filepath,group='/geophysical_data')['AOT_ocean']

Definition at line 395 of file color_dtdb.py.

◆ outfilename

string outfilename = x + "_" + dname + ".png"

Definition at line 220 of file color_dtdb.py.

◆ outfilename1

string outfilename1 = x + "_hist_410.png"

Definition at line 263 of file color_dtdb.py.

◆ outfilename2

string outfilename2 = x + "_map.png"

Definition at line 268 of file color_dtdb.py.

◆ outpath

string outpath = path + "/" + outfilename

Definition at line 224 of file color_dtdb.py.

◆ outpath1

outpath1 = image_path1 + "/" + outfilename1

Definition at line 266 of file color_dtdb.py.

◆ outpath2

outpath2 = image_path2 + "/" + outfilename2

Definition at line 271 of file color_dtdb.py.

◆ path

string path = image_path + "_" + dname

Definition at line 221 of file color_dtdb.py.

◆ range

range

Definition at line 331 of file color_dtdb.py.

◆ rc

int rc = np.int(args[3][2])-1

Definition at line 187 of file color_dtdb.py.

◆ redc

redc = xr.load_dataset(filepath,group='/observations',mask_and_scale=True)['rhot_670'].values

Definition at line 393 of file color_dtdb.py.

◆ refbs

int refbs = W410

Definition at line 276 of file color_dtdb.py.

◆ refwl

int refwl = W865

Definition at line 275 of file color_dtdb.py.

◆ result

result = os.system(command)

Definition at line 197 of file color_dtdb.py.

◆ rfl0

rfl0 = xr.load_dataset(filepath,group='/observations')['rhot_'+wlstr[refwl]].values[st[0]:st[0]+ct[0],st[1]:st[1]+ct[1]]

Definition at line 296 of file color_dtdb.py.

◆ rfl1

rfl1 = xr.load_dataset(filepath,group='/observations')['rhot_'+wlstr[wl]].values[st[0]:st[0]+ct[0],st[1]:st[1]+ct[1]]

Definition at line 327 of file color_dtdb.py.

◆ rflbs

rflbs = xr.load_dataset(filepath,group='/observations')['rhot_'+wlstr[refbs]].values[st[0]:st[0]+ct[0],st[1]:st[1]+ct[1]]

Definition at line 298 of file color_dtdb.py.

◆ rg

rg = np.power(ro, ga)

Definition at line 449 of file color_dtdb.py.

◆ RGB2YCbCr

RGB2YCbCr = np.array([[0.257, 0.504, 0.098],[-0.148, -0.291, 0.439],[0.439, -0.368, -0.071]])

Definition at line 39 of file color_dtdb.py.

◆ RGB2YUV

RGB2YUV = np.array([[0.299, 0.587, 0.114],[-0.14713, -0.28886, 0.436],[0.615, -0.51499, -0.10001]])

Definition at line 55 of file color_dtdb.py.

◆ right

right

Definition at line 376 of file color_dtdb.py.

◆ ro

ro = np.clip(np.nan_to_num(redc),0,10.0)

Definition at line 422 of file color_dtdb.py.

◆ scale

int scale = 255

Definition at line 459 of file color_dtdb.py.

◆ set

set = dataset.partition("/")

Definition at line 467 of file color_dtdb.py.

◆ st

list st = [0,0]

Definition at line 273 of file color_dtdb.py.

◆ ticks

ticks

Definition at line 378 of file color_dtdb.py.

◆ title_str

string title_str = ' Angstrom Exponent'

Definition at line 227 of file color_dtdb.py.

◆ top

top

Definition at line 376 of file color_dtdb.py.

◆ True

True

Definition at line 350 of file color_dtdb.py.

◆ tvals

tvals = loc.tick_values(hmin, hmax)

Definition at line 373 of file color_dtdb.py.

◆ u

u

Definition at line 430 of file color_dtdb.py.

◆ v

v

Definition at line 430 of file color_dtdb.py.

◆ W1240

int W1240 = 6

Definition at line 29 of file color_dtdb.py.

◆ W1610

int W1610 = 7

Definition at line 30 of file color_dtdb.py.

◆ W2250

int W2250 = 8

Definition at line 31 of file color_dtdb.py.

◆ W410

int W410 = 0

Definition at line 23 of file color_dtdb.py.

◆ W445

int W445 = 1

Definition at line 24 of file color_dtdb.py.

◆ W490

int W490 = 2

Definition at line 25 of file color_dtdb.py.

◆ W550

int W550 = 3

Definition at line 26 of file color_dtdb.py.

◆ W670

int W670 = 4

Definition at line 27 of file color_dtdb.py.

◆ W865

int W865 = 5

Definition at line 28 of file color_dtdb.py.

◆ which

which

Definition at line 350 of file color_dtdb.py.

◆ wl1

int wl1 = 1

Definition at line 315 of file color_dtdb.py.

◆ wl2

int wl2 = 1

Definition at line 316 of file color_dtdb.py.

◆ wlstr

list wlstr = ["410","445","490","550","670","865","1240","1610","2250"]

Definition at line 34 of file color_dtdb.py.

◆ wspace

wspace

Definition at line 376 of file color_dtdb.py.

◆ xpos0

xpos0

Definition at line 339 of file color_dtdb.py.

◆ y

y = y/np.max(y)

Definition at line 430 of file color_dtdb.py.

◆ Y_cdf

Y_cdf

Definition at line 433 of file color_dtdb.py.

◆ YCbCr2RGB

YCbCr2RGB = np.array([[1.0, 0.0, 1.596],[1.0, -0.392, -0.813],[1.0, 2.017, 0.0]])

Definition at line 40 of file color_dtdb.py.

◆ yg

yg = np.power(yh, ga)

Definition at line 452 of file color_dtdb.py.

◆ yh

yh

Definition at line 433 of file color_dtdb.py.

◆ ypos0

ypos0

Definition at line 339 of file color_dtdb.py.

◆ ys

ys = np.divide(yg,y)

Definition at line 454 of file color_dtdb.py.

◆ YUV2RGB

YUV2RGB = np.array([[1.0, 0.0, 1.13983],[1.0, -0.39465, -0.58060],[1.0, 2.03211, 0.0]])

Definition at line 56 of file color_dtdb.py.