this is my situation:
I have variables of x coordinates. .
x_1 = 24
x_2 = 94
x_3 = 120
And I have weather stations that are located on one of these x values.
station_1 = 100
station_2 = 80
station_3 = 94
station_4 = 24
station_6 = 120
station_7 = 3
The station x coordinates stay the same but not the x_1, x_2 and x_3 coordinates. They change depending on the input of my script. Although the x_ coordinates always matches one of the station coordinates.
Now I need to find the matching station with the x_ coordinate. I tried this:
if x_1 == 100:
x1_station = station_1
elif x_1 == 80:
x1_station = station_1
elif x_1 == 94:
x1_station = station_1
elif x_1 == 24:
x1_station = station_1
elif x_1 == 120:
x1_station = station_1
elif x_1 == 3:
x1_station = station_1
else:
print("no matching stations")
print(x1_station)
But this will not work. And it also looks a bit of to much repetition. Does anyone know how to solve this? Maybe a for loop would help.
Kind regards,
Simon
section_1variables need to be changed in if conditions