コード例 #1
0
def wks_setting(res):
    image_name = "Shimen_topography"
    wks_type = "png"
    print("\033[44m---Plot: {}.{} ---\033[0m".format(image_name,wks_type))
    rlist = Ngl.Resources()
    rlist.wkWidth  = 3000 #page resolution
    rlist.wkHeight = 3000
    wks = Ngl.open_wks(wks_type,image_name,rlist)
    '''
    cmap = Ngl.read_colormap_file("MPL_terrain")
    cmap1 = []
    for cp in cmap:
        print(cp)
        print('---')
        #print(str(cp).replace('[','').replace(']','').replace('  ',' ').strip().split(' '))
        dum = str(cp).replace('[','').replace(']','').strip()
        dum = dum.replace('       ',' ').replace('   ',' ').replace('  ',' ')
        dum = dum.replace(' ',',').split(',')[0:3]
        print(dum)
        cmap1.append(dum)
    cmap1 = [[1,1,1],[0,0,0]]+[cmap1[0]]+ cmap1[30:len(cmap1)]
    print(cmap1)
    cmap1 = np.float32(cmap1)
    print(cmap1)
    #cmap1 = np.concatenate(([cmap[0]], cmap[30:]), axis=0)
    #print(len(cmap1))
    #print(cmap1)
    #Ngl.define_colormap(wks, cmap1 )
    '''
    Ngl.define_colormap(wks, colorbar_tables.TW_terrain())
    #Ngl.define_colormap(wks, "MPL_terrain")
    res.nglMaximize = True
    res.nglDraw  = False; res.nglFrame = False
    #res.vpWidthF = 0.74; res.vpHeightF = 0.54
    return wks, res
コード例 #2
0
def wks_setting(res):
    image_name = "Falcon_track_20191031"
    wks_type = "png"
    print("\033[44m---Plot: {}.{} ---\033[0m".format(image_name,wks_type))
    rlist = Ngl.Resources()
    rlist.wkWidth  = 3000 #page resolution
    rlist.wkHeight = 3000
    wks = Ngl.open_wks(wks_type,image_name,rlist)
    Ngl.define_colormap(wks, colorbar_tables.TW_terrain())
    #Ngl.define_colormap(wks, "MPL_terrain")
    res.nglMaximize = True
    res.nglDraw  = False; res.nglFrame = False
    #res.vpWidthF = 0.74; res.vpHeightF = 0.54
    return wks, res
コード例 #3
0
def wks_setting(res, vn):
    image_name = "{}_timeseries_Falcon_20190603".format(vn)
    wks_type = "png"
    print("\033[44m---Plot: {}.{} ---\033[0m".format(image_name, wks_type))
    rlist = Ngl.Resources()
    rlist.wkWidth = 3000  #page resolution
    rlist.wkHeight = 3000
    wks = Ngl.open_wks(wks_type, image_name, rlist)
    Ngl.define_colormap(wks, colorbar_tables.TW_terrain())
    #Ngl.define_colormap(wks, "MPL_terrain")
    res.nglMaximize = True
    res.nglDraw = False
    res.nglFrame = False
    res.vpWidthF = 0.9
    res.vpHeightF = 0.3
    return wks, res