Skip to content

This is a python program that I've developed during a traineeship. The program reads the GKA file format to generate statistics and graphs about the evolving landslide.

License

Notifications You must be signed in to change notification settings

JonasMht/GKA_file_manipulation_software

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GKA_file_manipulation_software

The main file of this Python program (readGKA.py) depends on two other files (functions.py & parameters.py) that both provide useful functions aswell as global variables and library imports.

Usage:

  • Run the program in the cmd or shell write python readGKA.py to execute the program.

You will be prompted with multiple choices:

  • Concatenate n files will ask for an output file and multiple files that will be concatenated in the output file (if you have entered all your files press enter to confirm).
  • Prism statistics will ask for a gka (accepts wildcards (*,?)) and output file in which statistics about every prism will be stored.
  • Plot prism will ask for a gka file path (accepts wildcards (*,?)) and a prism name then plots the meteo position of this given prism over time.
  • Quit will exit the program loop/

Imported libraries:

  • time (provides a function to get current time in seconds)
  • datetime (provides date conversion functions)
  • math (provides math functions)

Global Variables:

  • XS YS ZS (position of the total station in meters)
  • V0 (yaw rotation in Gradians)
  • COEFF_J & COEFF_N (two constants used in the meteorological correction formula provided by the EDM manufacturer)
  • PI (value of pi provided by the math library)
  • param (a list of 32 elements that will hold strings (used in several functions such as ConvertGKA_to_ReadableInformation(text)))
  • prismParam a list of 34 elements (a list of 2D list containing each a string and a value. This list represents the data contained on a prism line in a gka file)

Functions:

  • SortCrescent(li, index) ()

    Argument
    • li a 2D list of floats
    • index an integer
    Return
    • A sorted and crescent list by the elements located at the index position of li.

  • FindMin(li, index) ()

    Argument
    • li a 2D list of float
    • index an integer
    Return
    • The value of the smallest element in the index position of evry list element in li.

  • FindIndexByName(name, l)

    Argument
    • name a string
    • l the prismParam global list
    Return
    • The index of the element that contains the correct name in the prismParam list l.

  • FindValueByName(name, l)

    Argument
    • name a string
    • l the prismParam global list
    Return
    • The value that is linked to the name in the prismParam list l.

  • ChangeValueByName(name, n, l)

    Argument
    • name a string
    • n a float or an integer
    • l the prismParam global list
    Side effect
    • In the prismParam list l change the value that is linked to the name to n.

  • gps_to_dt(gpsweek,gpsseconds)

    Argument
    • gpsweek an integer
    • gpsseconds a float
    Return
    • Conversion of a GPS date to datetime.

  • dec_to_dt(dec)

    Argument
    • dec a float
    Return
    • Conversion of a decimal year to datetime.

  • dt_to_dec(dt)

    Argument
    • dt datetime format
    Return
    • Conversion of a datetime to decimal year (float).

  • ConcatenationLoop(fileList)

    Argument
    • fileList a list of strings
    Return
    • A concatenated string of all the contents of the files represented by path strings in the fileList/

  • ConvertGKA_to_List(text)

    Argument
    • text a gka format string.
    Return
    • A list containing the prism name, position of recording, decimal year, position and meteo corrected position for each prism..
    Math
    • GPSwk = int(FindValueByName("GPSwk",prismParam))

    • SOWk = float(FindValueByName("SOWk",prismParam))

    • DOWk = float(FindValueByName("DOWk",prismParam))

    • decYear = dt_to_dec(gps_to_dt(GPSwk, SOWk))

    • DI = float(FindValueByName("DI",prismParam))

    • Beta = float(FindValueByName("Beta",prismParam)) Rotation around the horizontal axis

    • Alpha = float(FindValueByName("Alpha",prismParam)) Rotation around the vertical axis

    • ref = 0.0

    • Gis = (V0 + Alpha - ref)*PI/200 in radiants

    • Horizon = Beta*PI/200 in radiants

    • Pression = float(FindValueByName("Pression",prismParam))

    • Temp = float(FindValueByName("Temp",prismParam))

    • Dmeteo = DI + DI * (COEFF_J - COEFF_N * Pression / (273.16+Temp)) * math.pow(10,-6)

    • originXrot = math.sin(Horizon) * math.sin(Gis)

    • originYrot = math.sin(Horizon) * math.cos(Gis)

    • originZrot = math.cos(Horizon)

    • xi = XS + DI * originXrot Prism position without correction

    • yi = XS + DI * originYrot Prism position without correction

    • zi = XS + DI * originZrot Prism position without correction

    • xmeteo = XS + originXrot * Dmeteo

    • ymeteo = XS + originYrot * Dmeteo

    • zmeteo = XS + originZrot * Dmeteo


  • Sort_list_by_Prism_and_Date(lst)

    Argument
    • lst A list containing the prism name, position of recording, decimal year, position and meteo corrected position for each prism.
    Return
    • A 4D list containing lists of prism informations sorted by name and date ([[Prism1 Name ,[[Prism1 information at t0], [Prism1 information at t1],.., [Prism1 information at tn]]],...])

  • Note to myselfe : I will have to create functions out of some processes

About

This is a python program that I've developed during a traineeship. The program reads the GKA file format to generate statistics and graphs about the evolving landslide.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages