Пример #1
0
    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)
IDAF = end_day
current_day = 0
start_year = current_year

for i in range(1, len(stations_dict["1"].data_list)):
    line = ""
    current_day += 1

    if current_day <= end_day:
        datecode = str(current_year) + cj.trailing_zeros(3, current_day, 0)
        #print datecode
    else:
        current_day = 1
        current_year += 1
        end_day = cj.get_days_in_year(current_year)
        datecode = str(current_year) + cj.trailing_zeros(3, current_day, 0)
        #print end_day

    for sta_nr in station_nr:
        rec = cj.trailing_zeros(5, stations_dict[str(sta_nr)].data_list[i], 1)
        line += rec

    line = datecode + line + "\n"
    pcp_string += line
Пример #2
0
    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" + \
    "\n          watout.dat" + \
Пример #3
0
#import sys, os, zipfile
#import cj_function_lib as cj
#import mdbtools as mdt
#path = os.path.dirname(__file__)
#root = path.replace("mdbtoascii", "")
#sys.path.append(root)
#
#import settings
#
#print "____________________________________________________________________________\nPreparing Project...\n"
#
#project_name = settings.Project_Name
#
#proj4, is_proj = cj.get_proj4_from(root + "/" + project_name + "/Source/crop/" + settings.Land_Use)
#
#print proj4
#print is_proj

import cj_function_lib as cj

number = cj.trailing_zeros(5, "0.000001", 2)

print number

filec = cj.read_from("WGEN_user.csv")
for line in filec:
    for part in line.split(","):
        text = cj._removeNonAscii(part)
        #for i in range (10000):
            #cj.update_status(str(i))
        print text
Пример #4
0
for key in range(1, len(stations_list) + 1):
    tmp_string += cj.trailing_spaces(10, stations_dict[str(key)].elev, 0)

tmp_string += "\n"

current_tear = int(stations_dict["1"].data_list[0][0:4])
end_day = cj.get_days_in_year(current_tear)
current_day = 0

for i in range(1, len(stations_dict["1"].data_list)):
    line = ""
    current_day += 1

    if current_day <= end_day:
        datecode = str(current_tear) + cj.trailing_zeros(3, current_day, 0)
        #print datecode
    else:
        current_day = 1
        current_tear += 1
        end_day = cj.get_days_in_year(current_tear)
        datecode = str(current_tear) + cj.trailing_zeros(3, current_day, 0)
        #print end_day

    for sta_nr in station_nr:
        rec = (
            "000.0" if cj.trailing_zeros(
                5, stations_dict[str(sta_nr)].data_list[i].split(",")[0], 1)
            == "-00.0" else cj.trailing_zeros(
                5, stations_dict[str(sta_nr)].data_list[i].split(",")[0], 1)
        ) + ("000.0" if cj.trailing_zeros(
Пример #5
0
    HUMINC12 = sub_record.split(",")[96].strip("\n")
    HRUTOT = sub_record.split(",")[97].strip("\n")
    IPOT = sub_record.split(",")[98].strip("\n")
    FCST_REG = sub_record.split(",")[99].strip("\n")
    SUBSNOW = sub_record.split(",")[100].strip("\n")

    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" + \