Python Forum
Start checking for geology reports
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Start checking for geology reports
#2
Give it a go, I or any other moderator would be glad to advise, but you caught me in a generous moment for the last one.
Will always advise.

Hint use dictionaries for code lookup:
for example:
class Codes:
    def __init__(self):
        self.GeologyCodes = {
            'Well File Status': {
                'PO': 'Producing Oil Well',
                'PG': 'Producing Gas Well',
                'DH': 'Dry Hole ',
                # Add rest of Well Status codes below
                'AP': 'Permit to Drill'
            },
            'Classification': {
                'O': 'Oil Well',
                'G': 'Gas Well',
                # Rest of Classification codes below
                'LW': 'LandOwner Water Well '
            }
            # 'Land Types', 'County Codes', etc. below
        }

    # This dictionary can saved as a json file and recalles in any script that needs it:

    def print_code(self, cd_type, code):
        """
        print_code(cd_type, code)

        Example: you get a well file status code from some data somewhere, and want to display that code

        :cd_type: Holds code type 'Well File Status', or 'Classification', etc.
        :code: Holds actual code like 'AP'
        
        :returns: None
        """
        print(self.GeologyCodes[cd_type][code])

    def try_status(self):
        """
        try_status()

        test print_code
        
        :returns: None
        """
        self.print_code('Well File Status', 'PG')
        code_type_from_file = 'Classification'
        code_from_file = 'LW'
        self.print_code(code_type_from_file, code_from_file)

if __name__ == '__main__':
    cd = Codes()
    cd.try_status()
results:
Output:
[Running] python "i:\python\WellInfo\src\Codes.py" Producing Gas Well LandOwner Water Well [Done] exited with code=0 in 0.054 seconds
Of course, dictionaries like this should be saved in appropriate directories as json data, and loaded when needed
Reply


Messages In This Thread
Start checking for geology reports - by tjnichols - Jun-04-2018, 08:11 PM
RE: Start checking for geology reports - by Larz60+ - Jun-04-2018, 08:55 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python best library for Excel reports & review of existing code MasterOfDestr 4 684 Feb-14-2024, 03:39 PM
Last Post: MasterOfDestr
  Help with Creating a Script for Automating Reports SunWers 1 1,934 Dec-29-2020, 10:21 PM
Last Post: jjc385
  Parsing Date/Time from Metar Reports with 6 hourly weather information Lawrence 0 2,359 May-03-2020, 08:15 PM
Last Post: Lawrence
  How do I generate reports in pdf format? okbeat9 2 3,298 Jan-13-2020, 04:38 AM
Last Post: okbeat9
  Python for Reports in HTML or PDF Format ImPyBoy17 1 3,116 Dec-10-2018, 09:35 PM
Last Post: j.crater
  UTF-8 decoder reports bad byte that is not there Skaperen 0 2,304 Oct-11-2018, 04:46 AM
Last Post: Skaperen
  Generate PDF reports giu88 7 9,221 Aug-26-2018, 02:00 PM
Last Post: giu88
  What's the difference b/w assigning start=None and start=" " Madara 1 2,329 Aug-06-2018, 08:23 AM
Last Post: buran
  Best software for creating printed reports? birdieman 5 4,465 Feb-02-2017, 02:39 AM
Last Post: birdieman
  Reports with Python? panoss 1 3,305 Jan-11-2017, 10:33 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

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