示例#1
0
import shutil


class segs:
    def __init__(self, segnum):
        self.seg = segnum
        self.reaches = None
        self.strtop = None
        self.stage = None
        self.slope = None
        self.altered = False


infile = 'SFR_input_NACP.xml'

SFRdata = SFRc.SFRInput(infile)

inreachdat = np.genfromtxt(SFRdata.MAT1, names=True, dtype=None, delimiter=',')
fileheader = open(SFRdata.MAT1).readline()
allsegs = np.unique(inreachdat['segment'])

segdata = dict()

# read in the segment data from the input file
for cseg in allsegs:
    segdata[cseg] = segs(cseg)
    inds = np.squeeze(np.where(inreachdat['segment'] == cseg))
    segdata[cseg].reaches = np.atleast_1d(inreachdat['reach'][inds])
    segdata[cseg].strtop = np.atleast_1d(inreachdat['top_streambed'][inds])
    segdata[cseg].stage = np.atleast_1d(inreachdat['stage'][inds])
    segdata[cseg].slope = np.atleast_1d(inreachdat['bed_slope'][inds])
示例#2
0
SFRpre.intersect_DEM(SFRdata)  # this needs to be in the example Main!
DEMelevs = SFRc.ElevsFromDEM()
DEMelevs.DEM_elevs_by_FragID(SFRdata, SFRops)
DEMelevs.connect_downhill(FragIDdata)


# Comparison plots of streambed elevations (by COMID) for different elevation methods
SFRp = sfr_plots.plot_elevation_profiles(SFRdata)
SFRp.read_DIS()




SFRp.get_comid_plotting_info(FragIDdata, COMIDdata, SFRdata)
SFRp.plot_profiles('Elevation_method_comparison.pdf')
'''
saveme ={'COMIDdata' : COMIDdata,
         'FragIDdata' : FragIDdata,
         'LevelPathdata' : LevelPathdata,
         'CELLdata' : CELLdata, 'SFRdata':  SFRdata,}
SFRc.savetmp(saveme)


a = SFRc.loadtmp['SFRdata', 'COMIDdata', 'CELLdata', 'FragIDdata', 'LevelPathdata']

COMIDdata = a['COMIDdata']
FragIDdata = a['FragIDdata']
LevelPathdata = a['LevelPathdata']
CELLdata = a['CELLdata']
SFRdata = a['SFRdata']
'''
示例#3
0
__author__ = 'Fienen, Reeves, Leaf - USGS'

import SFR_classes as SFRc
import sfr_plots

infile = 'SFR_input_BR.xml'

SFRdata = SFRc.SFRInput(infile)

SFRpre = SFRc.SFRpreproc(SFRdata)

SFRops = SFRc.SFROperations(SFRdata)

if SFRdata.preproc:
    print 'Running preprocessing routine'

    #SFRpre.clip_and_join_attributes(SFRops)

SFRops.intersect()

FragIDdata = SFRc.FragIDPropsAll()

FragIDdata.populate(SFRdata)

FragIDdata.return_FragID_comid_list()

SFRops.make_rivers_table(FragIDdata)

FragIDdata.populate_elevations(SFRdata)

COMIDdata = SFRc.COMIDPropsAll()
示例#4
0
__author__ = 'Fienen, Reeves, Leaf - USGS'

import sys
sys.path.append(
    'D:\\ATLData\\Documents\\GitHub\\SFR\\')  # path to SFRmaker files
import SFR_classes as SFRc

infile = 'Example.xml'

SFRdata = SFRc.SFRInput(infile)

SFRpre = SFRc.SFRpreproc(SFRdata)

SFRops = SFRc.SFROperations(SFRdata)

if SFRdata.preproc:
    print 'Running preprocessing routine'

    SFRpre.clip_and_join_attributes(SFRops)

SFRops.intersect()

FragIDdata = SFRc.FragIDPropsAll()

FragIDdata.populate(SFRdata)

FragIDdata.return_FragID_comid_list()

SFRops.make_rivers_table(FragIDdata)

FragIDdata.populate_elevations(SFRdata)
示例#5
0
         'CELLdata' : CELLdata, 'SFRdata':  SFRdata,}
SFRc.savetmp(saveme)


a = SFRc.loadtmp['SFRdata', 'COMIDdata', 'CELLdata', 'FragIDdata', 'LevelPathdata']

COMIDdata = a['COMIDdata']
FragIDdata = a['FragIDdata']
LevelPathdata = a['LevelPathdata']
CELLdata = a['CELLdata']
SFRdata = a['SFRdata']
"""
SFRops.reach_ordering(COMIDdata, FragIDdata, LevelPathdata)

Segmentdata = SFRc.SFRSegmentsAll()
"""
saveme ={'SFRdata':  SFRdata, 'COMIDdata': COMIDdata, 'FragIDdata': FragIDdata,
              'SFRops': SFRops, 'LevelPathdata' : LevelPathdata, 'CELLdata' : CELLdata}

SFRc.savetmp(saveme)


a = SFRc.loadtmp(['SFRdata', 'CELLdata', 'COMIDdata', 'FragIDdata', 'SFRops', 'LevelPathdata'])

SFRdata = a['SFRdata']
COMIDdata = a['COMIDdata']
FragIDdata = a['FragIDdata']
SFRops = a['SFRops']
LevelPathdata = a['LevelPathdata']
CELLdata = a['CELLdata']
"""
示例#6
0
# script for running Assign Layers outside of SFR_main
__author__ = 'Fienen, Reeves, Leaf - USGS'

import sys
sys.path.append('D:/ATLData/Documents/GitHub/SFR')
import SFR_classes as SFRc
import sfr_plots

infile = 'SFR_input_BR.xml'

SFRdata = SFRc.SFRInput(infile)
'''
SFRp = sfr_plots.plot_elevation_profiles(SFRdata)
SFRp.plot_Mat1_profiles('Segment_profiles_from_Mat1.pdf')
'''
SFRops = SFRc.SFROperations(SFRdata)

SFRops.assign_layers(SFRdata)


SFRoutput = SFRc.SFRoutput(SFRdata)
SFRoutput.build_SFR_package()
#SFRoutput.buildSFRshapefile2()