Forum Discussion

A11ey's avatar
A11ey
Icon for Community Manager rankCommunity Manager
11 months ago

June LM Community Coding Challenge!


Write a script for monitoring hurricanes. 

 

 

Must include:

  • Severity warnings

  • Google maps location tracking

  • Integration with noaa.gov data only

  • Does not require signup or payment

 

Feel free to customize as long as you include the requirements above!



 

Rules of Engagement

How to win:
User with the most 👍🏻👍🏻👍🏻👍🏻likes on their post wins!  So don’t just post your code, encourage/recruit others to review and like the best example.  Github and/or screenshots are acceptable.

Eligibility

Only one winner. LM Customer or Employee.  Contest Ends June 30th 2023.

Prizes:

Winner gets a choice of a Community Hat, T-Shirt or $25 Amazon Gift Card.

Personalized LM Hurricane badge!


 

8 Replies

  • Here is a simple python version - it still needs more work but I don’t have time to review all of the NOAA and Google API documentation for location tracking in order to determine how to parse the received data from those services. This example parses json data but it could be received in csv format. If anyone knows the format that Google API and NOAA uses I could update further. 

    import requests
    import json

    # Function to retrieve hurricane data from noaa.gov
    def get_hurricane_data():
        url = "https://www.nhc.noaa.gov/gis/forecast/archive/latest_wsp_5day_latest.zip"

        try:
            response = requests.get(url)
            # Process the response and extract data
            
            # Return the extracted hurricane data
            return hurricane_data
     

    # Function to display severity warnings
    def display_severity_warnings(hurricane_data):
        # Extract the relevant severity information from hurricane_data

        print("----- Severity Warnings -----")
        print("Hurricane:", hurricane_data["name"])
        print("Severity Level:", hurricane_data["severity"])
        print("Warning Message: ")

        if hurricane_data["severity"] == "Category 1":
            print("This hurricane is categorized as a Category 1 storm.")
        elif hurricane_data["severity"] == "Category 2":
            print("This hurricane is categorized as a Category 2 storm.")
        elif hurricane_data["severity"] == "Category 3":
            print("This hurricane is categorized as a Category 3 storm.")
        elif hurricane_data["severity"] == "Category 4":
            print("This hurricane is categorized as a Category 4 storm.")
        elif hurricane_data["severity"] == "Category 5":
            print("This hurricane is categorized as a Category 5 storm.")

        print("-----------------------------")

    # Google Maps location tracking
    def track_location():
        # code to track the user's location using Google Maps API.
      

        print("----- Location Tracking -----")
        print("Tracking user's location on Google Maps...")
        # tracking code here
        print("Location tracked successfully.")
        print("-----------------------------")

    # Main script execution
    if __name__ == "__main__":
        # Step 1: Retrieve hurricane data
        hurricane_data = get_hurricane_data()

        # Step 2: Display severity warnings
        display_severity_warnings(hurricane_data)

        # Step 3: Track user's location
        track_location()
     

  • Nice. Meant to grab hurricane lat/long or user lat/long? I thought storm lat/long. Does your code extract the zip file?

  • A11ey's avatar
    A11ey
    Icon for Community Manager rankCommunity Manager

    Congratulations!!  Our winner is @Gusty with the most likes!  We have a special recognition for @Stuart Weenig for writing a fully functional monitoring script that works with the LM Platform!  

    You both have been awarded your new badge and I’ll be sending you both a PM shortly to get your preference on your prizes!