Пример #1
0
def make_option_d_cmap():
    rgb = np.load(os.path.join(datadir, 'option_d.npy'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'matplotlib option_d'
    cmap.units = '[]'
    cmap.author = 'eric firing'
    return cmap    
Пример #2
0
def make_density_cmap():
    rgb = np.load(os.path.join(datadir, 'Density.npy'))
    cmap = tools.cmap(rgb[::-1], N=256)
    cmap.name = 'Density'
    cmap.units = 'kg/m^3'
    cmap.author = 'kmt'
    return cmap
Пример #3
0
def make_salinity_cmap():
    rgb = np.load(os.path.join(datadir, 'Salinity.npy'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Salinity'
    cmap.units = 'g/kg'
    cmap.author = 'kmt'
    return cmap
Пример #4
0
def make_bathymetry_cmap():  
    rgb = np.load(os.path.join(datadir, 'Bathymetry.npy'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Bathymetry' 
    cmap.units = 'm'
    cmap.author = 'kmt'
    return cmap
Пример #5
0
def make_temperature_cmap():
    rgb = np.load(os.path.join(datadir, 'Temperature.npy'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Temperature'
    cmap.units = 'C'
    cmap.author = 'kmt'
    return cmap
Пример #6
0
def make_CDOM_cmap():
    rgb = np.load(os.path.join(datadir, 'CDOM.npy'))
    cmap = tools.cmap(rgb[::-1], N=256)
    cmap.name = 'CDOM'
    cmap.units = 'mg/m^3'
    cmap.author = 'kmt'
    return cmap
Пример #7
0
def make_speed_cmap():
    rgb = np.load(os.path.join(datadir, 'Speed.npy'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Speed'
    cmap.units = 'm/s'
    cmap.author = 'kmt'
    return cmap
Пример #8
0
def make_PAR_cmap():
    rgb = np.load(os.path.join(datadir, 'PAR.npy'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'PAR'
    cmap.units = 'W/m^2'
    cmap.author = 'kmt'
    return cmap
Пример #9
0
def make_oxygen_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Oxygen-rgb.txt'))
    # # Did the following originally to set up the text file, but now it has already been done.
    # l = rgb.shape[0]
    # num = int(l/5.)
    # # Take last 1/5 of colormap and save since I want it, flipped, at the end, keeping the full lightness range in the middle 3/5
    # yellow = rgb[l-num:, :].copy()
    # # convert .2 to 1.0 of colormap to grayscale
    # # from skimage import color
    # from colorspacious import cspace_converter
    # cam = cspace_converter("sRGB1", "CAM02-UCS")(rgb)
    # # lab = color.rgb2lab(rgb[np.newaxis, :])
    # # gray[:, 0] = 0.2989*rgb[num:, 0] + 0.5870*rgb[num:, 1] + 0.1140*rgb[num:, 2]
    # # gray[:, 1] = gray[:, 0]
    # # gray[:, 2] = gray[:, 0]
    # # Interpolate the gray part to be just the middle 3/5
    # newx = np.linspace(0, 1, rgb[num:l-num, :].shape[0])
    # oldx = np.linspace(0, 1, rgb[num:, :].shape[0])
    # oldgray = cam[num:, 0]/100.
    # # oldgray = lab[0, num:, 0]
    # rgb[num:l-num, 0] = np.interp(newx, oldx, oldgray)
    # rgb[num:l-num, 1] = np.interp(newx, oldx, oldgray)
    # rgb[num:l-num, 2] = np.interp(newx, oldx, oldgray)
    # # Add back in flipped yellow part to be divergent super saturated state
    # rgb[l-num:, :] = yellow[::-1, :]
    # cam[:num, 0] += (cam[:num, 0] - cam[0, 0])*0.3
    # rgb[:num] = cspace_converter("CAM02-UCS", "sRGB1")(cam[:num, :])
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Oxygen'
    cmap.long_name = 'Oxygen'
    cmap.units = 'm/l'
    cmap.author = 'kmt'
    return cmap
Пример #10
0
def make_turbidity_cmap():
    rgb = np.load(os.path.join(datadir, 'Turbidity.npy'))
    cmap = tools.cmap(rgb[::-1], N=256)
    cmap.name = 'Turbidity'
    cmap.units = 'NTU'
    cmap.author = 'kmt'
    return cmap
Пример #11
0
def make_freesurface_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Freesurface-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Free surface'
    cmap.units = 'm'
    cmap.author = 'kmt'
    return cmap
Пример #12
0
def make_oxygen_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Oxygen-rgb.txt'))
    # # Did the following originally to set up the text file, but now it has already been done.
    # l = rgb.shape[0]
    # num = int(l/5.)
    # # Take last 1/5 of colormap and save since I want it, flipped, at the end, keeping the full lightness range in the middle 3/5
    # yellow = rgb[l-num:, :].copy()
    # # convert .2 to 1.0 of colormap to grayscale
    # # from skimage import color
    # from colorspacious import cspace_converter
    # cam = cspace_converter("sRGB1", "CAM02-UCS")(rgb)
    # # lab = color.rgb2lab(rgb[np.newaxis, :])
    # # gray[:, 0] = 0.2989*rgb[num:, 0] + 0.5870*rgb[num:, 1] + 0.1140*rgb[num:, 2]
    # # gray[:, 1] = gray[:, 0]
    # # gray[:, 2] = gray[:, 0]
    # # Interpolate the gray part to be just the middle 3/5
    # newx = np.linspace(0, 1, rgb[num:l-num, :].shape[0])
    # oldx = np.linspace(0, 1, rgb[num:, :].shape[0])
    # oldgray = cam[num:, 0]/100.
    # # oldgray = lab[0, num:, 0]
    # rgb[num:l-num, 0] = np.interp(newx, oldx, oldgray)
    # rgb[num:l-num, 1] = np.interp(newx, oldx, oldgray)
    # rgb[num:l-num, 2] = np.interp(newx, oldx, oldgray)
    # # Add back in flipped yellow part to be divergent super saturated state
    # rgb[l-num:, :] = yellow[::-1, :]
    # cam[:num, 0] += (cam[:num, 0] - cam[0, 0])*0.3
    # rgb[:num] = cspace_converter("CAM02-UCS", "sRGB1")(cam[:num, :])
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Oxygen'
    cmap.long_name = 'Oxygen'
    cmap.units = 'm/l'
    cmap.author = 'kmt'
    return cmap
Пример #13
0
def make_chlorophyll_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Chlorophyll-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    # cmap = tools.cmap(rgb[::-1], N=256)
    cmap.name = 'Chlorophyll'
    cmap.units = 'mg/m^3'
    cmap.author = 'kmt'
    return cmap
Пример #14
0
def make_CDOM_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'CDOM-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'CDOM'
    cmap.long_name = 'Colored Dissolved Organic Matter'
    cmap.units = 'mg/m^3'
    cmap.author = 'kmt'
    return cmap
Пример #15
0
def make_gray_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Gray-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Gray'
    cmap.long_name = 'Gray'
    cmap.units = ''
    cmap.author = 'kmt'
    return cmap
Пример #16
0
def make_phase_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Phase-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Phase'
    cmap.long_name = 'Phase'
    cmap.units = 'degrees'
    cmap.author = 'kmt'
    return cmap
Пример #17
0
def make_phase_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Phase-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Phase'
    cmap.long_name = 'Phase'
    cmap.units = 'degrees'
    cmap.author = 'kmt'
    return cmap
Пример #18
0
def make_PAR_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'PAR-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'PAR'
    cmap.long_name = 'Photosynthetically Available Radiation'
    cmap.units = 'W/m^2'
    cmap.author = 'kmt'
    return cmap
Пример #19
0
def make_PAR_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'PAR-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'PAR'
    cmap.long_name = 'Photosynthetically Available Radiation'
    cmap.units = 'W/m^2'
    cmap.author = 'kmt'
    return cmap
Пример #20
0
def make_CDOM_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'CDOM-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'CDOM'
    cmap.long_name = 'Colored Dissolved Organic Matter'
    cmap.units = 'mg/m^3'
    cmap.author = 'kmt'
    return cmap
Пример #21
0
def make_gray_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Gray-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Gray'
    cmap.long_name = 'Gray'
    cmap.units = ''
    cmap.author = 'kmt'
    return cmap
Пример #22
0
def make_vorticity_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Vorticity-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Vorticity'
    cmap.long_name = 'Vertical Vorticity'
    cmap.units = '1/s'
    cmap.author = 'kmt'
    return cmap
Пример #23
0
def make_vorticity_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Vorticity-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Vorticity'
    cmap.long_name = 'Vertical Vorticity'
    cmap.units = '1/s'
    cmap.author = 'kmt'
    return cmap
Пример #24
0
def make_density_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Density-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Density'
    cmap.long_name = 'Density'
    cmap.units = 'kg/m^3'
    cmap.author = 'kmt'
    return cmap
Пример #25
0
def make_density_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Density-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Density'
    cmap.long_name = 'Density'
    cmap.units = 'kg/m^3'
    cmap.author = 'kmt'
    return cmap
Пример #26
0
def make_CDOM_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "CDOM-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "CDOM"
    cmap.long_name = "Colored Dissolved Organic Matter"
    cmap.units = "mg/m^3"
    cmap.author = "kmt"
    return cmap
Пример #27
0
def make_turbidity_cmap():
    rgb = np.loadtxt(os.path.join(datadir, 'Turbidity-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Turbidity'
    cmap.long_name = 'Turbidity'
    cmap.units = 'NTU'
    cmap.author = 'kmt'
    return cmap
Пример #28
0
def make_temperature_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Temperature-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Temperature"
    cmap.long_name = "Temperature"
    cmap.units = "C"
    cmap.author = "kmt"
    return cmap
Пример #29
0
def make_chlorophyll_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Chlorophyll-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Chlorophyll"
    cmap.long_name = "Chlorophyll"
    cmap.units = "mg/m^3"
    cmap.author = "kmt"
    return cmap
Пример #30
0
def make_gray_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Gray-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Gray"
    cmap.long_name = "Gray"
    cmap.units = ""
    cmap.author = "kmt"
    return cmap
Пример #31
0
def make_salinity_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Salinity-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Salinity"
    cmap.long_name = "Salinity"
    cmap.units = "g/kg"
    cmap.author = "kmt"
    return cmap
Пример #32
0
def make_freesurface_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "FreeSurface-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "FreeSurface"
    cmap.long_name = "Free Surface"
    cmap.units = "m"
    cmap.author = "kmt"
    return cmap
Пример #33
0
def make_phase_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Phase-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Phase"
    cmap.long_name = "Phase"
    cmap.units = "degrees"
    cmap.author = "kmt"
    return cmap
Пример #34
0
def make_bathymetry_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Bathymetry-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Bathymetry"
    cmap.long_name = "Bathymetry"
    cmap.units = "m"
    cmap.author = "kmt"
    return cmap
Пример #35
0
def make_vorticity_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Vorticity-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Vorticity"
    cmap.long_name = "Vertical Vorticity"
    cmap.units = "1/s"
    cmap.author = "kmt"
    return cmap
Пример #36
0
def make_PAR_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "PAR-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "PAR"
    cmap.long_name = "Photosynthetically Available Radiation"
    cmap.units = "W/m^2"
    cmap.author = "kmt"
    return cmap
Пример #37
0
def make_density_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Density-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Density"
    cmap.long_name = "Density"
    cmap.units = "kg/m^3"
    cmap.author = "kmt"
    return cmap
Пример #38
0
def make_turbidity_cmap():
    rgb = np.loadtxt(os.path.join(datadir, "Turbidity-rgb.txt"))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = "Turbidity"
    cmap.long_name = "Turbidity"
    cmap.units = "NTU"
    cmap.author = "kmt"
    return cmap
Пример #39
0
def make_speed_cmap():
    # Uses positive part of velocity colormap
    rgb = np.loadtxt(os.path.join(datadir, 'Speed-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Speed'
    cmap.long_name = 'Speed'
    cmap.units = 'm/s'
    cmap.author = 'kmt'
    return cmap
Пример #40
0
def make_waveheight_cmap():
    # Uses positive part of free surface colormap
    rgb = np.loadtxt(os.path.join(datadir, 'WaveHeight-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'WaveHeight'
    cmap.long_name = 'Wave Height'
    cmap.units = 'meters'
    cmap.author = 'kmt'
    return cmap
Пример #41
0
def make_waveperiod_cmap():
    # Uses negative part of vorticity colormap
    rgb = np.loadtxt(os.path.join(datadir, 'WavePeriod-rgb.txt'))
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'WavePeriod'
    cmap.long_name = 'Wave Period'
    cmap.units = 'seconds'
    cmap.author = 'kmt'
    return cmap
Пример #42
0
def make_oxygen_cmap():
    rgb = np.load(os.path.join(datadir, 'Oxygen.npy'))
    # convert middle .2 to .8 of colormap to grayscale
    l = rgb.shape[0]
    num = l/5.
    rgb[num:l-num,0] = 0.2989*rgb[num:l-num,0] + 0.5870*rgb[num:l-num,1] + 0.1140*rgb[num:l-num,2]
    rgb[num:l-num,1] = rgb[num:l-num,0]
    rgb[num:l-num,2] = rgb[num:l-num,0]
    cmap = tools.cmap(rgb, N=256)
    cmap.name = 'Oxygen'
    cmap.units = 'm/l'
    cmap.author = 'kmt'
    return cmap