count += 1 stations_list.append(station_line.split(",")[4]) station_nr.append(count) stations_dict[str(count)] = station(pcp_file_line) # making header pcp_string = "Station " for key in range(1, len(stations_list) + 1): pcp_string += stations_dict[str(key)].name + "," pcp_string += "\nLati " for key in range(1, len(stations_list) + 1): pcp_string += cj.trailing_spaces(5, stations_dict[str(key)].lat, 1) pcp_string += "\nLong " for key in range(1, len(stations_list) + 1): pcp_string += cj.trailing_spaces(5, stations_dict[str(key)].lon, 1) pcp_string += "\nElev " for key in range(1, len(stations_list) + 1): pcp_string += cj.trailing_spaces(5, stations_dict[str(key)].elev, 0) pcp_string += "\n" current_year = int(stations_dict["1"].data_list[0][0:4]) end_day = cj.get_days_in_year(current_year)
CH_ERODMO3 = sub_record.split(",")[26].strip('"') CH_ERODMO4 = sub_record.split(",")[27].strip('"') CH_ERODMO5 = sub_record.split(",")[28].strip('"') CH_ERODMO6 = sub_record.split(",")[29].strip('"') CH_ERODMO7 = sub_record.split(",")[30].strip('"') CH_ERODMO8 = sub_record.split(",")[31].strip('"') CH_ERODMO9 = sub_record.split(",")[32].strip('"') CH_ERODMO10 = sub_record.split(",")[33].strip('"') CH_ERODMO11 = sub_record.split(",")[34].strip('"') CH_ERODMO12 = sub_record.split(",")[35].strip('"') CH_EQN = sub_record.split(",")[36].strip('"') # Building String rte_file = " .rte file Subbasin: " + SubBasin + " " + DateAndTime + " " + SWAT_Vers + \ "\n" + cj.trailing_spaces(14, CHW2, 3) + " | CHW2 : Main channel width [m]" + \ "\n" + cj.trailing_spaces(14, CHD, 3) + " | CHD : Main channel depth [m]" + \ "\n" + cj.trailing_spaces(14, CH_S2, 5) + " | CH_S2 : Main channel slope [m/m]" + \ "\n" + cj.trailing_spaces(14, CH_L2, 3) + " | CH_L2 : Main channel length [km]" + \ "\n" + cj.trailing_spaces(14, CH_N2, 3) + " | CH_N2 : Manning's nvalue for main channel" + \ "\n" + cj.trailing_spaces(14, CH_K2, 3) + " | CH_K2 : Effective hydraulic conductivity [mm/hr]" + \ "\n" + cj.trailing_spaces(14, CH_COV1, 3) + " | CH_COV1: Channel erodibility factor" + \ "\n" + cj.trailing_spaces(14, CH_COV2, 3) + " | CH_COV2 : Channel cover factor" + \ "\n" + cj.trailing_spaces(14, CH_WDR, 3) + " | CH_WDR : Channel width:depth ratio [m/m]" + \ "\n" + cj.trailing_spaces(14, ALPHA_BNK, 3) + " | ALPHA_BNK : Baseflow alpha factor for bank storage [days]" + \ "\n" + cj.trailing_spaces(14, ICANAL, 2) + " | ICANAL : Code for irrigation canal" + \ "\n" + cj.trailing_spaces(14, CH_ONCO, 2) + " | CH_ONCO : Organic nitrogen concentration in the channel [ppm]" + \ "\n" + cj.trailing_spaces(14, CH_OPCO, 2) + " | CH_OPCO : Organic phosphorus concentration in the channel [ppm]" + \ "\n" + cj.trailing_spaces(14, CH_SIDE, 2) + " | CH_SIDE : Change in horizontal distance per unit vertical distance" + \ "\n" + cj.trailing_spaces(14, CH_BNK_BD, 2) + " | CH_BNK_BD : Bulk density of channel bank sediment (g/cc)" + \ "\n" + cj.trailing_spaces(14, CH_BED_BD, 2) + " | CH_BED_BD : Bulk density of channel bed sediment (g/cc)" + \
later_reaches_order.append(reach_dictionary[str(current_reach)].number) elif not reach_dictionary[str(current_reach)].receives_from[1] in sinks: if detour_reaches == []: break current_reach = detour_reaches[0] #print detour_reaches #print "--------------------------------\n\tskipping to :" + str(current_reach) current_rank -= 3 detour_reaches.remove(current_reach) reach_dictionary[str(current_reach)].order_number = int(current_rank) later_reaches_order.append(reach_dictionary[str(current_reach)].number) #print current_rank # create the string for first part for subb_nr in range(1, len(reach_table) + 1): fig_string += "subbasin 1" + cj.trailing_spaces(6, subb_nr, 0) + cj.trailing_spaces(6, subb_nr, 0) + " Subbasin: " + str(subb_nr) + \ "\n " + cj.trailing_zeros(5, subb_nr, 0) + "0000.sub\n" #create string for second part first_confluence_string = "" for route in reaches: if route not in sinks: first_confluence_string += "route 2" + cj.trailing_spaces(6, reach_dictionary[str(route)].order_number, 0) + cj.trailing_spaces(6, route, 0) + cj.trailing_spaces(6, route, 0) + \ "\n " + cj.trailing_zeros(5, route, 0) + "0000.rte" + cj.trailing_zeros(5, route, 0) + "0000.swq\n" #reach_dictionary[str(route)] # create a dictionary of reaches in accending order #print later_reaches_order # we make the ending of the fig.fig string fig_bottom = "\nsaveconc 14" + cj.trailing_spaces(6, reach_dictionary[str(end_reach)].order_number, 0) + " 1 0" + \
SOL_PH2 = hru_record.split(",")[144].strip('"') SOL_PH3 = hru_record.split(",")[145].strip('"') SOL_PH4 = hru_record.split(",")[146].strip('"') SOL_PH5 = hru_record.split(",")[147].strip('"') SOL_PH6 = hru_record.split(",")[148].strip('"') SOL_PH7 = hru_record.split(",")[149].strip('"') SOL_PH8 = hru_record.split(",")[150].strip('"') SOL_PH9 = hru_record.split(",")[151].strip('"') SOL_PH10 = hru_record.split(",")[152].strip('"') # Building String Sol_file = " .Sol file Watershed HRU:" + WshedHRU + " Subbasin:" + SubBasin + " HRU:" + HRU_No + " Luse:" + Luse + " Soil: " + Soil + " Slope: " + Slope + " " + \ DateAndTime + " " + SWAT_Vers + \ "\n Soil Name: " + SNAM + \ "\n Soil Hydrologic Group: " + HYDGRP + \ "\n Maximum rooting depth(mm) :" + cj.trailing_spaces(8, int(float(SOL_ZMX)), 2) + \ "\n Porosity fraction from which anions are excluded: " + '{0:.3f}'.format(float(ANION_EXCL)) + \ "\n Crack volume potential of soil: " + '{0:.3f}'.format(float(SOL_CRK)) + \ "\n Texture 1 : " + TEXTURE + \ "\n Depth [mm]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SOL_Z1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SOL_Z2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SOL_Z3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SOL_Z4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SOL_Z5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SOL_Z6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SOL_Z7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SOL_Z8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SOL_Z9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SOL_Z10, 2)) + \ "\n Bulk Density Moist [g/cc]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SOL_BD1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SOL_BD2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SOL_BD3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SOL_BD4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SOL_BD5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SOL_BD6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SOL_BD7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SOL_BD8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SOL_BD9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SOL_BD10, 2)) + \ "\n Ave. AW Incl. Rock Frag :" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SOL_AWC1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SOL_AWC2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SOL_AWC3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SOL_AWC4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SOL_AWC5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SOL_AWC6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SOL_AWC7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SOL_AWC8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SOL_AWC9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SOL_AWC10, 2)) + \ "\n Ksat. (est.) [mm/hr]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K1 == "0.0" else SOL_K1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K2 == "0.0" else SOL_K2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K3 == "0.0" else SOL_K3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K4 == "0.0" else SOL_K4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K5 == "0.0" else SOL_K5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K6 == "0.0" else SOL_K6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K7 == "0.0" else SOL_K7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K8 == "0.0" else SOL_K8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K9 == "0.0" else SOL_K9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, 0.01 if SOL_K10 == "0.0" else SOL_K10, 2)) + \ "\n Organic Carbon [weight %]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SOL_CBN1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SOL_CBN2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SOL_CBN3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SOL_CBN4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SOL_CBN5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SOL_CBN6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SOL_CBN7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SOL_CBN8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SOL_CBN9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SOL_CBN10, 2)) + \ "\n Clay [weight %]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, CLAY1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, CLAY2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, CLAY3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, CLAY4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, CLAY5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, CLAY6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, CLAY7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, CLAY8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, CLAY9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, CLAY10, 2)) + \ "\n Silt [weight %]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SILT1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SILT2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SILT3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SILT4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SILT5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SILT6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SILT7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SILT8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SILT9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SILT10, 2)) + \ "\n Sand [weight %]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SAND1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SAND2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SAND3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SAND4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SAND5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SAND6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SAND7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SAND8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SAND9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SAND10, 2)) + \ "\n Rock Fragments [vol. %]:" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, ROCK1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, ROCK2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, ROCK3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, ROCK4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, ROCK5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, ROCK6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, ROCK7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, ROCK8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, ROCK9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, ROCK10, 2)) + \ "\n Soil Albedo (Moist) :" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SOL_ALB1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SOL_ALB2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SOL_ALB3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SOL_ALB4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SOL_ALB5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SOL_ALB6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SOL_ALB7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SOL_ALB8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SOL_ALB9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SOL_ALB10, 2)) + \ "\n Erosion K :" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, USLE_K1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, USLE_K2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, USLE_K3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, USLE_K4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, USLE_K5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, USLE_K6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, USLE_K7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, USLE_K8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, USLE_K9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, USLE_K10, 2)) + \ "\n Salinity (EC, Form 5) :" + ("" if int(float(SOL_Z1)) == int(0) else cj.trailing_spaces(12, SOL_EC1, 2)) + ("" if int(float(SOL_Z2)) == int(0) else cj.trailing_spaces(12, SOL_EC2, 2)) + ("" if int(float(SOL_Z3)) == int(0) else cj.trailing_spaces(12, SOL_EC3, 2)) + ("" if int(float(SOL_Z4)) == int(0) else cj.trailing_spaces(12, SOL_EC4, 2)) + ("" if int(float(SOL_Z5)) == int(0) else cj.trailing_spaces(12, SOL_EC5, 2)) + ("" if int(float(SOL_Z6)) == int(0) else cj.trailing_spaces(12, SOL_EC6, 2)) + ("" if int(float(SOL_Z7)) == int(0) else cj.trailing_spaces(12, SOL_EC7, 2)) + ("" if int(float(SOL_Z8)) == int(0) else cj.trailing_spaces(12, SOL_EC8, 2)) + ("" if int(float(SOL_Z9)) == int(0) else cj.trailing_spaces(12, SOL_EC9, 2)) + ("" if int(float(SOL_Z10)) == int(0) else cj.trailing_spaces(12, SOL_EC10, 2)) + \
AI6 = wwq_params[9].strip('"') MUMAX = wwq_params[10].strip('"') RHOQ = wwq_params[11].strip('"') TFACT = wwq_params[12].strip('"') K_L = wwq_params[13].strip('"') K_N = wwq_params[14].strip('"') K_P = wwq_params[15].strip('"') LAMBDA0 = wwq_params[16].strip('"') LAMBDA1 = wwq_params[17].strip('"') LAMBDA2 = wwq_params[18].strip('"') P_N = wwq_params[19].strip('"') CHLA_SUBCO = wwq_params[20].strip('"') # Building String wwq_file = "Watershed water quality file .wwq file " + DateAndTime + " " + SWAT_Vers + \ "\n" + cj.trailing_spaces(16, LAO, 0) + " | LAO : Light averaging option" + \ "\n" + cj.trailing_spaces(16, IGROPT, 0) + " | IGROPT : Algal specific growth rate option" + \ "\n" + cj.trailing_spaces(16, AI0, 3) + " | AI0 : Ratio of chlorophyll-a to algal biomass [micro g-chla/mg algae]" + \ "\n" + cj.trailing_spaces(16, AI1, 3) + " | AI1 : Fraction of algal biomass that is nitrogen [mg N/mg alg]" + \ "\n" + cj.trailing_spaces(16, AI2, 3) + " | AI2 : Fraction of algal biomass that is phosphorus [mg P/mg alg]" + \ "\n" + cj.trailing_spaces(16, AI3, 3) + " | AI3 : The rate of oxygen production per unit of algal photosynthesis [mg O2/mg alg)]" + \ "\n" + cj.trailing_spaces(16, AI4, 3) + " | AI4 : The rate of oxygen uptake per unit of algal respiration [mg O2/mg alg)]" + \ "\n" + cj.trailing_spaces(16, AI5, 3) + " | AI5 : The rate of oxygen uptake per unit of NH3-N oxidation [mg O2/mg NH3-N]" + \ "\n" + cj.trailing_spaces(16, AI6, 3) + " | AI6 : The rate of oxygen uptake per unit of NO2-N oxidation [mg O2/mg NO2-N]" + \ "\n" + cj.trailing_spaces(16, MUMAX, 3) + " | MUMAX : Maximum specific algal growth rate at 20deg C [day-1]" + \ "\n" + cj.trailing_spaces(16, RHOQ, 3) + " | RHOQ : Algal respiration rate at 20deg C [day-1]" + \ "\n" + cj.trailing_spaces(16, TFACT, 3) + " | TFACT : Fraction of solar radiation computed in the temperature heat balance that is photosynthetically active" + \ "\n" + cj.trailing_spaces(16, K_L, 3) + " | K_L : Half-saturation coefficient for light [kJ/(m2deg min)]" + \ "\n" + cj.trailing_spaces(16, K_N, 3) + " | K_N : Michaelis-Menton half-saturation constant for nitrogen [mg N/lL]" + \ "\n" + cj.trailing_spaces(16, K_P, 3) + " | K_P : Michaelis-Menton half-saturation constant for phosphorus [mg P/l]" + \ "\n" + cj.trailing_spaces(16, LAMBDA0, 3) + " | LAMBDA0 : Non-algal portion of the light extinction coefficient [m-1]" + \
DDRAIN = hru_record.split(",")[23].strip('"') TDRAIN = hru_record.split(",")[24].strip('"') GDRAIN = hru_record.split(",")[25].strip('"') NROT = hru_record.split(",")[26].strip('"') # Building String op_schedule = "" # Here we make the operation schedule based on the land use properties from mgt2 table in the database for record in mgt_table2: if (int(SubBasin) == int( record[1].strip('"'))) and (int(HRU_No) == int( record[2].strip('"'))): if int(record[11].strip('"')) == int( 1 ): # if it is planting, add the line for planting from database table op_schedule += cj.trailing_spaces(15, record[10].strip('"'), 3) + cj.trailing_spaces(3, record[11].strip('"'), 0) + \ cj.trailing_spaces(5, record[13].strip('"'), 0) + cj.trailing_spaces(20, record[12].strip('"'), 5) + cj.trailing_spaces(7, record[15].strip('"'), 2) + \ cj.trailing_spaces(12, record[16].strip('"'), 5) + cj.trailing_spaces(5, record[17].strip('"'), 2) + \ cj.trailing_spaces(7, record[18].strip('"'), 2) + cj.trailing_spaces(6, record[19].strip('"'), 2) if int(record[11].strip('"')) == int(2): # op_schedule += "\n" + cj.trailing_spaces(15, record[10].strip('"'), 3) + cj.trailing_spaces(3, record[11].strip('"'), 0) + \ cj.trailing_spaces(9, record[63].strip('"'), 0) + cj.trailing_spaces(16, record[20].strip('"'), 5) + \ cj.trailing_spaces(7, record[51].strip('"'), 2) + cj.trailing_spaces(12, record[52].strip('"'), 5) + \ cj.trailing_spaces(5, record[53].strip('"'), 2) + cj.trailing_spaces(25, record[64].strip('"'), 0) if int(record[11].strip('"')) == int(3): # op_schedule += "\n" + cj.trailing_spaces(15, record[10].strip('"'), 3) + cj.trailing_spaces(3, record[11].strip('"'), 0) + \ cj.trailing_spaces(5, record[21].strip('"'), 0) + cj.trailing_spaces(20, record[22].strip('"'), 5) + \ cj.trailing_spaces(7, record[23].strip('"'), 2)
WNDAV1 = hru_record.split(",")[163].strip('"') WNDAV2 = hru_record.split(",")[164].strip('"') WNDAV3 = hru_record.split(",")[165].strip('"') WNDAV4 = hru_record.split(",")[166].strip('"') WNDAV5 = hru_record.split(",")[167].strip('"') WNDAV6 = hru_record.split(",")[168].strip('"') WNDAV7 = hru_record.split(",")[169].strip('"') WNDAV8 = hru_record.split(",")[170].strip('"') WNDAV9 = hru_record.split(",")[171].strip('"') WNDAV10 = hru_record.split(",")[172].strip('"') WNDAV11 = hru_record.split(",")[173].strip('"') WNDAV12 = hru_record.split(",")[174].strip('"') # Building String wgn_file = " .Wgn file Subbasin: " + SubBasin + " STATION NAME:" + STATION + " " + DateAndTime + " " + SWAT_Vers + \ "\n LATITUDE =" + cj.trailing_spaces(int(7),WLATITUDE,2) + " LONGITUDE =" + cj.trailing_spaces(int(7),WLONGITUDE,2) + \ "\n ELEV [m] =" + cj.trailing_spaces(int(7),WELEV,2) + \ "\n RAIN_YRS =" + cj.trailing_spaces(int(7),RAIN_YRS,2) + \ "\n" + cj.trailing_spaces(int(6),TMPMX1,2) + cj.trailing_spaces(int(6),TMPMX2,2) + cj.trailing_spaces(int(6),TMPMX3,2) + cj.trailing_spaces(int(6),TMPMX4,2) + cj.trailing_spaces(int(6),TMPMX5,2) + cj.trailing_spaces(int(6),TMPMX6,2) + cj.trailing_spaces(int(6),TMPMX7,2) + cj.trailing_spaces(int(6),TMPMX8,2) + cj.trailing_spaces(int(6),TMPMX9,2) + cj.trailing_spaces(int(6),TMPMX10,2) + cj.trailing_spaces(int(6),TMPMX11,2) + cj.trailing_spaces(int(6),TMPMX12,2) + \ "\n" + cj.trailing_spaces(int(6),TMPMN1,2) + cj.trailing_spaces(int(6),TMPMN2,2) + cj.trailing_spaces(int(6),TMPMN3,2) + cj.trailing_spaces(int(6),TMPMN4,2) + cj.trailing_spaces(int(6),TMPMN5,2) + cj.trailing_spaces(int(6),TMPMN6,2) + cj.trailing_spaces(int(6),TMPMN7,2) + cj.trailing_spaces(int(6),TMPMN8,2) + cj.trailing_spaces(int(6),TMPMN9,2) + cj.trailing_spaces(int(6),TMPMN10,2) + cj.trailing_spaces(int(6),TMPMN11,2) + cj.trailing_spaces(int(6),TMPMN12,2) + \ "\n" + cj.trailing_spaces(int(6),TMPSTDMX1,2) + cj.trailing_spaces(int(6),TMPSTDMX2,2) + cj.trailing_spaces(int(6),TMPSTDMX3,2) + cj.trailing_spaces(int(6),TMPSTDMX4,2) + cj.trailing_spaces(int(6),TMPSTDMX5,2) + cj.trailing_spaces(int(6),TMPSTDMX6,2) + cj.trailing_spaces(int(6),TMPSTDMX7,2) + cj.trailing_spaces(int(6),TMPSTDMX8,2) + cj.trailing_spaces(int(6),TMPSTDMX9,2) + cj.trailing_spaces(int(6),TMPSTDMX10,2) + cj.trailing_spaces(int(6),TMPSTDMX11,2) + cj.trailing_spaces(int(6),TMPSTDMX12,2) + \ "\n" + cj.trailing_spaces(int(6),TMPSTDMN1,2) + cj.trailing_spaces(int(6),TMPSTDMN2,2) + cj.trailing_spaces(int(6),TMPSTDMN3,2) + cj.trailing_spaces(int(6),TMPSTDMN4,2) + cj.trailing_spaces(int(6),TMPSTDMN5,2) + cj.trailing_spaces(int(6),TMPSTDMN6,2) + cj.trailing_spaces(int(6),TMPSTDMN7,2) + cj.trailing_spaces(int(6),TMPSTDMN8,2) + cj.trailing_spaces(int(6),TMPSTDMN9,2) + cj.trailing_spaces(int(6),TMPSTDMN10,2) + cj.trailing_spaces(int(6),TMPSTDMN11,2) + cj.trailing_spaces(int(6),TMPSTDMN12,2) + \ "\n" + cj.trailing_spaces(int(6),PCPMM1,1) + cj.trailing_spaces(int(6),PCPMM2,1) + cj.trailing_spaces(int(6),PCPMM3,1) + cj.trailing_spaces(int(6),PCPMM4,1) + cj.trailing_spaces(int(6),PCPMM5,1) + cj.trailing_spaces(int(6),PCPMM6,1) + cj.trailing_spaces(int(6),PCPMM7,1) + cj.trailing_spaces(int(6),PCPMM8,1) + cj.trailing_spaces(int(6),PCPMM9,1) + cj.trailing_spaces(int(6),PCPMM10,1) + cj.trailing_spaces(int(6),PCPMM11,1) + cj.trailing_spaces(int(6),PCPMM12,1) + \ "\n" + cj.trailing_spaces(int(6),PCPSTD1,2) + cj.trailing_spaces(int(6),PCPSTD2,2) + cj.trailing_spaces(int(6),PCPSTD3,2) + cj.trailing_spaces(int(6),PCPSTD4,2) + cj.trailing_spaces(int(6),PCPSTD5,2) + cj.trailing_spaces(int(6),PCPSTD6,2) + cj.trailing_spaces(int(6),PCPSTD7,2) + cj.trailing_spaces(int(6),PCPSTD8,2) + cj.trailing_spaces(int(6),PCPSTD9,2) + cj.trailing_spaces(int(6),PCPSTD10,2) + cj.trailing_spaces(int(6),PCPSTD11,2) + cj.trailing_spaces(int(6),PCPSTD12,2) + \ "\n" + cj.trailing_spaces(int(6),PCPSKW1,2) + cj.trailing_spaces(int(6),PCPSKW2,2) + cj.trailing_spaces(int(6),PCPSKW3,2) + cj.trailing_spaces(int(6),PCPSKW4,2) + cj.trailing_spaces(int(6),PCPSKW5,2) + cj.trailing_spaces(int(6),PCPSKW6,2) + cj.trailing_spaces(int(6),PCPSKW7,2) + cj.trailing_spaces(int(6),PCPSKW8,2) + cj.trailing_spaces(int(6),PCPSKW9,2) + cj.trailing_spaces(int(6),PCPSKW10,2) + cj.trailing_spaces(int(6),PCPSKW11,2) + cj.trailing_spaces(int(6),PCPSKW12,2) + \ "\n" + cj.trailing_spaces(int(6),PR_W11,2) + cj.trailing_spaces(int(6),PR_W12,2) + cj.trailing_spaces(int(6),PR_W13,2) + cj.trailing_spaces(int(6),PR_W14,2) + cj.trailing_spaces(int(6),PR_W15,2) + cj.trailing_spaces(int(6),PR_W16,2) + cj.trailing_spaces(int(6),PR_W17,2) + cj.trailing_spaces(int(6),PR_W18,2) + cj.trailing_spaces(int(6),PR_W19,2) + cj.trailing_spaces(int(6),PR_W110,2) + cj.trailing_spaces(int(6),PR_W111,2) + cj.trailing_spaces(int(6),PR_W112,2) + \ "\n" + cj.trailing_spaces(int(6),PR_W21,2) + cj.trailing_spaces(int(6),PR_W22,2) + cj.trailing_spaces(int(6),PR_W23,2) + cj.trailing_spaces(int(6),PR_W24,2) + cj.trailing_spaces(int(6),PR_W25,2) + cj.trailing_spaces(int(6),PR_W26,2) + cj.trailing_spaces(int(6),PR_W27,2) + cj.trailing_spaces(int(6),PR_W28,2) + cj.trailing_spaces(int(6),PR_W29,2) + cj.trailing_spaces(int(6),PR_W210,2) + cj.trailing_spaces(int(6),PR_W211,2) + cj.trailing_spaces(int(6),PR_W212,2) + \ "\n" + cj.trailing_spaces(int(6),PCPD1,2) + cj.trailing_spaces(int(6),PCPD2,2) + cj.trailing_spaces(int(6),PCPD3,2) + cj.trailing_spaces(int(6),PCPD4,2) + cj.trailing_spaces(int(6),PCPD5,2) + cj.trailing_spaces(int(6),PCPD6,2) + cj.trailing_spaces(int(6),PCPD7,2) + cj.trailing_spaces(int(6),PCPD8,2) + cj.trailing_spaces(int(6),PCPD9,2) + cj.trailing_spaces(int(6),PCPD10,2) + cj.trailing_spaces(int(6),PCPD11,2) + cj.trailing_spaces(int(6),PCPD12,2) + \ "\n" + cj.trailing_spaces(int(6),RAINHHMX1,2) + cj.trailing_spaces(int(6),RAINHHMX2,2) + cj.trailing_spaces(int(6),RAINHHMX3,2) + cj.trailing_spaces(int(6),RAINHHMX4,2) + cj.trailing_spaces(int(6),RAINHHMX5,2) + cj.trailing_spaces(int(6),RAINHHMX6,2) + cj.trailing_spaces(int(6),RAINHHMX7,2) + cj.trailing_spaces(int(6),RAINHHMX8,2) + cj.trailing_spaces(int(6),RAINHHMX9,2) + cj.trailing_spaces(int(6),RAINHHMX10,2) + cj.trailing_spaces(int(6),RAINHHMX11,2) + cj.trailing_spaces(int(6),RAINHHMX12,2) + \ "\n" + cj.trailing_spaces(int(6),SOLARAV1,2) + cj.trailing_spaces(int(6),SOLARAV2,2) + cj.trailing_spaces(int(6),SOLARAV3,2) + cj.trailing_spaces(int(6),SOLARAV4,2) + cj.trailing_spaces(int(6),SOLARAV5,2) + cj.trailing_spaces(int(6),SOLARAV6,2) + cj.trailing_spaces(int(6),SOLARAV7,2) + cj.trailing_spaces(int(6),SOLARAV8,2) + cj.trailing_spaces(int(6),SOLARAV9,2) + cj.trailing_spaces(int(6),SOLARAV10,2) + cj.trailing_spaces(int(6),SOLARAV11,2) + cj.trailing_spaces(int(6),SOLARAV12,2) + \ "\n" + cj.trailing_spaces(int(6),DEWPT1,2) + cj.trailing_spaces(int(6),DEWPT2,2) + cj.trailing_spaces(int(6),DEWPT3,2) + cj.trailing_spaces(int(6),DEWPT4,2) + cj.trailing_spaces(int(6),DEWPT5,2) + cj.trailing_spaces(int(6),DEWPT6,2) + cj.trailing_spaces(int(6),DEWPT7,2) + cj.trailing_spaces(int(6),DEWPT8,2) + cj.trailing_spaces(int(6),DEWPT9,2) + cj.trailing_spaces(int(6),DEWPT10,2) + cj.trailing_spaces(int(6),DEWPT11,2) + cj.trailing_spaces(int(6),DEWPT12,2) + \
IHUMUS = cio_table[0].split(",")[42] ISNOW = cio_table[0].split(",")[43] ITEMP = cio_table[0].split(",")[44] IMGT = cio_table[0].split(",")[45] IWTR = cio_table[0].split(",")[46] ICALEN = cio_table[0].split(",")[47] # Building String cio_file = "Master Watershed File: file.cio" + \ "\n" + "Project Description:" + \ "\n" + "General Input/Output section (file.cio):" + \ "\n" + DateAndTime + " " + SWAT_Vers + \ "\n" + \ "\n" + "General Information/Watershed Configuration:" + \ "\n" + "fig.fig" + \ "\n" + cj.trailing_spaces(16, NBYR, 0) + " | NBYR : Number of years simulated" + \ "\n" + cj.trailing_spaces(16, IYR, 0) + " | IYR : Beginning year of simulation" + \ "\n" + cj.trailing_spaces(16, IDAF, 0) + " | IDAF : Beginning julian day of simulation" + \ "\n" + cj.trailing_spaces(16, IDAL, 0) + " | IDAL : Ending julian day of simulation" + \ "\n" + "Climate:" + \ "\n" + cj.trailing_spaces(16, IGEN, 0) + " | IGEN : Random number seed cycle code" + \ "\n" + cj.trailing_spaces(16, PCPSIM, 0) + " | PCPSIM : precipitation simulation code: 1=measured, 2=simulated" + \ "\n" + cj.trailing_spaces(16, IDT, 0) + " | IDT : Rainfall data time step" + \ "\n" + cj.trailing_spaces(16, IDIST, 0) + " | IDIST : rainfall distribution code: 0 skewed, 1 exponential" + \ "\n" + cj.trailing_spaces(16, REXP, 3) + " | REXP : Exponent for IDIST=1" + \ "\n" + cj.trailing_spaces(16, NRGAGE, 0) + " | NRGAGE: number of pcp files used in simulation" + \ "\n" + cj.trailing_spaces(16, NRTOT, 0) + " | NRTOT: number of precip gage records used in simulation" + \ "\n" + cj.trailing_spaces(16, NRGFIL, 0) + " | NRGFIL: number of gage records in each pcp file" + \ "\n" + cj.trailing_spaces(16, TMPSIM, 0) + " | TMPSIM: temperature simulation code: 1=measured, 2=simulated" + \ "\n" + cj.trailing_spaces(16, NTGAGE, 0) + " | NTGAGE: number of tmp files used in simulation" + \ "\n" + cj.trailing_spaces(16, NTTOT, 0) + " | NTTOT: number of temp gage records used in simulation" + \
import init_file as variables import cj_function_lib as cj from datetime import datetime fert_table = cj.extract_table_from_mdb(variables.QSWAT_MDB, "fert", variables.path + "\\fert.tmp~") fert = "" for fert_line in fert_table: fert += cj.trailing_spaces( 4, fert_line.split(",")[1], 0) + cj.string_trailing_spaces( 9, fert_line.split(",")[2]) + cj.trailing_spaces( 8, fert_line.split(",")[3], 3) + cj.trailing_spaces( 8, fert_line.split(",")[4], 3) + cj.trailing_spaces( 8, fert_line.split(",")[5], 3) + cj.trailing_spaces( 8, fert_line.split(",")[6], 3) + cj.trailing_spaces( 8, fert_line.split(",")[7], 3) + cj.trailing_spaces( 4, fert_line.split(",")[8], 2) + "E+00" + cj.trailing_spaces( 4, fert_line.split(",")[9],
from datetime import datetime wus_table = cj.extract_table_from_mdb( variables.ProjMDB, "wus", variables.path + "\\wus.tmp~") now = datetime.now() DateAndTime = str(now.month) + "/" + str(now.day) + "/" + str(now.year) + " " + str(now.time()).split(".")[0] SWAT_Vers = "QSWAT Workflow v1.5.2" for sub_record in wus_table: # Hru ID SubBasin = sub_record.split(",")[1].strip('"') # Parameters WUPND1 = cj.trailing_spaces(10, sub_record.split(",")[2].strip('"'), 1) WUPND2 = cj.trailing_spaces(10, sub_record.split(",")[3].strip('"'), 1) WUPND3 = cj.trailing_spaces(10, sub_record.split(",")[4].strip('"'), 1) WUPND4 = cj.trailing_spaces(10, sub_record.split(",")[5].strip('"'), 1) WUPND5 = cj.trailing_spaces(10, sub_record.split(",")[6].strip('"'), 1) WUPND6 = cj.trailing_spaces(10, sub_record.split(",")[7].strip('"'), 1) WUPND7 = cj.trailing_spaces(10, sub_record.split(",")[8].strip('"'), 1) WUPND8 = cj.trailing_spaces(10, sub_record.split(",")[9].strip('"'), 1) WUPND9 = cj.trailing_spaces(10, sub_record.split(",")[10].strip('"'), 1) WUPND10 = cj.trailing_spaces(10, sub_record.split(",")[11].strip('"'), 1) WUPND11 = cj.trailing_spaces(10, sub_record.split(",")[12].strip('"'), 1) WUPND12 = cj.trailing_spaces(10, sub_record.split(",")[13].strip('"'), 1) WURCH1 = cj.trailing_spaces(10, sub_record.split(",")[14].strip('"'), 1) WURCH2 = cj.trailing_spaces(10, sub_record.split(",")[15].strip('"'), 1) WURCH3 = cj.trailing_spaces(10, sub_record.split(",")[16].strip('"'), 1) WURCH4 = cj.trailing_spaces(10, sub_record.split(",")[17].strip('"'), 1)
PPERCO_SUB1 = chm_record.split(",")[86].strip('"') PPERCO_SUB2 = chm_record.split(",")[87].strip('"') PPERCO_SUB3 = chm_record.split(",")[88].strip('"') PPERCO_SUB4 = chm_record.split(",")[89].strip('"') PPERCO_SUB5 = chm_record.split(",")[90].strip('"') PPERCO_SUB6 = chm_record.split(",")[91].strip('"') PPERCO_SUB7 = chm_record.split(",")[92].strip('"') PPERCO_SUB8 = chm_record.split(",")[93].strip('"') PPERCO_SUB9 = chm_record.split(",")[94].strip('"') PPERCO_SUB10 = chm_record.split(",")[95].strip('"') # Building String chm_file = " .chm file Watershed HRU:" + WshedHRU + " Subbasin:" + SubBasin + " HRU:" + HRU_No + " Luse:" + Luse + " Soil: " + Soil + " Slope: " + Slope + " " + DateAndTime + " " + SWAT_Vers + \ "\n" + "Soil Nutrient Data" + \ "\n" + " Soil Layer : 1 2 3 4 5 6 7 8 9 10" + \ "\n" + " Soil NO3 [mg/kg] :" + cj.trailing_spaces(12, SOL_NO31, 2) + cj.trailing_spaces(12, SOL_NO32, 2) + cj.trailing_spaces(12, SOL_NO33, 2) + cj.trailing_spaces(12, SOL_NO34, 2) + cj.trailing_spaces(12, SOL_NO35, 2) + cj.trailing_spaces(12, SOL_NO36, 2) + cj.trailing_spaces(12, SOL_NO37, 2) + cj.trailing_spaces(12, SOL_NO38, 2) + cj.trailing_spaces(12, SOL_NO39, 2) + cj.trailing_spaces(12, SOL_NO310, 2) + \ "\n" + " Soil organic N [mg/kg] :" + cj.trailing_spaces(12, SOL_ORGN1, 2) + cj.trailing_spaces(12, SOL_ORGN2, 2) + cj.trailing_spaces(12, SOL_ORGN3, 2) + cj.trailing_spaces(12, SOL_ORGN4, 2) + cj.trailing_spaces(12, SOL_ORGN5, 2) + cj.trailing_spaces(12, SOL_ORGN6, 2) + cj.trailing_spaces(12, SOL_ORGN7, 2) + cj.trailing_spaces(12, SOL_ORGN8, 2) + cj.trailing_spaces(12, SOL_ORGN9, 2) + cj.trailing_spaces(12, SOL_ORGN10, 2) + \ "\n" + " Soil labile P [mg/kg] :" + cj.trailing_spaces(12, SOL_LABP1, 2) + cj.trailing_spaces(12, SOL_LABP2, 2) + cj.trailing_spaces(12, SOL_LABP3, 2) + cj.trailing_spaces(12, SOL_LABP4, 2) + cj.trailing_spaces(12, SOL_LABP5, 2) + cj.trailing_spaces(12, SOL_LABP6, 2) + cj.trailing_spaces(12, SOL_LABP7, 2) + cj.trailing_spaces(12, SOL_LABP8, 2) + cj.trailing_spaces(12, SOL_LABP9, 2) + cj.trailing_spaces(12, SOL_LABP10, 2) + \ "\n" + " Soil organic P [mg/kg] :" + cj.trailing_spaces(12, SOL_ORGP1, 2) + cj.trailing_spaces(12, SOL_ORGP2, 2) + cj.trailing_spaces(12, SOL_ORGP3, 2) + cj.trailing_spaces(12, SOL_ORGP4, 2) + cj.trailing_spaces(12, SOL_ORGP5, 2) + cj.trailing_spaces(12, SOL_ORGP6, 2) + cj.trailing_spaces(12, SOL_ORGP7, 2) + cj.trailing_spaces(12, SOL_ORGP8, 2) + cj.trailing_spaces(12, SOL_ORGP9, 2) + cj.trailing_spaces(12, SOL_ORGP10, 2) + \ "\n" + " Phosphorus perc coef :" + cj.trailing_spaces(12, PPERCO_SUB1, 2) + cj.trailing_spaces(12, PPERCO_SUB2, 2) + cj.trailing_spaces(12, PPERCO_SUB3, 2) + cj.trailing_spaces(12, PPERCO_SUB4, 2) + cj.trailing_spaces(12, PPERCO_SUB5, 2) + cj.trailing_spaces(12, PPERCO_SUB6, 2) + cj.trailing_spaces(12, PPERCO_SUB7, 2) + cj.trailing_spaces(12, PPERCO_SUB8, 2) + cj.trailing_spaces(12, PPERCO_SUB9, 2) + cj.trailing_spaces(12, PPERCO_SUB10, 2) + \ "\n" + "Soil Pesticide Data" + \ "\n" + " Pesticide Pst on plant Pst in 1st soil layer Pst enrichment" + \ "\n" + " # [kg/ha] [kg/ha] [kg/ha]" + \ "\n" + cj.string_trailing_spaces(4, PESTNAME1) + cj.trailing_spaces(18, PLTPST1, 2) + cj.trailing_spaces(18, SOLPST1, 2) + cj.trailing_spaces(18, PSTENR1, 2) + \ "\n" + cj.string_trailing_spaces(4, PESTNAME2) + cj.trailing_spaces(18, PLTPST2, 2) + cj.trailing_spaces(18, SOLPST2, 2) + cj.trailing_spaces(18, PSTENR2, 2) + \ "\n" + cj.string_trailing_spaces(4, PESTNAME3) + cj.trailing_spaces(18, PLTPST3, 2) + cj.trailing_spaces(18, SOLPST3, 2) + cj.trailing_spaces(18, PSTENR3, 2) + \ "\n" + cj.string_trailing_spaces(4, PESTNAME4) + cj.trailing_spaces(18, PLTPST4, 2) + cj.trailing_spaces(18, SOLPST4, 2) + cj.trailing_spaces(18, PSTENR4, 2) + \ "\n" + cj.string_trailing_spaces(4, PESTNAME5) + cj.trailing_spaces(18, PLTPST5, 2) + cj.trailing_spaces(18, SOLPST5, 2) + cj.trailing_spaces(18, PSTENR5, 2) + \ "\n" + cj.string_trailing_spaces(4, PESTNAME6) + cj.trailing_spaces(18, PLTPST6, 2) + cj.trailing_spaces(18, SOLPST6, 2) + cj.trailing_spaces(18, PSTENR6, 2) + \ "\n" + cj.string_trailing_spaces(4, PESTNAME7) + cj.trailing_spaces(18, PLTPST7, 2) + cj.trailing_spaces(18, SOLPST7, 2) + cj.trailing_spaces(18, PSTENR7, 2) + \ "\n" + cj.string_trailing_spaces(4, PESTNAME8) + cj.trailing_spaces(18, PLTPST8, 2) + cj.trailing_spaces(18, SOLPST8, 2) + cj.trailing_spaces(18, PSTENR8, 2) + \
IABSTR = bsn_params[114].strip('"') IATMODEP = bsn_params[115].strip('"') RAMMO_SUB = bsn_params[116].strip('"') RCN_SUB = bsn_params[117].strip('"') DRYDEP_NH4 = bsn_params[118].strip('"') DRYDEP_NO3 = bsn_params[119].strip('"') R2ADJ_BSN = bsn_params[120].strip('"') SSTMAXD_BSN = bsn_params[121].strip('"') ISMAX = bsn_params[122].strip('"') IROUTUNIT = bsn_params[123].strip('"') # Building String bsn_file = "Basin data .bsn file " + DateAndTime + " " + SWAT_Vers + \ "\n" + "Modeling Options: Land Area" + \ "\n" + "Water Balance:" + \ "\n" + cj.trailing_spaces(16, SFTMP, 3) + " | SFTMP : Snowfall temperature [deg C]" + \ "\n" + cj.trailing_spaces(16, SMTMP, 3) + " | SMTMP : Snow melt base temperature [deg C]" + \ "\n" + cj.trailing_spaces(16, SMFMX, 3) + " | SMFMX : Melt factor for snow on June 21 [mm H2O/deg C-day]" + \ "\n" + cj.trailing_spaces(16, SMFMN, 3) + " | SMFMN : Melt factor for snow on December 21 [mm H2O/deg C-day]" + \ "\n" + cj.trailing_spaces(16, TIMP, 3) + " | TIMP : Snow pack temperature lag factor" + \ "\n" + cj.trailing_spaces(16, SNOCOVMX, 3) + " | SNOCOVMX : Minimum snow water content that corresponds to 100% snow cover [mm]" + \ "\n" + cj.trailing_spaces(16, SNO50COV, 3) + " | SNO50COV : Fraction of snow volume represented by SNOCOVMX that corresponds to 50% snow cover" + \ "\n" + cj.trailing_spaces(16, IPET, 0) + " | IPET: PET method: 0=priest-t, 1=pen-m, 2=har, 3=read into model" + \ "\n" + " " + " | PETFILE: name of potential ET input file" + \ "\n" + cj.trailing_spaces(16, ESCO, 3) + " | ESCO: soil evaporation compensation factor" + \ "\n" + cj.trailing_spaces(16, EPCO, 3) + " | EPCO: plant water uptake compensation factor" + \ "\n" + cj.trailing_spaces(16, EVLAI, 3) + " | EVLAI : Leaf area index at which no evaporation occurs from water surface [m2/m2]" + \ "\n" + cj.trailing_spaces(16, FFCB, 3) + " | FFCB : Initial soil water storage expressed as a fraction of field capacity water content" + \ "\n" + "Surface Runoff:" + \ "\n" + cj.trailing_spaces(16, IEVENT, 0) + " | IEVENT: rainfall/runoff code: 0=daily rainfall/CN" + \ "\n" + cj.trailing_spaces(16, ICRK, 0) + " | ICRK: crack flow code: 1=model crack flow in soil" + \
if ISGAGE == "": ISGAGE = 0 if IHGAGE == "": IHGAGE = 0 if IWGAGE == "": IWGAGE = 0 hru_files_in_sub = "" for i in range(1, int(HRUTOT) + 1): HRU_ID = cj.trailing_zeros(5, SUBBASIN, 0) + cj.trailing_zeros(4, i, 0) hru_files_in_sub += "\n" + HRU_ID + ".hru" + HRU_ID + ".mgt" + HRU_ID + ".sol" + HRU_ID + ".chm " + HRU_ID + ".gw " + HRU_ID + ".sep" # Building String sub_file = " .sub file Subbasin: " + SUBBASIN + " " + DateAndTime + " " + SWAT_Vers + \ "\n" + cj.trailing_spaces(16, SUB_KM, 6) + " | SUB_KM : Subbasin area [km2]" + \ "\n" + \ "\n" + "Climate in subbasin" + \ "\n" + cj.trailing_spaces(16, SUB_LAT, 6) + " | LATITUDE : Latitude of subbasin [degrees]" + \ "\n" + cj.trailing_spaces(16, SUB_ELEV, 2) + " | ELEV : Elevation of subbasin [m]" + \ "\n" + cj.trailing_spaces(16, IRGAGE, 0) + " | IRGAGE: precip gage data used in subbasin" + \ "\n" + cj.trailing_spaces(16, ITGAGE, 0) + " | ITGAGE: temp gage data used in subbasin" + \ "\n" + cj.trailing_spaces(16, ISGAGE, 0) + " | ISGAGE: solar radiation gage data used in subbasin" + \ "\n" + cj.trailing_spaces(16, IHGAGE, 0) + " | IHGAGE: relative humidity gage data used in subbasin" + \ "\n" + cj.trailing_spaces(16, IWGAGE, 0) + " | IWGAGE: wind speed gage data used in subbasin" + \ "\n" + cj.get_filename(int(SUBBASIN), int(0), "wgn") + " | WGNFILE: name of weather generator data file" + \ "\n" + cj.trailing_spaces(16, FCST_REG, 0) + " | FCST_REG: Region number used to assign forecast data to the subbasin" + \ "\n" + "Elevation Bands" + \ "\n" + "| ELEVB: Elevation at center of elevation bands [m]" + \ "\n" + cj.trailing_spaces(8, ELEVB1, 3) + cj.trailing_spaces(8, ELEVB2, 3) + cj.trailing_spaces(8, ELEVB3, 3) + cj.trailing_spaces(8, ELEVB4, 3) + cj.trailing_spaces(8, ELEVB5, 3) + cj.trailing_spaces(8, ELEVB6, 3) + cj.trailing_spaces(8, ELEVB7, 3) + cj.trailing_spaces(8, ELEVB8, 3) + cj.trailing_spaces(8, ELEVB9, 3) + cj.trailing_spaces(8, ELEVB10, 3) + \ "\n" + "| ELEVB_FR: Fraction of subbasin area within elevation band" + \