Python Forum
Invoking function in if else statement, not working!
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Invoking function in if else statement, not working!
#11
(May-30-2019, 06:32 PM)ibaad1406 Wrote: n if else statement but the variables defined in there seem not be stored as they should be.
sorry, maybe I misunderstood your question... your code works (i.e. it detects it's GALILEO file and should run your header_galileo function. What exactly is the problem?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#12
@buran:
i want to invoke functions header_gps,header_glonass,header_galileo inside if else statement. check it as there is no variable stored
"""Script for header section for Galileo for rinex3 navigation file"""
""" header_galileo take input for header scetion in single string and store 
all the information of header """


def header_galileo(data2):
    
    #rinex version or type
    
    format_version   = data2[0:10]
    file_type        = data2[20:21]
    satellite_system = data2[40:41]
    header_label = data2[61:80]

    #PGM/RUN BY/DATE
    
    pgm       = data2[81:101]
    run_by    = data2[101:121]
    date_time = data2[121:141]
    header_label_2= data2[141:160]


    #IONOSPHERIC CORRECTION
    
    ionospheric_correction_GAL = data2[162:166]
    parameters_GPS_ai0  = data2[167:179]
    parameters_GPS_ai1  = data2[179:191]
    parameters_GPS_ai2  = data2[191:203]
    parameters_GPS_ai3  = data2[203:215]
    time_mark_GAL       = data2[216:217]
    SV_ID_GAL           = data2[218:220]
    header_label_3= data2[221:240]

    #time_second_correction
    
    correction_time_a0 = data2[240:244]
    coefficient_1_a0   = data2[1245:262]
    coefficient_2_ao   = data2[262:278]
    t_refrence_a0      = data2[278:285]
    w_refrence_a0      = data2[285:290]
    egnos_a0           = data2[291:296]
    utc_identifier_a0  = data2[297:299]
    header_label_4 = data2[301:320]

    #time_second_correction
    
    correction_time_a1 = data2[320:324]
    coefficient_1_a1   = data2[325:342]
    coefficient_2_a1   = data2[342:358]
    t_refrence_a1      = data2[358:365]
    w_refrence_a1      = data2[365:370]
    egnos_a1           = data2[371:376]
    utc_identifier_a1  = data2[377:379]
    header_label_5= data2[381:400]

    #leap_seconds
    
    current_leap    = data2[400:406]
Reply
#13
All the variables in the functions are local to the functions, when the function ends they are forgotten about.
Reply
#14
@Yoriz
if i want to store all variable of my function then what could i do?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  invoking python in Terminal Euler 2 591 Aug-25-2023, 06:17 AM
Last Post: perfringo
Shocked kindly support with this dropna function not working gheevarpaulosejobs 2 617 Jul-24-2023, 03:41 PM
Last Post: deanhystad
Question If, elif, and else statement not working PickleScripts 3 841 Mar-30-2023, 02:53 PM
Last Post: PickleScripts
  If statement not working correctly? MrKnd94 2 799 Nov-16-2022, 02:49 AM
Last Post: deanhystad
Exclamation Function Not Working Alivegamer 7 1,818 Jul-19-2022, 01:03 PM
Last Post: deanhystad
  try function working on PC but not raspberry pi AnotherSam 1 1,500 Oct-11-2021, 04:51 AM
Last Post: bowlofred
  How to invoke a function with return statement in list comprehension? maiya 4 2,753 Jul-17-2021, 04:30 PM
Last Post: maiya
  If Statement not working...Why? Milfredo 2 2,163 Oct-17-2020, 03:23 AM
Last Post: Milfredo
  Input() function not working in VS Code darpInd 7 13,089 Feb-17-2020, 03:28 PM
Last Post: snippsat
  Unrelated new function causing existing working function to fail Nick_G 2 2,213 Jan-27-2020, 07:21 PM
Last Post: Nick_G

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020