-
Notifications
You must be signed in to change notification settings - Fork 0
/
discharge_correction.py
102 lines (98 loc) · 6.04 KB
/
discharge_correction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import pandas as pd
# Data from the provided snippets
data = {
'TAMBOPATA': {62269800591: 63.302},
'ARG_LAKE': {
64401700031: 356.79, 64401700021: 356.902, 64401700011: 356.912,
64401700381: 307.915, 64401700371: 307.915, 64401700361: 306.053,
64401700351: 287.324, 64401700341: 286.084, 64401700331: 278.659,
64401700321: 278.761, 64401700311: 279.066, 64401700301: 279.869,
64401700291: 280.126, 64401700281: 225.854, 64401700271: 214.09,
64401700261: 190.353, 64401700251: 177.73, 64401700241: 164.483,
64401500231: 162.024, 64401500221: 155.101, 64401500211: 218.953,
64401500201: 222.599, 64401500191: 217.146, 64401500181: 208.431,
64401500171: 200.566, 64401500161: 197.624, 64401500151: 195.972,
64401500141: 195.972, 64401500121: 199.102, 64401500111: 209.107,
64401500101: 208.545, 64401500091: 205.174, 64401500081: 201.995,
64401500071: 198.728, 64401500431: 194.082, 64401500421: 191.084,
64401400401: 189.456, 64401500391: 187.702, 64401500481: 188.639
},
# Add other rivers here following the same structure
'VENEZ_2023': {
61302000121: 432.189, 61302000111: 444.248, 61302000101: 462.398,
61302000091: 471.208, 61302000081: 489.801, 61302000071: 495.978,
61302000061: 516.158, 61302000051: 528.803
},
'B1':{62269900581: 356.765, 62269900571: 350.499, 62269900561: 341.238, 62269900551: 334.612,
62269900541: 320.473, 62269900531: 319.445, 62269900521: 322.209, 62269900511: 323.755,
62269900501: 328.199, 62269900491: 330.565, 62269900481: 351.444, 62269900471: 354.851,
62269900461: 356.663, 62269900451: 360.607, 62269900441: 361.981, 62269900431: 371.9,
62269900421: 372.763, 62269900411: 383.758, 62269900401: 385.937, 62269900391: 394.43,
62269900381: 397.365, 62269900371: 399.59},
'B14': {62269200861: 119.29, 62269200851:125.112,
62269200841: 137.282, 62269200831:142.473, 62269200821: 145.013,
62269201111: 146.225, 62269201101: 153.596, 62269201091:155.636,
62269201081:156.43, 62269201071: 157.744, 62269201061: 158.992,
62269201471: 160.291, 62269201461: 162.202, 62269201451: 168.655,
62269201441: 170.582, 62269201431: 184.389, 62269201421: 200.342,
62269201411: 209.2, 62269201501: 212.457, 62269201511: 217.882,
62269200661: 221.634, 62269200651: 230.265, 62269200331: 234.676,
62269200321: 239.232, 62269200311: 239.233, 62269200121: 321.477,
62269200111: 321.478, 62269200101: 329.461, 62269200091:344.337,
62269200081: 350.273, 62269200071: 369.407, 62269200061: 373.121,
62269200051: 376.593},
'BERMARIVO': {18192000391: 693.688,
18192000141: 704.503},
'MALAWI_2014': {12222000071: 63.302, 12222000061: 63.302,
12222000051: 128.09, 12221800041:128.09},
'RIOPIRAI': {62269800631: 9.104,
62269800621: 11.362,
62269800611: 15.562,
62269800601: 22.907,
62269800591: 26.64,},
'RUVU': {11738000251: 12.753, 11738000241: 21.43,
11738000231: 43.357, 11738000221: 123.203,
11738000211: 122.944, 11738000201: 126.41,
11738000191: 126.847, 11738000181: 127.509,
11738000171: 128.771, 11738000161: 128.248,
11738000151: 128.891, 11738000141: 127.35,
11738000131: 132.937, 11738000121: 132.07,
11738000111: 134.76, 11738000101: 131.892,
11738000091: 132.23, 11738000081: 129.944,
11738000071: 141.319, 11738000061: 138.696,
11738000051: 144.826, 11738000041: 150.71,
11738000031: 150.337, 11738000023: 139.623,
11738000013: 131.661},
'SULLENGUOLE': {48305900141: 17.491, 48305900391: 17.277, 48305900391: 118.883,
48305900381: 19.006, 48305900371: 19.202, 48305700171: 28.535,
48305700161: 28.655, 48305700151: 29.371, 48305600141: 29.394,
48305600131: 29.48, 48305600121: 29.547, 48305600111: 29.308,
48305600101: 29.222, 48305600091: 32.393, 48305600081: 26.937,
48305600071: 26.937, 48305600061: 26.937, 48305600051: 26.291,
48305600041: 25.384},
'V7': {61562000801:19.915, 61562000791: 25.417, 61562000781: 28.146,
61562000771: 30.063, 61562000761: 33.922, 61562000751: 38.219,
61562000741: 56.294, 61562000731: 65.335, 61562000721: 68.176,
},
'V11': {61549000561: 132.303, 61549000221: 134.989, 61549000211: 139.422,
61549000201: 142.485, 61549000191: 148.763, 61549000181: 151.645,
61549000171: 166.066},
'VENEZ_2022_N': {61303300031: 115.966, 61303300021: 117.893, 61303300013: 118.883},
'VENEZ_2023_W': {61204400141: 71.554, 61204400131: 180.433, 61204400121: 184.186,
61204400111: 186.904, 61204400101: 890.213, 61204400091: 1010.461,
61204400411: 1016.752, 61204400051: 1025.594, 61204400031: 1108.272,
61204400021: 1110.742, 61204400011: 1123.275, 61204300171: 2862.789,
61204300151: 2875.107, 61204300141: 2953.874, 61204300131: 2969,
61204300121: 2995.751, 61204300111: 3005.847},
'VENEZ_2023': {61302000121: 432.189, 61302000111: 444.248, 61302000101: 462.398,
61302000091: 471.208, 61302000081: 489.801, 61302000071: 495.978,
61302000061: 516.158, 61302000051: 528.803}
}
# Convert the nested dictionary into a DataFrame
rows = []
for river, discharges in data.items():
for reach_id, discharge in discharges.items():
rows.append({'river_name': river, 'reach_id': reach_id, 'discharge_value': discharge})
df = pd.DataFrame(rows)
# Save the DataFrame to a CSV file
df.to_csv('river_discharge_data.csv', index=False)