def map_custom():
    """
    Testing function to plot custom maps before creating real function for mapping routines

    Args:
        Yes.
    returns:
        No.
    Author:
        BG
    """
    ###### Parameters ######
    Directory = "/home/s1675537/PhD/DataStoreBoris/GIS/Data/Carpathian/knickpoint/" # reading directory
    wDirectory = Directory # writing directory
    Base_file = "Buzau" # It will be the cabkground raster. Each other raster you want to drap on it will be cropped to its extents including nodata
    csv_file = Directory + "test_sign_m_chi.csv" # Name of your point file, add a similar line with different name if you have more than one point file
    DrapeRasterName = "Buzau_hs.bil" # if you want to drap a raster on your background one. Just add a similar line in case you want another raster to drap and so on
    wname = "sign_test" # name of your output file
    dpi = 500 # Quality of your output image, don't exceed 900
    fig_size_inches = 7 # Figure size in Inches

    ##### Now we can load and plot the data

    BackgroundRasterName = Base_file + ".bil" # Ignore this line
    thisPointData = LSDP.LSDMap_PointData(csv_file, PANDEX = True) # Load the point file #1, add a similar line with different name if you have more than one point file.

    plt.clf() # Ignore this line

    MF = MapFigure(BackgroundRasterName, Directory,coord_type="UTM_km") # load the background raster

    MF.add_drape_image(DrapeRasterName,Directory, # Calling the function will add a drapped raster on the top of the background one
                        colourmap = "gray", # colormap used for this raster, see http://matplotlib.org/users/colormaps.html for examples, put _r at the end of a colormap to get the reversed version
                        alpha=0.5, # transparency of this specific layer, 0 for fully transparent (why not) and 1 for fully opaque
                        show_colourbar = False, # Well, this one is explicit I think
                        colorbarlabel = "Colourbar") # Name of your Colourbar, it might bug though



    MF.add_point_data( thisPointData, # this function plot the requested point file using the lat/long column in the csv file
                       column_for_plotting = "m_chi_sign",  # Column used to color the data
                       this_colourmap = "cubehelix", # Colormap used, see http://matplotlib.org/users/colormaps.html for examples, put _r at the end of a colormap to get the reversed version
                       colorbarlabel = "Colourbar", # Label
                       scale_points = False, # All the point will have the same size if False
                       column_for_scaling = "None", # If scale point True, you can scale the size of your points using one of the columns
                       scaled_data_in_log = False, # If scale point True, you can log the scaling
                       max_point_size = 5, # max size if scale point True again
                       min_point_size = 0.5, # You should be able to guess that one now
                       coulor_log = False, # do you want a log scale for your colorbar ?
                       coulor_manual_scale = [], #Do you want to manually limit the scale of your colorbar? if not let is false
                       manual_size = 0.5, # If none of above is choosen but you want to put another value than 0.5 to scale your point
                       alpha = 1, # transparency of this specific layer, 0 for fully transparent (why not) and 1 for fully opaque
                       minimum_log_scale_cut_off = -10) # you probably won't need this

    ImageName = wDirectory+str(int(clock.time()))+wname+".png" # Ignore this
    ax_style = "Normal" # Ignore this
    MF.save_fig(fig_width_inches = fig_size_inches, FigFileName = ImageName, axis_style = ax_style, Fig_dpi = dpi) # Save the figure
def TestMappingToolsPoints():
    #DataDirectory = "T://analysis_for_papers//Test_map_chi_gradient//results//"
    DataDirectory = "T://students//Wainwright//"
    #Filename = "Mandakini_OutletList.csv"
    Filename = "Bids_DD.csv"

    #ExportName = "ShapeTest"

    fname = DataDirectory + Filename
    #Exp_fname = DataDirectory+ExportName

    thisPointData = LSDP.LSDMap_PointData(fname)

    thisPointData.GetParameterNames(True)
    thisPointData.GetLongitude(True)

    print "Hey buddy, the province is: "
    thisPointData.QueryData("province", True)

    print "Hey buddy, the gma is: "
    thisPointData.QueryData("gma", True)

    thisPointData.TranslateToReducedShapefile(fname)
    thisPointData.TranslateToReducedGeoJSON(fname)
#%%========================CUSTOM_SEGMENTED_COLORMAP========================%%#
CustomColor = [
    '#C8C864', '#9D78C1', '#6E9C6E', '#AF5A5A', '#A6835F', '#A7DBA7',
    '#DAB0DA', '#F3C79B', '#F5A7A7', '#6E899B', '#B1DEDE'
]
CustomColorMap = matplotlib.colors.ListedColormap(CustomColor)

CustomColorComb = [
    '#C8C864', '#9D78C1', '#6E9C6E', '#AF5A5A', '#A6835F', '#A7DBA7',
    '#AF5A5A', '#F3C79B', '#AF5A5A', '#6E899B', '#B1DEDE'
]
CustomColorCombMap = matplotlib.colors.ListedColormap(CustomColorComb)

#%%======================CONVERT_CSV_FILE_TO_SHAPEFILES=====================%%#
thisPointData = LSDP.LSDMap_PointData(csv_file, PANDEX=True)

#%%============================LOAD_AND_PLOT_DATA===========================%%#

plt.clf()

MF = MapFigure(BaseRasterName=BaseRasterName,
               Directory=Import_Directory,
               coord_type="UTM",
               colourbar_location="None",
               basemap_colourmap="gray",
               plot_title='None',
               NFF_opti=False,
               alpha=1)  # load and display the background hillslope raster

MF.add_basin_plot(RasterName=RasterNameCatch,
#print(df3)

#liste = ["flag", "prism", "ocean", "gist_earth", "terrain", "gist_stern", "gnuplot", "gnuplot2", "CMRmap", "cubehelix", "brg", "hsv", "gist_rainbow", "rainbow", "jet", "nipy_spectral", "gist_ncar"]
liste = ["autumn"]

for i in range(len(liste)):

    color = random.choice(liste)

    ##### Now we can load and plot the data

    BackgroundRasterName = Base_file + ".bil"  # Ignore this line

    thisPointData = LSDP.LSDMap_PointData(
        df, data_type="pandas", PANDEX=True
    )  # Load the point file #1, add a similar line with different name if you have more than one point file.

    plt.clf()  # Ignore this line

    MF = MapFigure(BackgroundRasterName,
                   Directory,
                   coord_type="UTM_km",
                   NFF_opti=True,
                   colourbar_location='bottom')  # load the background raster

    MF.add_drape_image(
        BackgroundRasterName,
        Directory,  # Calling the function will add a drapped raster on the top of the background one
        colourmap=
        "gray",  # colormap used for this raster, see http://matplotlib.org/users/colormaps.html for examples, put _r at the end of a colormap to get the reversed version
Exemple #5
0
def MakeRasterLithoBasinMap(DataDirectory,
                            fname_prefix,
                            lname_prefix,
                            lithodict,
                            size_format='ESURF',
                            FigFormat='png',
                            basins=True,
                            m_chi=False,
                            mancol=[],
                            log_scale_river=False,
                            minmax_m_chi=[]):
    """
	This function makes a shaded relief plot of the DEM with lithologic map on the top and basin outline

	Args:
	DataDirectory (str): the data directory with the m/n csv files
	fname_prefix (str): The prefix for the m/n csv files
	size_format (str): Can be "big" (16 inches wide), "geomorphology" (6.25 inches wide), or "ESURF" (4.92 inches wide) (defualt esurf).
	FigFormat (str): The format of the figure. Usually 'png' or 'pdf'. If "show" then it calls the matplotlib show() command.
	Basins (bool): Do you want the basin on top
	minmax_m_chi (list): define a minimum/maximum for plotting m_chi on the top of litho (at the moment this plot is generated from knickpoint dataset)

	Returns:
	Shaded relief plot with the basins coloured by basin ID

	Author: BG, FJC
	"""
    # check if a directory exists for the chi plots. If not then make it.
    raster_directory = DataDirectory + 'raster_plots/'
    if not os.path.isdir(raster_directory):
        os.makedirs(raster_directory)

    # Set up fonts for plots
    label_size = 10
    rcParams['font.family'] = 'sans-serif'
    rcParams['font.sans-serif'] = ['Liberation Sans']
    rcParams['font.size'] = label_size

    # set figure sizes based on format
    if size_format == "geomorphology":
        fig_width_inches = 6.25
    elif size_format == "big":
        fig_width_inches = 16
    else:
        fig_width_inches = 4.92126

    raster_ext = '.bil'

    # get the basin IDs to make a discrete colourmap for each ID
    if (basins):
        BasinInfoDF = Helper.ReadBasinInfoCSV(DataDirectory, fname_prefix)

        basin_keys = list(BasinInfoDF['basin_key'])
        basin_keys = [int(x) for x in basin_keys]

        basin_junctions = list(BasinInfoDF['outlet_junction'])
        basin_junctions = [float(x) for x in basin_junctions]

        print('Basin keys are: ')
        print(basin_keys)
        BasinsName = fname_prefix + '_AllBasins.bil'

    # going to make the basin plots - need to have bil extensions.
    print(
        "I'm going to make the basin plots. Your topographic data must be in ENVI bil format or I'll break!!"
    )

    # get the rasters
    raster_ext = '.bil'
    BackgroundRasterName = fname_prefix + raster_ext
    HillshadeName = fname_prefix + '_hs' + raster_ext

    LithoMap = lname_prefix + raster_ext

    # create the map figure
    MF = MapFigure(HillshadeName,
                   DataDirectory,
                   coord_type="UTM_km",
                   colourbar_location='None')
    MF.add_drape_image(HillshadeName,
                       DataDirectory,
                       NFF_opti=True,
                       custom_min_max=[90, 240],
                       alpha=1)
    # add the geology drape
    # MF.add_basin_plot(BasinsName,fname_prefix,DataDirectory,
    #				  use_keys_not_junctions = True, show_colourbar = True,
    #				  discrete_cmap=True, n_colours=len(basin_keys), colorbarlabel = "Basin ID",
    #				  colourmap = cmap, adjust_text = False)
    # getting the right color now

    color_map_litho = getLithoColorMap(fname_prefix, DataDirectory)
    df_litho_size = pd.read_csv(DataDirectory + fname_prefix + "_lithokey.csv")

    MF.add_drape_image(LithoMap,
                       DataDirectory,
                       colourmap=color_map_litho,
                       alpha=0.6,
                       show_colourbar=False,
                       colorbarlabel="Colourbar",
                       discrete_cmap=False,
                       norm="None",
                       colour_min_max=[0, df_litho_size["rocktype"].max() - 1],
                       modify_raster_values=False,
                       old_values=[],
                       new_values=[],
                       cbar_type=int,
                       NFF_opti=True,
                       custom_min_max=[])

    if (basins):
        # add the basin outlines

        Basins = LSDP.GetBasinOutlines(DataDirectory, BasinsName)
        MF.plot_polygon_outlines(Basins, linewidth=0.8)

        # knickpoints!
        if (m_chi):
            ChannelDF = pd.read_csv(DataDirectory + fname_prefix +
                                    "_ksnkp_mchi.csv")
            ChannelPoints = LSDP.LSDMap_PointData(ChannelDF,
                                                  data_type="pandas",
                                                  PANDEX=True)
            MF.add_point_data(ChannelPoints,
                              column_for_plotting='m_chi',
                              show_colourbar=True,
                              scale_points=True,
                              column_for_scaling='drainage_area',
                              alpha=0.5,
                              zorder=100,
                              this_colourmap="RdBu_r",
                              colour_manual_scale=mancol,
                              scaled_data_in_log=log_scale_river,
                              max_point_size=minmax_m_chi[1],
                              min_point_size=minmax_m_chi[0])
        else:
            # add the channel network
            ChannelDF = Helper.ReadChiDataMapCSV(DataDirectory, fname_prefix)
            ChannelPoints = LSDP.LSDMap_PointData(ChannelDF,
                                                  data_type="pandas",
                                                  PANDEX=True)
            MF.add_point_data(ChannelPoints,
                              show_colourbar="False",
                              scale_points=True,
                              column_for_scaling='drainage_area',
                              alpha=0.5,
                              zorder=100)

    if (basins):
        # add the basin labelling
        label_dict = dict(zip(basin_junctions, basin_keys))
        Points = LSDP.GetPointWithinBasins(DataDirectory, BasinsName)
        MF.add_text_annotation_from_shapely_points(Points,
                                                   text_colour='k',
                                                   label_dict=label_dict,
                                                   zorder=200)

    if (basins):
        # Save the figure
        ImageName = raster_directory + fname_prefix + '_basin_keys_litho.' + FigFormat
    else:
        ImageName = raster_directory + fname_prefix + '_litho.' + FigFormat

    MF.save_fig(fig_width_inches=fig_width_inches,
                FigFileName=ImageName,
                FigFormat=FigFormat,
                Fig_dpi=500)
Exemple #6
0
def PlotKsnFromSlopeArea(DataDirectory,
                         fname_prefix,
                         theta=0.45,
                         cbar_loc='right',
                         custom_cbar_min_max=[]):
    """
    Make a plot of the slope area data with a fixed concavity
    """
    import numpy as np

    print("Calculating ksn...")
    # read the csv and get some info
    df = pd.read_csv(DataDirectory + fname_prefix + "_slopes.csv")

    # now force a fit of ks based on this concavity
    area = df['drainage_area'].values
    slope = df['slope'].values

    ksn = slope / (area**(-theta))
    df['ksn'] = ksn
    print(np.max(ksn), np.min(ksn))
    print(ksn)

    df.to_csv(DataDirectory + fname_prefix + '_ksn.csv', index=False)

    # set figure sizes based on format
    fig_width_inches = 6

    # some raster names
    raster_ext = '.bil'
    BackgroundRasterName = fname_prefix + raster_ext
    HSName = fname_prefix + '_hs' + raster_ext

    if not os.path.isfile(DataDirectory + HSName):
        # make a hillshade
        BM.GetHillshade(DataDirectory + BackgroundRasterName,
                        DataDirectory + HSName)

    # create the map figure
    MF = MapFigure(HSName,
                   DataDirectory,
                   coord_type="UTM",
                   cbar_loc='right',
                   font_size=16)
    #MF.add_drape_image(BackgroundRasterName,DataDirectory,colourmap = 'gray', alpha=0.5)

    # add the ksn data
    ChannelPoints = LSDP.LSDMap_PointData(df, data_type="pandas", PANDEX=True)
    MF.add_point_data(ChannelPoints,
                      this_colourmap='viridis',
                      column_for_plotting='ksn',
                      colour_log=True,
                      zorder=100,
                      show_colourbar=True,
                      colourbar_location='bottom',
                      font_size=24,
                      colorbarlabel="log$_{10}(k_{sn})",
                      manual_size=1.5,
                      colour_manual_scale=[0, 1.8])
    #plt.show()

    MF.save_fig(fig_width_inches=fig_width_inches,
                FigFileName=DataDirectory + fname_prefix + '_ksn.png',
                FigFormat='png',
                Fig_dpi=300,
                fixed_cbar_characters=6,
                adjust_cbar_characters=False,
                axis_style='Thin',
                transparent=True)  # Save the figure
    plt.clf()
Exemple #7
0
def PlotElevationWithClusters(DataDirectory,
                              OutDirectory,
                              fname_prefix,
                              stream_order=1,
                              cbar_loc='right',
                              custom_cbar_min_max=[]):
    """
    Make a plot of the raster with the channels coloured by the cluster
    value. Uses the LSDPlottingTools libraries. https://github.com/LSDtopotools/LSDMappingTools

    Args:
        stream_order: the stream order of the profiles that you are analysing
        cbar_loc: location of the colourbar, can be right, top, bottom, left, or none.
        custom_cbar_min_max: list of [min, max] to recast the raster to for display.

    Author: FJC
    """
    print("I'm plotting the elevation with channels coloured by cluster")
    df = pd.read_csv(DataDirectory + fname_prefix + '_all_tribs.csv')
    cluster_df = pd.read_csv(
        OutDirectory + fname_prefix +
        '_profiles_clustered_SO{}.csv'.format(stream_order))

    # set figure sizes based on format
    fig_width_inches = 4.92126

    # some raster names
    raster_ext = '.bil'
    BackgroundRasterName = fname_prefix + raster_ext
    HSName = fname_prefix + '_hs' + raster_ext

    if not os.path.isfile(DataDirectory + HSName):
        # make a hillshade
        BM.GetHillshade(DataDirectory + BackgroundRasterName,
                        DataDirectory + HSName)

    MF = MapFigure(HSName,
                   DataDirectory,
                   coord_type="UTM",
                   colourbar_location=cbar_loc)
    MF.add_drape_image(BackgroundRasterName,
                       DataDirectory,
                       colourmap='gray',
                       alpha=0.5,
                       colorbarlabel="Elevation (m)",
                       colour_min_max=custom_cbar_min_max)

    # # create the map figure
    # MF = MapFigure(BackgroundRasterName, DataDirectory,coord_type="UTM",colour_min_max = custom_cbar_min_max)

    clusters = cluster_df.cluster_id.unique()
    for cl in clusters:
        # plot the whole channel network in black
        ChannelPoints = LSDP.LSDMap_PointData(df,
                                              data_type="pandas",
                                              PANDEX=True)
        MF.add_point_data(ChannelPoints,
                          show_colourbar="False",
                          unicolor='w',
                          manual_size=1,
                          zorder=2,
                          alpha=1)
        # plot the clustered profiles in the correct colour
        this_df = cluster_df[cluster_df.cluster_id == cl]
        this_colour = str(this_df.colour.unique()[0])
        ClusteredPoints = LSDP.LSDMap_PointData(this_df,
                                                data_type="pandas",
                                                PANDEX=True)
        MF.add_point_data(ClusteredPoints,
                          show_colourbar="False",
                          zorder=100,
                          unicolor=this_colour,
                          manual_size=2)

    MF.save_fig(fig_width_inches=fig_width_inches,
                FigFileName=OutDirectory + fname_prefix +
                '_elev_clusters_SO{}.png'.format(stream_order),
                FigFormat='png',
                Fig_dpi=300,
                fixed_cbar_characters=6,
                adjust_cbar_characters=False,
                axis_style='Thin',
                transparent=True)  # Save the figure
Exemple #8
0
def PlotRasterLithologyWithClusters(DataDirectory,
                                    OutDirectory,
                                    fname_prefix,
                                    stream_order=1,
                                    geol_raster='geol'):
    """
        Make a hillshade of the raster with the channels coloured by the cluster
        value. Rasterise a geology shapefile and drape on the top.
        Uses the LSDPlottingTools libraries. https://github.com/LSDtopotools/LSDMappingTools

        Args:
            stream_order: the stream order of the profiles that you are analysing
            shapefile_name: name of the lithology shapefile
            geol_field: the field of the shapefile that has the lithology information

        Author: FJC
        """
    import LSDPlottingTools as LSDP
    from LSDMapFigure.PlottingRaster import MapFigure

    df = pd.read_csv(DataDirectory + fname_prefix + '_all_tribs.csv')
    cluster_df = pd.read_csv(
        OutDirectory + fname_prefix +
        '_profiles_clustered_SO{}.csv'.format(stream_order))

    # set figure sizes based on format
    fig_width_inches = 8

    # some raster names
    raster_ext = '.bil'
    BackgroundRasterName = fname_prefix + raster_ext
    HSName = fname_prefix + '_hs' + raster_ext

    if not os.path.isfile(DataDirectory + HSName):
        # make a hillshade
        BM.GetHillshade(DataDirectory + BackgroundRasterName,
                        DataDirectory + HSName)

    # create the map figure
    MF = MapFigure(HSName, DataDirectory, coord_type="UTM")

    #geology
    LithName = geol_raster
    print("The geology raster is" + LithName)
    MF.add_drape_image(LithName,
                       DataDirectory,
                       colourmap=plt.cm.jet,
                       alpha=0.5,
                       show_colourbar=False,
                       discrete_cmap=True,
                       cbar_type=int,
                       mask_value=0)

    clusters = cluster_df.cluster_id.unique()
    for cl in clusters:
        # plot the whole channel network in black
        ChannelPoints = LSDP.LSDMap_PointData(df,
                                              data_type="pandas",
                                              PANDEX=True)
        MF.add_point_data(ChannelPoints,
                          show_colourbar="False",
                          unicolor='white',
                          manual_size=1.5,
                          zorder=2,
                          alpha=0.5)
        # plot the clustered profiles in the correct colour
        this_df = cluster_df[cluster_df.cluster_id == cl]
        this_colour = str(this_df.colour.unique()[0])
        ClusteredPoints = LSDP.LSDMap_PointData(this_df,
                                                data_type="pandas",
                                                PANDEX=True)
        MF.add_point_data(ClusteredPoints,
                          show_colourbar="False",
                          zorder=100,
                          unicolor=this_colour,
                          manual_size=2.5)

    MF.save_fig(fig_width_inches=fig_width_inches,
                FigFileName=OutDirectory + fname_prefix +
                '_lith_clusters_SO{}.png'.format(stream_order),
                FigFormat='png',
                Fig_dpi=300,
                fixed_cbar_characters=6,
                adjust_cbar_characters=False,
                transparent=True)  # Save the figure
def MakeMLEPlots(DataDirectory,
                 DEM_prefix,
                 basin_list=[0],
                 start_movern=0.2,
                 d_movern=0.1,
                 n_movern=7):
    """
    This function makes a chi-elevation plot for each basin and each value of
    m/n and prints the MLE value between the tributaries and the main stem.
    The plot with the maximum value of MLE is highlighted in red (suggesting
    that this should be the appropriate m/n value for this basin). channels
    are coloured by elevation.

    Args:
        DataDirectory (str): the data directory with the m/n csv files
        DEM_prefix (str): The prefix for the m/n csv files
        basin_list: a list of the basins to make the plots for. If an empty list is passed then
        all the basins will be analysed. Default = basin 0.
        start_movern (float): the starting m/n value. Default is 0.2
        d_movern (float): the increment between the m/n values. Default is 0.1
        n_movern (float): the number of m/n values analysed. Default is 7.

    Returns:
        Plot of each m/n value for each basin.

    Author: SMM, modified by FJC
    """

    profile_suffix = "_movern.csv"
    basin_stats_suffix = "_movernstats_basinstats.csv"

    movern_profile_file = DEM_prefix + profile_suffix
    movern_basin_stats_file = DEM_prefix + basin_stats_suffix

    end_movern = start_movern + d_movern * (n_movern - 1)
    m_over_n_values = np.linspace(start_movern, end_movern, n_movern)

    # get the maximum MLE of each basin
    pd_DF = pd.DataFrame.from_csv(DataDirectory + movern_basin_stats_file)
    shp = pd_DF.shape
    max_MLEs = []
    max_MLEs_index = []
    for i in range(0, shp[0]):
        #print("I is: "+str(i))
        a = pd_DF.loc[[i]]
        b = np.asarray(a)
        c = b[0, :]
        max_MLEs.append(max(c))
        max_MLEs_index.append(np.argmax(c))
    print("max_MLEs are: ")
    print(max_MLEs)
    m_over_n_of_max = []

    for idx in max_MLEs_index:
        m_over_n_of_max.append(m_over_n_values[idx])

    print("The m over n of these max are: ")
    print(m_over_n_of_max)

    n_basins = len(max_MLEs)

    label_size = 12

    # Set up fonts for plots
    rcParams['font.family'] = 'sans-serif'
    rcParams['font.sans-serif'] = ['arial']
    rcParams['font.size'] = label_size
    size_format = "default"
    # make a figure,
    if size_format == "geomorphology":
        fig = plt.figure(1, facecolor='white', figsize=(6.25, 3.5))
        #l_pad = -40
    elif size_format == "big":
        fig = plt.figure(1, facecolor='white', figsize=(16, 9))
        #l_pad = -50
    else:
        fig = plt.figure(1, facecolor='white', figsize=(4.92126, 3.2))
        #l_pad = -35

    gs = plt.GridSpec(100, 100, bottom=0.15, left=0.1, right=1.0, top=1.0)
    ax = fig.add_subplot(gs[5:100, 10:95])

    # load the m_over_n data file
    thisPointData = LSDP.LSDMap_PointData(DataDirectory + movern_profile_file)
    allBasinStatsData = LSDP.LSDMap_PointData(DataDirectory +
                                              movern_basin_stats_file)

    print("m over n values are: ")
    print(m_over_n_values)

    mn_legends = []
    for mn in m_over_n_values:
        mn_legends.append("m_over_n = " + str(mn))

    print("The mn labels are: ")
    print(mn_legends)

    # get the data form the profiles
    elevation = thisPointData.QueryData('elevation')
    elevation = [float(x) for x in elevation]
    basin = thisPointData.QueryData('basin_key')
    basin = [int(x) for x in basin]
    source = thisPointData.QueryData('source_key')
    source = [int(x) for x in source]

    # get the basin keys
    allstats_basinkeys = allBasinStatsData.QueryData("basin_key")
    allstats_basinkeys = [int(x) for x in allstats_basinkeys]

    # need to convert everything into arrays so we can mask different basins
    Elevation = np.asarray(elevation)
    Basin = np.asarray(basin)
    #Source = np.asarray(source)

    # Loop through m/n values aggregating data
    for idx, mn in enumerate(m_over_n_values):

        counter = str(idx).zfill(3)
        print("Counter is: " + counter)
        # first get the chi values for this m_over_n
        #print ("mn is: " + str(mn))
        #print("index is: "+str(idx))
        mn_legend = "m_over_n = " + str(mn)
        #print("I am looking for the data element: "+mn_legend)
        this_chi = thisPointData.QueryData(mn_legend)

        # get the MLE value for this m/n
        this_MLE = allBasinStatsData.QueryData(mn_legend)

        # convert to a numpy array for masking
        Chi = np.asarray(this_chi)

        # some info about the chi and elevation values
        #max_chi = np.amax(Chi)
        #max_Elevation = np.amax(Elevation)
        #min_Elevation = np.amin(Elevation)

        #z_axis_min = int(min_Elevation/10)*10
        #z_axis_max = int(max_Elevation/10)*10+10
        #chi_axis_max = int(max_chi/5)*5+5

        # Now mask the data. Initially we will do only basin 0
        if basin_list == []:
            print(
                "You didn't give me any basins so I assume you want all of them."
            )
            basin_list = range(0, n_basins - 1)

        for basin_key in basin_list:
            # now we need to find out if this basin is in the allstats file,
            # and if so what index it is
            #this_basin_index = -99
            #for ii,bk in enumerate(allstats_basinkeys):
            #    #print("index: "+str(ii)+" and basin_key is: "+str(bk))
            #    if (bk == basin_key):
            #        this_basin_index = idx

            #if(this_basin_index != -99):
            #    MLE = this_MLE[this_basin_index]
            #else:
            #    MLE = "NaN"
            MLE = this_MLE[basin_key]
            #MLE_str = str(MLE)
            #short_MLE = str("%03.02e" % round(MLE,2))
            short_MLE = str(round(MLE, 3))
            print("The short MLE is: " + short_MLE)

            #print("The MLE of this basin for this m over n is: "+short_MLE)

            # this gets the mask (for the chosen basin)
            m = np.ma.masked_where(Basin != basin_key, Basin)

            # this is the masked chi value
            maskX = np.ma.masked_where(np.ma.getmask(m), Chi)
            maskElevation = np.ma.masked_where(np.ma.getmask(m), Elevation)

            # now plot the data with a colourmap
            ax.scatter(maskX,
                       maskElevation,
                       s=2.5,
                       c=maskElevation,
                       cmap="terrain",
                       edgecolors='none')

            # some formatting of the figure
            ax.spines['top'].set_linewidth(1)
            ax.spines['left'].set_linewidth(1)
            ax.spines['right'].set_linewidth(1)
            ax.spines['bottom'].set_linewidth(1)

            # make the lables
            ax.set_xlabel("$\chi$ (m)")
            ax.set_ylabel("Elevation (m)")

            # This affects all axes because we set share_all = True.
            #ax.set_ylim(z_axis_min,z_axis_max)
            #ax.set_ylim(z_axis_min,z_axis_max)
            #ax.set_xlim(0,chi_axis_max)
            #plt.title("Basin = " +mn_legend+", MLE = "+short_MLE)

            #newline = "\n"
            title_string = "Basin " + str(basin_key) + ", $m/n$ = " + str(mn)
            title_string2 = "MLE = " + short_MLE
            ax.text(0.05,
                    0.95,
                    title_string,
                    verticalalignment='top',
                    horizontalalignment='left',
                    transform=ax.transAxes,
                    color='black',
                    fontsize=10)
            print("The basin index is: " + str(basin_key) +
                  " and the max index is: " + str(max_MLEs_index[basin_key]))
            if (idx == max_MLEs_index[basin_key]):
                print("This m/n is: " + str(mn) + " and it is the maximum MLE")
                ax.text(0.05,
                        0.88,
                        title_string2 + ", maximum MLE in basin.",
                        verticalalignment='top',
                        horizontalalignment='left',
                        transform=ax.transAxes,
                        color='red',
                        fontsize=10)
            else:
                ax.text(0.05,
                        0.88,
                        title_string2,
                        verticalalignment='top',
                        horizontalalignment='left',
                        transform=ax.transAxes,
                        color='black',
                        fontsize=10)

            #save the plot
            newFilename = DataDirectory + "Chi_profiles_basin_" + str(
                basin_key) + "_" + counter + ".png"

            # This gets all the ticks, and pads them away from the axis so that the corners don't overlap
            ax.tick_params(axis='both', width=1, pad=2)
            for tick in ax.xaxis.get_major_ticks():
                tick.set_pad(2)

            FigFormat = "png"
            plt.savefig(newFilename, format=FigFormat, dpi=300)
            ax.cla()
Exemple #10
0
                  n_colours=10,
                  cbar_type=float,
                  use_keys_not_junctions=True,
                  label_basins=False,
                  adjust_text=False,
                  rename_dict={0: '1'},
                  value_dict={},
                  mask_list=[],
                  edgecolour='black',
                  linewidth=1,
                  cbar_dict={},
                  parallel=False,
                  outlines_only=True,
                  zorder=3)

thisPointData1 = LSDP.LSDMap_PointData(csv_file1, PANDEX=True)
thisPointData2 = LSDP.LSDMap_PointData(csv_file2, PANDEX=True)
MF.add_point_data(thisPointData=thisPointData1,
                  column_for_plotting='age',
                  this_colourmap="hot_r",
                  show_colourbar=True,
                  colourbar_location='right',
                  colorbarlabel='Apatite helium age',
                  scale_points=False,
                  column_for_scaling='age',
                  scaled_data_in_log=False,
                  max_point_size=10,
                  min_point_size=0,
                  colour_log=False,
                  colour_manual_scale=[0, 70],
                  manual_size=20,
ChannelDataDirectory = DataDirectory + "channel_data/"
HillslopeDataDirectory = DataDirectory + "hillslope_data/"
HilltopPointsData = HillslopeDataDirectory + "bolinas_HilltopData.csv"
ChannelPointsDat = ChannelDataDirectory + "bolinas_MChiSegmented.csv"
ChannelHeadPointsData = ChannelDataDirectory + "bolinas_CH_wiener_nodeindices_for_Arc.csv"

# create the map figure
MF = MapFigure(HillshadeName,
               DataDirectory,
               coord_type="UTM_km",
               colourbar_location='None')

# add hilltops
HilltopPointsDF = pd.read_csv(HilltopPointsData)
HilltopPoints = LSDP.LSDMap_PointData(HilltopPointsDF,
                                      data_type="pandas",
                                      PANDEX=True)
MF.add_point_data(HilltopPoints,
                  alpha=0.5,
                  zorder=100,
                  unicolor="blue",
                  manual_size=5)

# add channel heads
#ChannelHeadsDF = pd.read_csv(ChannelHeadPointsData)
#ChannelHeadPoints = LSDP.LSDMap_PointData(ChannelHeadsDF, data_type = "pandas", PANDEX = True)
#MF.add_point_data(ChannelHeadPoints,alpha=0.5,zorder=100,unicolor="blue",manual_size=5)

# add channels
#ChannelDF = Helper.ReadChiDataMapCSV(ChannelDataDirectory,fname_prefix)
#ChannelPoints = LSDP.LSDMap_PointData(ChannelDF, data_type = "pandas", PANDEX = True)
DrapeRasterName = "Betics_UTM30clip_hs.bil"

#BlackRasterD = "/home/s1675537/PhD/DataStoreBoris/GIS/Data/Carpathian/Best_DEM/"
#BlackRaster = "black_35.bil"

alpha_black = 1
#CurveRasterName = Base_file+"_curvature.bil"

#BR = BaseRaster(BackgroundRasterName, Directory)
#BR.set_raster_type("Terrain")
#print(BR._colourmap)
#BR.show_raster()

#BR.set_colourmap("RdYlGn")
#BR.show_raster()
thisPointData = LSDP.LSDMap_PointData(csv_file)
river_network = LSDP.LSDMap_PointData(
    "/home/s1675537/PhD/DataStoreBoris/Emma/rv.csv")

#names = ['cubehelix','CMRmap','RdBu']
#names = ['spring_r', 'autumn_r','YlOrRd','YlOrRd_r']
names = ['autumn_r']
for nami in names:
    plt.clf()
    MF = MapFigure(BackgroundRasterName,
                   Directory,
                   coord_type="UTM_km",
                   alpha=1)
    MF.add_drape_image(DrapeRasterName, Directory, alpha=0.5)
    #MF.add_drape_image(BlackRaster, BlackRasterD, alpha = alpha_black)
    MF.add_point_data(river_network,
Exemple #13
0
        tdf,tde = grainsize_curve_from_sieving(file_info.csv_file_name.values[i],Directory)
        tab_d.append([i+1,tdf,tde,file_info.river.values[i]])
        pdf.append(tdf)
        pde.append(tde)
        print("Your D50 is: %s and your D84 is %s" %(tdf,tde))
        print("Done plus figure created in "+Directory+file_info.csv_file_name.values[i][:-3]+"png")

    print("I am now compiling the data and creatng the D50/84 evolution figure")
    compile_several_d(tab_d,file_info.csv_file_name.values,Directory)
    print("Your compiled filed is named "+ Directory+ "Sieving_compiled.png")
################ printing the maps
    if(maps):
        print("I will now create a map with the sieving data sized by D50")
        file_info = print_new_csv_with_D(Directory,file_info,pdf,pde)

        thisPointData = LSDP.LSDMap_PointData(Directory + file_info) # Load the point file #1, add a similar line with different name if you have more than one point file.
        riverPointData = LSDP.LSDMap_PointData(D_map + river_file)
        plt.clf() # Ignore this line

        MF = MapFigure(N_map, D_map,coord_type="UTM_km") # load the background raster
        MF.add_drape_image(HS_name,D_map, # Calling the function will add a drapped raster on the top of the background one
                            colourmap = "gray", # colormap used for this raster, see http://matplotlib.org/users/colormaps.html for examples, put _r at the end of a colormap to get the reversed version
                            alpha=0.5, # transparency of this specific layer, 0 for fully transparent (why not) and 1 for fully opaque
                            show_colourbar = False, # Well, this one is explicit I think
                            colorbarlabel = "Colourbar") # Name of your Colourbar, it might bug though
        MF.add_point_data( riverPointData, # this function plot the requested point file using the lat/long column in the csv file
                           column_for_plotting = "None",  # Column used to color the data
                           this_colourmap = "RdBu_r", # Colormap used, see http://matplotlib.org/users/colormaps.html for examples, put _r at the end of a colormap to get the reversed version
                           colorbarlabel = "River", # Label
                           scale_points = False, # All the point will have the same size if False
                           column_for_scaling = "None", # If scale point True, you can scale the size of your points using one of the columns
###### Parameters ######
Directory = "/home/s1675537/PhD/DataStoreBoris/Emma/"  # reading directory (if it is on windows, the path is something like C://windows/Users/blablalba/)
wDirectory = "/home/s1675537/PhD/DataStoreBoris/Emma/"  # writing directory (if it is on windows, the path is something like C://windows/Users/blablalba/)
Base_file = "Betics_UTM30clip_PP"  # It will be the cabkground raster. Each other raster you want to drap on it will be cropped to its extents including nodata
csv_file = Directory + "new.csv"  # Name of your point file, add a similar line with different name if you have more than one point file
DrapeRasterName = "Betics_UTM30clip_hs.bil"  # if you want to drap a raster on your background one. Just add a similar line in case you want another raster to drap and so on
wname = "output"  # name of your output file
dpi = 900  # Quality of your output image, don't exceed 900
fig_size_inches = 24  # Figure size in Inches

##### Now we can load and plot the data

BackgroundRasterName = Base_file + ".bil"  # Ignore this line
thisPointData = LSDP.LSDMap_PointData(
    csv_file, PANDEX=True
)  # Load the point file #1, add a similar line with different name if you have more than one point file.

plt.clf()  # Ignore this line

MF = MapFigure(BackgroundRasterName,
               Directory,
               coord_type="UTM_km",
               NFF_opti=True)  # load the background raster

MF.add_drape_image(
    DrapeRasterName,
    Directory,  # Calling the function will add a drapped raster on the top of the background one
    colourmap=
    "gray",  # colormap used for this raster, see http://matplotlib.org/users/colormaps.html for examples, put _r at the end of a colormap to get the reversed version
    alpha=
Exemple #15
0
def PlotHillshadewithClusters(DataDirectory,
                              OutDirectory,
                              fname_prefix,
                              stream_order=1):
    """
        Make a hillshade of the raster with the channels coloured by the cluster
        value. Uses the LSDPlottingTools libraries. https://github.com/LSDtopotools/LSDMappingTools

        Args:
            stream_order: the stream order of the profiles that you are analysing

        Author: FJC
        """
    import LSDPlottingTools as LSDP
    from LSDMapFigure.PlottingRaster import MapFigure

    print(
        "I'm plotting a shaded relief map with the channels coloured by cluster"
    )

    df = pd.read_csv(DataDirectory + fname_prefix + '_all_tribs.csv')
    cluster_df = pd.read_csv(
        OutDirectory + fname_prefix +
        '_profiles_clustered_SO{}.csv'.format(stream_order))

    # set figure sizes based on format
    fig_width_inches = 8

    # some raster names
    raster_ext = '.bil'
    BackgroundRasterName = fname_prefix + raster_ext
    HSName = fname_prefix + '_hs' + raster_ext

    if not os.path.isfile(DataDirectory + HSName):
        # make a hillshade
        BM.GetHillshade(DataDirectory + BackgroundRasterName,
                        DataDirectory + HSName)

    # create the map figure
    MF = MapFigure(HSName, DataDirectory, coord_type="UTM")

    clusters = cluster_df.cluster_id.unique()
    for cl in clusters:
        # plot the whole channel network in black
        ChannelPoints = LSDP.LSDMap_PointData(df,
                                              data_type="pandas",
                                              PANDEX=True)
        MF.add_point_data(ChannelPoints,
                          show_colourbar="False",
                          unicolor='0.9',
                          manual_size=2,
                          zorder=1,
                          alpha=0.5)
        # plot the clustered profiles in the correct colour
        this_df = cluster_df[cluster_df.cluster_id == cl]
        this_colour = str(this_df.colour.unique()[0])
        ClusteredPoints = LSDP.LSDMap_PointData(this_df,
                                                data_type="pandas",
                                                PANDEX=True)
        MF.add_point_data(ClusteredPoints,
                          show_colourbar="False",
                          zorder=100,
                          unicolor=this_colour,
                          manual_size=3)

    MF.save_fig(fig_width_inches=fig_width_inches,
                FigFileName=OutDirectory + fname_prefix +
                '_hs_clusters_SO{}.png'.format(stream_order),
                FigFormat='png',
                Fig_dpi=300,
                fixed_cbar_characters=6,
                adjust_cbar_characters=False,
                transparent=True)  # Save the figure
def main(argv):

    # If there are no arguments, send to the welcome screen
    if not len(sys.argv) > 1:
        full_paramfile = print_welcome()
        sys.exit()

    # Get the arguments
    import argparse
    parser = argparse.ArgumentParser()

    # The location of the data files
    parser.add_argument(
        "-dir",
        "--base_directory",
        type=str,
        help="The base directory. If not defined, current directory.")
    parser.add_argument("-fname",
                        "--fname_prefix",
                        type=str,
                        help="The prefix of your DEM WITHOUT EXTENSION!")
    parser.add_argument(
        "-fmt",
        "--FigFormat",
        type=str,
        default='png',
        help="Set the figure format for the plots. Default is png")
    args = parser.parse_args()

    # get the base directory
    if args.base_directory:
        DataDirectory = args.base_directory
        # check if you remembered a / at the end of your path_name
        if not DataDirectory.endswith("/"):
            print(
                "You forgot the '/' at the end of the directory, appending...")
            DataDirectory = this_dir + "/"
    else:
        this_dir = os.getcwd()

    if not args.fname_prefix:
        print(
            "WARNING! You haven't supplied your DEM name. Please specify this with the flag '-fname'"
        )
        sys.exit()
    else:
        fname_prefix = args.fname_prefix

    # set to not parallel
    parallel = False
    faults = True
    FigFormat = args.FigFormat

    # check if a directory exists for the chi plots. If not then make it.
    raster_directory = DataDirectory + 'raster_plots/'
    if not os.path.isdir(raster_directory):
        os.makedirs(raster_directory)

    # Set up fonts for plots
    label_size = 8
    rcParams['font.family'] = 'sans-serif'
    rcParams['font.sans-serif'] = ['arial']
    rcParams['font.size'] = label_size

    # set figure sizes based on format
    size_format = ""
    if size_format == "geomorphology":
        fig_width_inches = 6.25
    elif size_format == "big":
        fig_width_inches = 16
    else:
        fig_width_inches = 4.92126

    # get the basin IDs to make a discrete colourmap for each ID
    BasinInfoDF = Helper.ReadBasinInfoCSV(DataDirectory, fname_prefix)

    basin_keys = list(BasinInfoDF['basin_key'])
    basin_keys = [int(x) for x in basin_keys]

    basin_junctions = list(BasinInfoDF['outlet_junction'])
    basin_junctions = [int(x) for x in basin_junctions]

    # get a discrete colormap
    cmap = plt.cm.viridis

    # going to make the basin plots - need to have bil extensions.
    print(
        "I'm going to make the basin plots. Your topographic data must be in ENVI bil format or I'll break!!"
    )

    # get the rasters
    raster_ext = '.bil'
    BackgroundRasterName = fname_prefix + raster_ext
    HillshadeName = fname_prefix + '_hs' + raster_ext
    BasinsName = fname_prefix + '_AllBasins' + raster_ext

    # create the map figure
    MF = MapFigure(HillshadeName,
                   DataDirectory,
                   coord_type="UTM_km",
                   colourbar_location='none')

    # add the basins drape
    BasinsDict = dict(zip(basin_keys, basin_keys))
    #    MF.add_basin_plot(BasinsName,fname_prefix,DataDirectory, label_basins=False,
    #                      use_keys_not_junctions = True, show_colourbar = False,
    #                      value_dict = BasinsDict, discrete_cmap=True, n_colours=len(basin_keys),
    #                      colorbarlabel = "Basin ID", cbar_type=int, tickspacefactor=2,
    #                      colourmap = cmap, edgecolour='none', adjust_text = True, parallel=parallel)

    # add the channel network
    if not parallel:
        ChannelDF = Helper.ReadChiDataMapCSV(DataDirectory, fname_prefix)
    else:
        ChannelDF = Helper.AppendChiDataMapCSVs(DataDirectory)

    # remove chi no data values
    ChannelDF = ChannelDF[ChannelDF.chi != -9999]

    ChannelPoints = LSDP.LSDMap_PointData(ChannelDF,
                                          data_type="pandas",
                                          PANDEX=True)

    # add chi map
    MF.add_point_data(ChannelPoints,
                      column_for_plotting="chi",
                      column_for_scaling="chi",
                      colorbarlabel="$\chi$ (m)",
                      show_colourbar=True,
                      this_colourmap=cmap,
                      colourbar_location="top")

    # add the faults
    if faults:
        LineFileName = DataDirectory + fname_prefix + "_faults.shp"
        MF.add_line_data(LineFileName,
                         linestyle="-",
                         linewidth=1.5,
                         zorder=99,
                         legend=True,
                         label="Fault Segments")

    # add the basin outlines ### need to parallelise
    if not parallel:
        Basins = LSDP.GetBasinOutlines(DataDirectory, BasinsName)
    else:
        Basins = LSDP.GetMultipleBasinOutlines(DataDirectory)

    # Find the relay basins and plot separately
    RelayBasinIDs = [1248, 4788, 4995, 5185, 6187, 6758, 6805]
    RelayBasins = {
        key: value
        for key, value in Basins.items() if key in RelayBasinIDs
    }

    # Plot all basins
    MF.plot_polygon_outlines(Basins,
                             colour='k',
                             linewidth=0.5,
                             alpha=1,
                             legend=True,
                             label="Catchments")
    MF.plot_polygon_outlines(RelayBasins,
                             colour='r',
                             linewidth=0.5,
                             alpha=1,
                             legend=True,
                             label="Relay Catchments")

    # Add the legend
    MF.add_legend()

    # Save the figure
    ImageName = raster_directory + fname_prefix + '_chi_map.' + FigFormat
    MF.save_fig(fig_width_inches=fig_width_inches,
                FigFileName=ImageName,
                FigFormat=FigFormat,
                Fig_dpi=300)
def ChiMappingToolsTest():
    #DataDirectory = "/home/smudd/SMMDataStore/analysis_for_papers/Meghalaya/chi_analysis/"
    #DataDirectory = "C:\\Vagrantboxes\\LSDTopoTools\\Topographic_projects\\Meghalaya\\"
    DataDirectory = "T:\\analysis_for_papers\\Meghalaya/chi_analysis\\"
    Base_file = "Mega_clip"

    #DataDirectory = "/home/smudd/LSDTopoData/India/Southern_india/"
    #Base_file = "SIndia_clip"

    bil = ".bil"

    #Filename = "Mega_clip.bil"
    #HSFilename = "Mega_clip_hs.bil"
    #BasinFilename = "Mega_clip_AllBasins.bil"

    DEMname = DataDirectory + Base_file + bil
    HSname = DataDirectory + Base_file + "_hs" + bil
    Basinname = DataDirectory + Base_file + "_AllBasins" + bil

    FigName = DataDirectory + 'TestChiFull2.png'
    ChiName = DataDirectory + Base_file + '_MChiSegmented.csv'
    BasinInfoName = DataDirectory + Base_file + '_AllBasinsInfo.csv'

    #FigFormat = 'svg'
    #FigFileN= 'Sorbas_chi.svg'
    #FigFileName= DataDirectory+FigFileN
    elevation_threshold = 1
    size_format = "geomorphology"

    #======================================
    # This tests the basin sorting
    #Junction_list = [[3,0,2,1],[4],[6,7,8,9,10]]

    #LSDP.BasinKeyToJunction(Junction_list,BasinInfoName)
    #LSDP.BasinOrderer(BasinInfoName, DEMname, "outlet_longitude",reverse=True)
    threshold_length = 5
    thisPointData = LSDP.LSDMap_PointData(ChiName)
    these_source_nodes = LSDP.FindSourceInformation(thisPointData)
    remaining_sources = LSDP.FindShortSourceChannels(these_source_nodes,
                                                     threshold_length)
    print("The remaining sources are: ")
    print(remaining_sources)
    print("The number of remaining sources are: " +
          str(len(remaining_sources)))
    #======================================

    #======================================
    # Uncomment this for a basic plot of the hillshade draped over the elevation,
    # With chi on top, using the cubehelix colour scheme
    FigName = DataDirectory + 'Meghalaya_Ksn_plot_CubeHelix.png'
    LSDP.BasicChiPlotGridPlot(DEMname, HSname, ChiName, thisPointData, 'gray',
                              'gray', '$k_{sn}$', (0, 0), 0.4, FigName, 'png',
                              elevation_threshold, size_format)
    #======================================

    #======================================
    # Uncomment this for a basic plot of the hillshade draped over the elevation,
    # With chi on top, using the kirby and whipple colour scheme
    #FigName = DataDirectory+'Chi_plot_KW.png'
    #LSDP.BasicChiPlotGridPlotKirby(DEMname,HSname,ChiName, 'gray','gray',
    #                        '$k_{sn}$',(0,0),
    #                        0.4,FigName,'png',elevation_threshold)
    #======================================

    #======================================
    # Uncomment this for a plot of channels color coded by their sources
    #FigName2 = DataDirectory+'Meghalaya_ChannelMap.png'
    #source_thinning_threshold = 10
    #LSDP.BasicChannelPlotGridPlotCategories(DEMname,HSname,ChiName, 'gray','gray',
    #                        '$Channel$',(0,0),
    #                        0.4,FigName2,'png',elevation_threshold,'source_key',
    #                        source_thinning_threshold,
    #                        size_format)
    #======================================

    #======================================
    # Uncomment this for a very rudimentary plot of the chi profiles
    #FigName3 =  DataDirectory+'ChiProfiles.png'
    #this_basins_list = [3,0,2,1]
    #basin_rename_list = []
    #basin_rename_list =[1,3,2,0,4,5,8,6,7,9,10]

    #source_thinning_threshold = 7
    #label_sources = False
    #this_basins_list = [7,10]
    #basin_rename_order = [7,10,9,12,8,11,13,4,2,1,0,3,5,6]
    #basin_rename_list = LSDP.BasinOrderToBasinRenameList(basin_rename_order)

    #LSDP.ChiProfiles(ChiName, FigName3,'png',this_basins_list,
    #                        basin_rename_list,False,elevation_threshold,source_thinning_threshold,
    #                        size_format)
    #======================================

    #======================================
    # Uncomment this for a stack of chi plots
    #FigName4 =  DataDirectory+'Meghalaya_SWbasins_chi.png'
    #first_basin = 0
    #last_basin = 10
    #chi_offset = 15
    #this_basins_list = [7,10]
    #basin_rename_order = [7,10,9,12,8,11,13,4,2,1,0,3,5,6]
    #basin_rename_list = LSDP.BasinOrderToBasinRenameList(basin_rename_order)
    #LSDP.StackedChiProfiles(ChiName, FigName4,'png',elevation_threshold,
    #                        first_basin,last_basin,this_basins_list,
    #                        basin_rename_list,chi_offset,False,
    #                        source_thinning_threshold,
    #                        size_format)
    #======================================

    #======================================
    # Uncomment this for just a plot of the hillshade draped over topography
    #FigName = DataDirectory+'Basic_plot.png'
    #LSDP.BasicDrapedPlotGridPlot(DEMname,HSname, 'gray','gray',
    #                        'Elevation in meters',(0,0),
    #                        0.4,FigName,'png')
    #======================================

    #======================================
    # Uncomment this for a plot of the basins draped over a fancy hillshde map
    # The basins will have no numbering
    #FigName8 = DataDirectory+'BasinPlot.png'
    #LSDP.DrapedOverFancyHillshade(DEMname,HSname,Basinname, 'gray','cubehelix',
    #                        'Basin Number',(0,0),
    #                        0.4,FigName8,'png',elevation_threshold)
    #======================================

    #======================================
    # Uncomment this for a plot of the basins draped over a fancy hillshde map
    # with the basins annotated onto the figure
    FigName9 = DataDirectory + 'MeghalayaBasins.png'
    spread = 15
    basin_rename_order = [7, 10, 9, 12, 8, 11, 13, 4, 2, 1, 0, 3, 5, 6]
    basin_rename_list = LSDP.BasinOrderToBasinRenameList(basin_rename_order)
    Junction_list = [[3, 0, 1, 2], [4, 5, 6, 7], [10, 9, 12, 8, 11, 13]]
    #print basin_rename_list
    basin_point_data = LSDP.LSDMap_PointData(BasinInfoName)
    channel_point_data = LSDP.LSDMap_PointData(ChiName)
    LSDP.BasinsOverFancyHillshade(
        DEMname, HSname, Basinname, BasinInfoName, basin_point_data, 'gray',
        'gist_earth', (0, 0), 0.4, FigName9, 'png', elevation_threshold,
        Junction_list, basin_rename_list, spread, channel_point_data, False,
        threshold_length, size_format)