hey here's my code (I know there details to work yet), but I have a main problem so far, I want that depending on 2 inputs (u and horario_emision) the variable 'estabilidad_atm' gets a new value, it works when the first input is not in the linspace() ranges, so I'm guessing I'm not applying them properly. I can't use range() function cause I need floats.
I'll be glad to be pointed out where and what I' doing wrong. Thanks!
import numpy as np
estabilidad_atm = ''
u = float(input('ingrese velocidad de viento de supervicie'))
horario_emision = input('ingrese si emisiones es de dia(1) o de noche (2)')
if horario_emision == '1':
radiacion = float(input('ingrese la radiacion solar (Wm2)'))
if u < 2 and radiacion >= 925:
estabilidad_atm += 'A'
elif u < 2 and radiacion in range(675, 925):
estabilidad_atm += 'A'
elif u < 2 and radiacion in range(176, 675):
estabilidad_atm += 'B'
elif u < 2 and radiacion <= 175:
estabilidad_atm += 'D'
elif u in np.linspace(2, 3) and radiacion >= 925:
estabilidad_atm += 'A'
elif u in np.linspace(2, 3) and radiacion in range(675, 925):
estabilidad_atm += 'B'
elif u in np.linspace(2, 3) and radiacion in range(176, 675):
estabilidad_atm += 'C'
elif u in np.linspace(2, 3) and radiacion <= 175:
estabilidad_atm += 'D'
elif u in np.linspace(3.1, 5) and radiacion >= 925:
estabilidad_atm += 'A'
elif u in np.linspace(3.1, 5) and radiacion in np.linspace(675, 925):
estabilidad_atm += 'B'
elif u in np.linspace(3.1, 5) and radiacion in np.linspace(176, 675):
estabilidad_atm += 'C'
elif u in np.linspace(3.1, 5) and radiacion <= 175:
estabilidad_atm += 'D'
elif u in np.linspace(5.1, 6) and radiacion >= 925:
estabilidad_atm += 'A'
elif u in np.linspace(5.1, 6) and radiacion in range(675, 925):
estabilidad_atm += 'B'
elif u in np.linspace(5.1, 6) and radiacion in range(176, 675):
estabilidad_atm += 'C'
elif u in np.linspace(5.1, 6) and radiacion <= 175:
estabilidad_atm += 'D'
elif u > 6 and radiacion >= 925:
estabilidad_atm += 'A'
elif u > 6 and radiacion in range(675, 925):
estabilidad_atm += 'B'
elif u > 6 and radiacion in range(176, 675):
estabilidad_atm += 'C'
elif u > 6 and radiacion <= 175:
estabilidad_atm += 'D'
elif horario_emision == '2':
condicion_noche = input('ingrese nivel de nubosidad de noche: menor a 4/8 de covertura(1) o mayor a 4/8 de covertura(2)')
if u < 2 and condicion_noche == '1' or condicion_noche == '2':
estabilidad_atm += 'F'
elif u in np.linspace(2, 3) and condicion_noche == '1':
estabilidad_atm += 'E'
elif u in np.linspace(2,3) and condicion_noche== '2':
estabilidad_atm += 'F'
elif u in np.linspace(3.1, 5) and condicion_noche == '1':
estabilidad_atm += 'D'
elif u in np.linspace(3.1, 5) and condicion_noche == '2':
estabilidad_atm += 'E'
elif u > 5 and condicion_noche == '2':
estabilidad_atm += 'D'
estabilidad_atm
radiacion in range(675, 925)
does not check if radiacion
is in the range between 675 and 925. It checks if radiacion
is one of the integer numbers 675, 676, ... 924 (but not 925). So, for example, 670.5 is not in range(675, 925)
. What you need is an explicit inequality check: 675 <= radiacion <= 925
. Same with linspace
: 3.1 <= u <= 5
, not u in np.linspace(3.1, 5)
.