ocssw V2020
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)
 

Variables

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
 
 refl = xr.load_dataset(filepath,group='/reflectance')['toa_reflectance']
 
 bluec = refl[bc,:,:]
 
 greenc = refl[gc,:,:]
 
 redc = refl[rc,:,:]
 
 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)
 
 ae = xr.load_dataset(filepath,group='/geophysical_data')['ae'][0,:,:].values
 
 aot = xr.load_dataset(filepath,group='/geophysical_data')['aot_550'][:,:].values
 
 fmf = xr.load_dataset(filepath,group='/geophysical_data')['fmf'][:,:].values
 
 err = xr.load_dataset(filepath,group='/geophysical_data')['residual_error'][:,:].values
 
 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("/")
 
string outfilename = x + "_" + set[2] + "_" + colors + ".png"
 
string image_path = dtdb_dirpath + "/IMAGES"
 
string outpath = image_path + "/" + outfilename
 
string path = image_path + "_ae"
 
float maxa = 2.0
 
float mina = -1.0
 
tuple aep = (ae - mina)/(maxa - mina)
 
 ml = mpl.cm.ScalarMappable(norm=None, cmap='nipy_spectral')
 
 aec = ml.to_rgba(aep, alpha=None)
 
 fig = plt.figure(facecolor='k')
 
 resize
 
 ax = fig.add_axes([0.94, 0.1, 0.012, 0.8], frameon=True)
 
 cbar = fig.colorbar(ml, ax=ax, cax=ax)
 
 labelsize
 
 length
 
 width
 
 pad
 
 right
 
 color
 
 size
 
 facecolor
 
tuple aotp = (aot - mina)/(maxa - mina)
 
 aotc = ml.to_rgba(aotp, alpha=None, bytes=True, norm=False)
 
tuple fmfp = (fmf - mina)/(maxa - mina)
 
 fmfc = ml.to_rgba(fmfp, alpha=None, bytes=True, norm=False)
 
tuple errp = (err - mina)/(maxa - mina)
 
 errc = ml.to_rgba(errp, alpha=None, bytes=True, norm=False)
 

Function Documentation

◆ histeq()

def color_dtdb.histeq (   im,
  nbr_bins = 256 
)

Definition at line 71 of file color_dtdb.py.

◆ pseudocolor()

def color_dtdb.pseudocolor (   val,
  minval,
  maxval 
)

Definition at line 94 of file color_dtdb.py.

◆ rgb2ycbcr()

def color_dtdb.rgb2ycbcr (   r,
  g,
  b 
)

Definition at line 29 of file color_dtdb.py.

◆ rgb2ycbcr2()

def color_dtdb.rgb2ycbcr2 (   r,
  g,
  b 
)

Definition at line 58 of file color_dtdb.py.

◆ rgb2yuv()

def color_dtdb.rgb2yuv (   r,
  g,
  b 
)

Definition at line 45 of file color_dtdb.py.

◆ ycbcr2rgb()

def color_dtdb.ycbcr2rgb (   y,
  cb,
  cr 
)

Definition at line 35 of file color_dtdb.py.

◆ ycbcr2rgb2()

def color_dtdb.ycbcr2rgb2 (   y,
  pb,
  pr 
)

Definition at line 64 of file color_dtdb.py.

◆ yuv2rgb()

def color_dtdb.yuv2rgb (   y,
  u,
  v 
)

Definition at line 51 of file color_dtdb.py.

Variable Documentation

◆ ae

ae = xr.load_dataset(filepath,group='/geophysical_data')['ae'][0,:,:].values

Definition at line 168 of file color_dtdb.py.

◆ aec

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

Definition at line 255 of file color_dtdb.py.

◆ aep

tuple aep = (ae - mina)/(maxa - mina)

Definition at line 252 of file color_dtdb.py.

◆ aot

aot = xr.load_dataset(filepath,group='/geophysical_data')['aot_550'][:,:].values

Definition at line 169 of file color_dtdb.py.

◆ aotc

aotc = ml.to_rgba(aotp, alpha=None, bytes=True, norm=False)

Definition at line 282 of file color_dtdb.py.

◆ aotp

tuple aotp = (aot - mina)/(maxa - mina)

Definition at line 279 of file color_dtdb.py.

◆ args

args = sys.argv

Definition at line 103 of file color_dtdb.py.

◆ ax

ax = fig.add_axes([0.94, 0.1, 0.012, 0.8], frameon=True)

Definition at line 260 of file color_dtdb.py.

◆ bc

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

Definition at line 111 of file color_dtdb.py.

◆ bg

bg = np.power(bo, ga)

Definition at line 206 of file color_dtdb.py.

◆ bluec

bluec = refl[bc,:,:]

Definition at line 141 of file color_dtdb.py.

◆ bo

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

Definition at line 179 of file color_dtdb.py.

◆ cbar

cbar = fig.colorbar(ml, ax=ax, cax=ax)

Definition at line 261 of file color_dtdb.py.

◆ cldmsk

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

Definition at line 155 of file color_dtdb.py.

◆ cldtst

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

Definition at line 156 of file color_dtdb.py.

◆ color

color

Definition at line 264 of file color_dtdb.py.

◆ colors

string colors = "123"

Definition at line 108 of file color_dtdb.py.

◆ command

string command = "date > " + logfile

Definition at line 122 of file color_dtdb.py.

◆ dataset

dataset = args[2]

Definition at line 106 of file color_dtdb.py.

◆ dtdb_dircontents

dtdb_dircontents = os.listdir(dtdb_dirpath)

Definition at line 125 of file color_dtdb.py.

◆ dtdb_dirpath

dtdb_dirpath = args[1]

Definition at line 105 of file color_dtdb.py.

◆ err

err = xr.load_dataset(filepath,group='/geophysical_data')['residual_error'][:,:].values

Definition at line 171 of file color_dtdb.py.

◆ errc

errc = ml.to_rgba(errp, alpha=None, bytes=True, norm=False)

Definition at line 330 of file color_dtdb.py.

◆ errp

tuple errp = (err - mina)/(maxa - mina)

Definition at line 327 of file color_dtdb.py.

◆ facecolor

facecolor

Definition at line 266 of file color_dtdb.py.

◆ fig

fig = plt.figure(facecolor='k')

Definition at line 257 of file color_dtdb.py.

◆ filepath

string filepath = dtdb_dirpath + "/" + x

Definition at line 133 of file color_dtdb.py.

◆ fmf

fmf = xr.load_dataset(filepath,group='/geophysical_data')['fmf'][:,:].values

Definition at line 170 of file color_dtdb.py.

◆ fmfc

fmfc = ml.to_rgba(fmfp, alpha=None, bytes=True, norm=False)

Definition at line 306 of file color_dtdb.py.

◆ fmfp

tuple fmfp = (fmf - mina)/(maxa - mina)

Definition at line 303 of file color_dtdb.py.

◆ ga

float ga = np.ones_like(ro)*gamma

Definition at line 203 of file color_dtdb.py.

◆ gamma

float gamma = 1.0

Definition at line 202 of file color_dtdb.py.

◆ gc

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

Definition at line 112 of file color_dtdb.py.

◆ gg

gg = np.power(go, ga)

Definition at line 205 of file color_dtdb.py.

◆ go

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

Definition at line 178 of file color_dtdb.py.

◆ greenc

greenc = refl[gc,:,:]

Definition at line 142 of file color_dtdb.py.

◆ im_blue

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

Definition at line 217 of file color_dtdb.py.

◆ im_green

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

Definition at line 216 of file color_dtdb.py.

◆ im_red

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

Definition at line 215 of file color_dtdb.py.

◆ im_rgb

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

Definition at line 219 of file color_dtdb.py.

◆ image_path

string image_path = dtdb_dirpath + "/IMAGES"

Definition at line 225 of file color_dtdb.py.

◆ Kb

float Kb = 0.114

Definition at line 23 of file color_dtdb.py.

◆ Kr

float Kr = 0.299

Definition at line 24 of file color_dtdb.py.

◆ labelsize

labelsize

Definition at line 262 of file color_dtdb.py.

◆ land

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

Definition at line 146 of file color_dtdb.py.

◆ length

length

Definition at line 262 of file color_dtdb.py.

◆ logfile

logfile = ""

Definition at line 119 of file color_dtdb.py.

◆ maxa

float maxa = 2.0

Definition at line 249 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 197 of file color_dtdb.py.

◆ mina

float mina = -1.0

Definition at line 250 of file color_dtdb.py.

◆ mino_all

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

Definition at line 193 of file color_dtdb.py.

◆ ml

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

Definition at line 253 of file color_dtdb.py.

◆ nomask

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

Definition at line 160 of file color_dtdb.py.

◆ ocean

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

Definition at line 145 of file color_dtdb.py.

◆ outfilename

string outfilename = x + "_" + set[2] + "_" + colors + ".png"

Definition at line 223 of file color_dtdb.py.

◆ outpath

string outpath = image_path + "/" + outfilename

Definition at line 235 of file color_dtdb.py.

◆ pad

pad

Definition at line 262 of file color_dtdb.py.

◆ path

string path = image_path + "_ae"

Definition at line 245 of file color_dtdb.py.

◆ rc

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

Definition at line 113 of file color_dtdb.py.

◆ redc

redc = refl[rc,:,:]

Definition at line 143 of file color_dtdb.py.

◆ refl

refl = xr.load_dataset(filepath,group='/reflectance')['toa_reflectance']

Definition at line 140 of file color_dtdb.py.

◆ resize

resize

Definition at line 258 of file color_dtdb.py.

◆ result

result = os.system(command)

Definition at line 123 of file color_dtdb.py.

◆ rg

rg = np.power(ro, ga)

Definition at line 204 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 26 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 42 of file color_dtdb.py.

◆ right

right

Definition at line 262 of file color_dtdb.py.

◆ ro

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

Definition at line 177 of file color_dtdb.py.

◆ scale

int scale = 255

Definition at line 214 of file color_dtdb.py.

◆ set

set = dataset.partition("/")

Definition at line 222 of file color_dtdb.py.

◆ size

size

Definition at line 264 of file color_dtdb.py.

◆ u

u

Definition at line 185 of file color_dtdb.py.

◆ v

v

Definition at line 185 of file color_dtdb.py.

◆ width

width

Definition at line 262 of file color_dtdb.py.

◆ y

y = y/np.max(y)

Definition at line 185 of file color_dtdb.py.

◆ Y_cdf

Y_cdf

Definition at line 188 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 27 of file color_dtdb.py.

◆ yg

yg = np.power(yh, ga)

Definition at line 207 of file color_dtdb.py.

◆ yh

yh

Definition at line 188 of file color_dtdb.py.

◆ ys

ys = np.divide(yg,y)

Definition at line 209 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 43 of file color_dtdb.py.