Example #1
0
File: plt.py Project: fengw/coseis
def colormap(*args, **kwargs):
    """
    Matplotlib colormap. See viz.colormap for details.
    """
    from matplotlib.colors import LinearSegmentedColormap

    v, r, g, b, a = viz.colormap(*args, **kwargs)
    n = 2001
    cmap = {"red": np.c_[v, r, r], "green": np.c_[v, g, g], "blue": np.c_[v, b, b]}
    cmap = LinearSegmentedColormap("cmap", cmap, n)
    return cmap
Example #2
0
def colormap( *args, **kwargs ):
    """
    Mayavi colormap. See viz.colormap for details.
    """
    cmap = viz.colormap( *args, **kwargs )
    v, r, g, b, a = cmap
    if len( v ) < 1001:
        vi = np.linspace( v[0], v[-1], 2001 )
        r = np.interp( vi, v, r )
        g = np.interp( vi, v, g )
        b = np.interp( vi, v, b )
        a = np.interp( vi, v, a )
        cmap = np.array( [r, g, b, a] )
    return 255 * cmap.T
Example #3
0
def colormap(*args, **kwargs):
    """
    Matplotlib colormap. See viz.colormap for details.
    """
    from matplotlib.colors import LinearSegmentedColormap
    v, r, g, b, a = viz.colormap(*args, **kwargs)
    n = 2001
    cmap = {
        'red': np.c_[v, r, r],
        'green': np.c_[v, g, g],
        'blue': np.c_[v, b, b]
    }
    cmap = LinearSegmentedColormap('cmap', cmap, n)
    return cmap
Example #4
0
    pass

# PARAMETERS -------------------------------------

BIAS = False
ABS_VAL = 0.06  # for trend (ice=0.05, envi=0.06)
width = 1.5  # gaussian width (both=1.5)
GRID_CELL = (1, 5)
#BBOX_REG = (-82, -76.2, -26, -79.5)  # FRIS
BBOX_REG = (-156, -76, 153, -81.6)  # ROSS
#BBOX_REG = (72, -74.2, 68, -67.5)    # AMERY
#BBOX_REG = (-134, -58, 50, -57)       # ANTARCTICA
TITLE = ''
SAVEFIG = 'ross1'
#CMAP = cm.jet_r # cm.gist_rainbow #cm.spectral_r # cm.RdBu_r # cm.jet_r
CMAP = viz.colormap('rgb')
LABEL = 'Elevation change rate (m/yr)'

#-------------------------------------------------

days = np.asarray(
    [dt.datetime.strptime(str(t), '%Y%m%d').toordinal() for t in time2])
year = np.round(days / 365., 2) - .33
print year
'''
k, = np.where((year > 2006.1) & (year < 2012.5))
year = year[k]
dh = dh[k,...]
'''

title = 'FRIS 1992-2012\n(ERS1, ERS2, ENVI)'
Example #5
0
# parameters
ABS_VAL = 0.12  # for trend
#ABS_VAL = 1.5  # for difference
GRID_CELL = (1, 5)
#width = 0.9  # gaussian width
width = 1.5  # gaussian width

BBOX_REG = (-82, -76.2, -26, -79.5)  # FRIS
#BBOX_REG = (-156, -76, 154, -81.2)   # ROSS
#BBOX_REG = (68, -74.5, 70, -67.5)   # AMERY

MFILE = '/Users/fpaolo/data/masks/scripps_antarctica_masks/scripps_antarctica_mask1km_v1.tif'

#CMAP = cm.jet_r # cm.gist_rainbow #cm.spectral_r # cm.RdBu_r # cm.jet_r
CMAP = viz.colormap('rgb')
LABEL = 'm/yr'

title = 'FRIS 1992-2012\n(ERS1, ERS2, ENVI)'
legend = 'Elevation change rate m/yr'
ticklabels = '0', '4', '8 m/yr'
ticks = -ABS_VAL, 0, ABS_VAL 
colormap = [
    (0, 0.001, 2, 3), # value
    (1, 1, 1, 1), # red
    (0, 0, 1, 1), # green
    (0, 0, 0, 1), # blue
    (0, 1, 1, 1), # alpha
]
colorexp = 1.0
colorlim = ticks[0], ticks[-1]