Esempio n. 1
0
def concavityCatcher(full_path, write_name, processed=False):
    #returns the basin_key and median concavity
    write_name = '/' + write_name
    #reading in the basin info
    BasinDF = Helper.ReadMCPointsCSV(full_path, write_name)
    #Getting mn data
    PointsDF = MN.GetMOverNRangeMCPoints(BasinDF,
                                         start_movern=0.1,
                                         d_movern=0.05,
                                         n_movern=18)
    #extract basin key and concavity as list
    basin_series = PointsDF["basin_key"]
    concavity_series = PointsDF["Median_MOverNs"]
    basin_key = basin_series.tolist()
    basin_keys = []
    for x in basin_key:
        x = int(x)
        basin_keys.append(x)

    concavities = concavity_series.tolist()

    if not processed:
        return basin_keys, concavities

    if processed:
        #processed_concavities = []
        #print("this is the processed DF")
        #print processedDF
        processed_basin = processedDF["basin_key"]
        processed_concavity = processedDF["Median_MOverNs"]
        basin_list = processed_basin.tolist()
        concavity_list = processed_concavity.tolist()
        return basin_list, concavity_list
Esempio n. 2
0
def concavityCatcher(full_path,
                     write_name,
                     processed=False,
                     basins_not_glaciated=[]):
    #returns the basin_key and median concavity
    write_name = '/' + write_name
    #reading in the basin info
    BasinDF = Helper.ReadMCPointsCSV(full_path, write_name)
    #Getting mn data
    PointsDF = MN.GetMOverNRangeMCPoints(BasinDF,
                                         start_movern=0.25,
                                         d_movern=0.05,
                                         n_movern=8)
    #extract basin key and concavity as list
    basin_series = PointsDF["basin_key"]
    concavity_series = PointsDF["Median_MOverNs"]
    basin_key = basin_series.tolist()
    basin_keys = []
    for x in basin_key:
        x = int(x)
        basin_keys.append(x)

    concavities = concavity_series.tolist()

    if not processed:
        return basin_keys, concavities

    if processed:
        #processed_concavities = []
        #for x in basins_not_glaciated:
        processedDF = PointsDF[PointsDF.basin_key.isin(basins_not_glaciated)]
        print("this is the processed DF")
        print processedDF
        if basin_key != basins_not_glaciated:
            sys.exit()
Esempio n. 3
0
def concavityCatcher(full_path,write_name,processed=False,disorder_based=False,basins_not_glaciated=[]):
    print("opened concavityCatcher")
    #returns the basin_key and median concavity
    write_name = '/'+write_name
    #reading in the basin info
    if not disorder_based:
        BasinDF = Helper.ReadMCPointsCSV(full_path,write_name)  
        #Getting mn data
        PointsDF = MN.GetMOverNRangeMCPoints(BasinDF,start_movern=0.25,d_movern=0.05,n_movern=8)
        #extract basin key and concavity as list
        basin_series = PointsDF["basin_key"]
        concavity_series = PointsDF["Median_MOverNs"]
        basin_key = basin_series.tolist()
        basin_keys = []
        for x in basin_key:
            x = int(x)
            basin_keys.append(x)
    
        concavities = concavity_series.tolist()
        
        if not processed:
            return basin_keys,concavities
    
        if processed:
            #processed_concavities = []
            #for x in basins_not_glaciated:
            processedDF = PointsDF[PointsDF.basin_key.isin(basins_not_glaciated)]
            #print("this is the processed DF")
            #print processedDF
            processed_basin = processedDF["basin_key"]
            processed_concavity = processedDF["Median_MOverNs"]
            basin_list = processed_basin.tolist()
            concavity_list = processed_concavity.tolist()
            return basin_list,concavity_list

    if disorder_based:
        print("getting basin keys")
        infoDF = Helper.ReadBasinInfoCSV(full_path,write_name)
        #print infoDF
        basinSeries = infoDF["basin_key"]
        basin_key = basinSeries.tolist()
        basin_keys = []
        for x in basin_key:
            x = int(x)
            basin_keys.append(x)
        print("got keys, getting disorder")
        disorder_concavity = getDisorderConcavity(full_path,write_name,basin_keys)
        print("concavities:")
        print disorder_concavity
        return basin_keys,disorder_concavity            
def basinsWithDesiredConcavity(full_path, write_name, concavity):
    #returns a list of basins with the desired concavity
    write_name = '/' + write_name
    #reading in the basin info
    BasinDF = Helper.ReadMCPointsCSV(full_path, write_name)
    #Getting mn data
    PointsDF = MN.GetMOverNRangeMCPoints(BasinDF,
                                         start_movern=0.1,
                                         d_movern=0.05,
                                         n_movern=18)
    #selecting by concavity
    selectedDF = PointsDF[PointsDF["Median_MOverNs"] == concavity]
    concavitySeries = selectedDF["basin_key"]
    concavityList = concavitySeries.tolist()
    return concavityList
Esempio n. 5
0
def concavityCatcher(full_path,write_name):
    #returns the basin_key and median concavity
    write_name = '\\'+write_name
    #reading in the basin info
    BasinDF = Helper.ReadMCPointsCSV(full_path,write_name)  
    #Getting mn data
    PointsDF = MN.GetMOverNRangeMCPoints(BasinDF,start_movern=0.25,d_movern=0.05,n_movern=8)
    #extract basin key and concavity as list
    basin_series = PointsDF["basin_key"]
    concavity_series = PointsDF["Median_MOverNs"]
    basin_key = basin_series.tolist()
    basin_keys = []
    for x in basin_key:
        x = int(x)
        basin_keys.append(x)
    
    concavities = concavity_series.tolist()
    return basin_keys,concavities
Esempio n. 6
0
def concavityCatcher(full_path,
                     write_name,
                     processed=False,
                     basins_not_glaciated=[],
                     alter_ID=True):
    #returns the basin_key and median concavity
    write_name = '/' + write_name
    #reading in the basin info

    BasinDF = Helper.ReadMCPointsCSV(full_path, write_name)
    #Getting mn data
    PointsDF = MN.GetMOverNRangeMCPoints(BasinDF,
                                         start_movern=0.1,
                                         d_movern=0.05,
                                         n_movern=18)
    #extract basin key and concavity as list
    basin_series = PointsDF["basin_key"]
    concavity_series = PointsDF["Median_MOverNs"]

    if not disorder:
        basin_key = basin_series.tolist()
        basin_keys = []
        for x in basin_key:
            x = int(x)
            basin_keys.append(x)

        concavities = concavity_series.tolist()

    if disorder:
        print "got to disorder"
        print full_path, write_name
        if not alter_ID:
            basin_keys, concavities = getDisorderConcavity(
                full_path,
                write_name,
                fromConcavityCatcher=True,
                alter_ID=False)
        else:
            basin_keys, concavities, new_IDs = getDisorderConcavity(
                full_path, write_name, fromConcavityCatcher=True)
    if not processed:
        print concavities
        return basin_keys, concavities, new_IDs

    if processed:
        print "got to processed"

        #processed_concavities = []
        #for x in basins_not_glaciated:
        try:
            processedDF = PointsDF[PointsDF.basin_key.isin(
                basins_not_glaciated)]

        except Exception as e:
            print e
            print "error in processed section of concavity catcher"

        #print("this is the processed DF")

        processed_basin = processedDF["basin_key"]
        processed_concavity = processedDF["Median_MOverNs"]
        basin_list = processed_basin.tolist()
        concavity_list = processed_concavity.tolist()

        return basin_list, concavity_list
Esempio n. 7
0
import sys
import os
import pandas as pd
import csv

#LSDTopoTools specific imports
#Loading the LSDTT setup configuration
setup_file = open('chi_automation.config','r')
LSDMT_PT = setup_file.readline().rstrip()
LSDMT_MF = setup_file.readline().rstrip()
Iguanodon = setup_file.readline().rstrip() 
setup_file.close()

sys.path.append(LSDMT_PT)
sys.path.append(LSDMT_MF)
sys.path.append(Iguanodon)

from LSDPlottingTools import LSDMap_MOverNPlotting as MN
from LSDMapFigure import PlottingHelpers as Helper

current_path = '/exports/csce/datastore/geos/users/s1134744/LSDTopoTools/Topographic_projects/precip_test/27.00_90.35_himalaya_27.0_13/100000/'
writing_prefix = '13100000_120000'

BasinDF = Helper.ReadMCPointsCSV(current_path,writing_prefix)
PointsDF = MN.GetMOverNRangeMCPoints(BasinDF,start_movern=0.1,d_movern=0.1,n_movern=9)
PointsDF.to_csv(current_path+writing_prefix+'mn_stats.csv', mode="w",header=True,index=False)