Demo entry 6762305

lid_database

   

Submitted by anonymous on Oct 11, 2018 at 15:47
Language: Python 3. Code size: 8.6 kB.

#lid库--基因库
file=open('D:\gene.txt','w')
import time
T=time.time()
import numpy as np 
soil=[[120,49.0,0.437,0.062,0.024,30],#土壤类型参数 后1项为conductivity slope,取值有问题;单位转化inch to mm
      [30.0,61.0,0.437,0.105,0.047,36],
      [10.9,110,0.453,0.190,0.085,39],
      [3.30,88.9,0.463,0.232,0.116,48],
      [6.60,170,0.501,0.284,0.135,54],
      [1.52,220,0.398,0.244,0.136,42],
      [1.02,210,0.464,0.310,0.187,51],
      [1.02,270,0.471,0.342,0.210,57],
      [0.508,240,0.430,0.321,0.221,45],
      [0.508,290,0.479,0.371,0.251,57],
      [0.254,320,0.475,0.378,0.265,60]]
drain=[[0,0,0,0,0,0],
       [1,0.5,0,0,0,0],
       [2,0.5,0,0,0,0]]
def lid_database(z):
    global file
    for z_value in z:
        for z_value_value in z_value:
            if z_value_value==z_value[0]:
                file.write('{0:<17}'.format(z_value_value))
            else:
                file.write('{0:<11}'.format(z_value_value))
        file.write('\n')
    file.write('\n')
    return


    #bio-cell(BC)

name,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u=1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
v,w,x,y,z,aa,bb=0,0,0,0,0,0,0
BC=[['BC'+str(name),'BC'],
    ['BC'+str(name),'SURFACE',a,b,c,d,'5'],
    ['BC'+str(name),'SOIL',e,f,g,h,i,j,k],
    ['BC'+str(name),'STORAGE',l,m,n,o],
    ['BC'+str(name),'DRAIN',p,q,r,s,t,u]]
d=0
for a in range(0,40,10):                #http://www.water8848.com/news/201806/21/113005.html
    for b in [0,0.1,0.2]:          #粗糙度和植被覆盖匹配,3种类型(SWMM)
        if b==0:
            c=0.15
        if b==0.1:
            c=0.24
        if b==0.2:
            c=0.4
        for e in range(450,901,150):  #soil layer
            for soil_value in soil:
                i,k,f,g,h,j=soil_value
                for l in range(150,451,150):#storage layer
                    for m in [0.50,0.55,0.60,0.65,0.70,0.75]:
                        n,o=i,0               #取值方法有问题,o=0忽略阻塞
                        for drain_value in drain:
                            p,q,r,s,t,u=drain_value
                            
                            BC=[['BC'+str(name),'BC'],
                                ['BC'+str(name),'SURFACE',a,b,c,d,'5'],
                                ['BC'+str(name),'SOIL',e,f,g,h,i,j,k],
                                ['BC'+str(name),'STORAGE',l,m,n,o],
                                ['BC'+str(name),'DRAIN',p,q,r,s,t,u]]
                            lid_database(BC)
                            name+=1
print(time.time()-T)                           
    #rain garden(RG)
RG=[['RG'+str(name),'RG'],
    ['RG'+str(name),'SURFACE',a,b,c,d,'5'],
    ['RG'+str(name),'SOIL',e,f,g,h,i,j,k],
    ['RG'+str(name),'STORAGE',l,m,n,o]]    
d,name=0,1
l,m,o=0,0.75,0
for a in range(100,151,10):  #surface
    for b in [0,0.1,0.2]:          #粗糙度和植被覆盖匹配,3种类型(SWMM)
        if b==0:
            c=0.15
        if b==0.1:
            c=0.24
        if b==0.2:
            c=0.4
        for e in range(450,901,150):  #soil layer
            for soil_value in soil:
                i,k,f,g,h,j=soil_value
                n=i
                RG=[['RG'+str(name),'RG'],
                    ['RG'+str(name),'SURFACE',a,b,c,d,'5'],
                    ['RG'+str(name),'SOIL',e,f,g,h,i,j,k],
                    ['RG'+str(name),'STORAGE',l,m,n,o]]
                lid_database(RG)
                name+=1
print(time.time()-T)
    #green roof(GR)
GR=[['GR'+str(name),'GR'],
    ['GR'+str(name),'SURFACE',a,b,c,d,'5'],
    ['GR'+str(name),'SOIL',e,f,g,h,i,j,k],
    ['GR'+str(name),'DRAINMAT',l,m,n]]
name=1
for a in range(0,1001,100): #surface
    for b in [0,0.1,0.2]:          #粗糙度和植被覆盖匹配,3种类型(SWMM)
        if b==0:
            c=0.15
        if b==0.1:
            c=0.24
        if b==0.2:
            c=0.4
        d=0            #坡度根据roof决定
        for e in range(75,151,20):#soil layer
            for soil_value in soil:
                i,k,f,g,h,j=soil_value
                for l in range(25,51,5):
                    for m in [x/100 for x in range(50,61,5)]:
                        for n in [x/10 for x in range(1,5,1)]:
                            GR=[['GR'+str(name),'GR'],
                                ['GR'+str(name),'SURFACE',a,b,c,d,'5'],
                                ['GR'+str(name),'SOIL',e,f,g,h,i,j,k],
                                ['GR'+str(name),'DRAINMAT',l,m,n]]
                            lid_database(GR)
                            name+=1
print(time.time()-T) 
    #infil trench(IT)
IT=[['IT'+str(name),'IT'],
    ['IT'+str(name),'SURFACE',a,b,c,d,'5'],
    ['IT'+str(name),'STORAGE',l,m,n,o],
    ['IT'+str(name),'DRAIN',p,q,r,s,t,u]]
name=1
for a in range(0,305,100):#surface
    for b in [0,0.1,0.2]:          #粗糙度和植被覆盖匹配,3种类型(SWMM)
        if b==0:
            c=0.15
        if b==0.1:
            c=0.24
        if b==0.2:
            c=0.4
        for d in [e/10 for e in range(0,11,2)]:
            for l in range(150,451,150): #storage
                for m in [e/10 for e in range(50,80,10)]:
                    for soil_value in soil:
                        i,k,f,g,h,j=soil_value
                        n=i
                        for drain_value in drain:#drain
                            p,q,r,s,t,u=drain_value
                            IT=[['IT'+str(name),'IT'],
                                ['IT'+str(name),'SURFACE',a,b,c,d,'5'],
                                ['IT'+str(name),'STORAGE',l,m,n,o],
                                ['IT'+str(name),'DRAIN',p,q,r,s,t,u]]
                            lid_database(IT)
                            name+=1
                            
print(time.time()-T)              
    #permable pavement(PP)
PP=[['PP'+str(name),'PP'],
    ['PP'+str(name),'SURFACE',a,b,c,d,'5'],
    ['PP'+str(name),'PAVEMENT',v,w,x,y,z,aa,bb],
    ['PP'+str(name),'SOIL',e,f,g,h,i,j,k],
    ['PP'+str(name),'STORAGE',l,m,n,o],
    ['PP'+str(name),'DRAIN',p,q,r,s,t,u]]   
name=1
a=0# surface
b=0
z=0  #不考虑堵塞
aa=0
bb=0
o=0
for c in [x/1000 for x in range(10,21,5)]:
    for d in [2,4]:
        for v in range(100,151,25): #pavement
            for w in [x/100 for x in range(12,23,5)]:
                for x in [x/100 for x in range(0,101,25)]:
                    for y in range(3000,10000,3000): #pavement透水率 没有找到范围
                        for e in range(450,901,150):#soil layer
                            for soil_value in soil:
                                i,k,f,g,h,j=soil_value
                                for l in range(150,451,150):
                                    for m in [x/100 for x in range(50,81,15)]:
                                        n=i
                                        for drain_value in drain:# drain
                                            p,q,r,s,t,u=drain_value
                                            PP=[['PP'+str(name),'PP'],
                                                ['PP'+str(name),'SURFACE',a,b,c,d,'5'],
                                                ['PP'+str(name),'PAVEMENT',v,w,x,y,z,aa,bb],
                                                ['PP'+str(name),'SOIL',e,f,g,h,i,j,k],
                                                ['PP'+str(name),'STORAGE',l,m,n,o],
                                                ['PP'+str(name),'DRAIN',p,q,r,s,t,u]]
                                            lid_database(PP)
                                            name+=1
print(time.time()-T) 
    #rooftop disconnection(RD)
RD=[['RD'+str(name),'RD'],
    ['RD'+str(name),'SURFACE',a,b,c,d,'5'],
    ['RD'+str(name),'DRAIN',p,q,r,s,t,u]] 
name=1
b=0.0
for a in [e/10 for e in range(13,26,2)]:
    for c in [e/1000 for e in range(13,17,2)]:
        d=1 #根据屋顶坡度决定
        RD=[['RD'+str(name),'RD'],
            ['RD'+str(name),'SURFACE',a,b,c,d,'5'],
            ['RD'+str(name),'DRAIN',p,q,r,s,t,u]]
        lid_database(RD)
        name+=1
print(time.time()-T)       
    #vegetative swale(VS)
VS=[['VS'+str(name),'VS'],
    ['VS'+str(name),'SURFACE',a,b,c,d,e]]
name=1
for a in range(150,451,100):
    for b in [0,0.1,0.2]:          #粗糙度和植被覆盖匹配,3种类型(SWMM)
        if b==0:
            c=0.15
        if b==0.1:
            c=0.24
        if b==0.2:
            c=0.4
        for d in range(2,7,1):
            for e in [f/100 for f in range(25,36,5)]:
                VS=[['VS'+str(name),'VS'],
                    ['VS'+str(name),'SURFACE',a,b,c,d,e]] 
                lid_database(VS)
                name+=1
file.close()
print(time.time()-T)

This snippet took 0.03 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).