aviationtools 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,61 @@
1
+ import math
2
+ import pandas as pd
3
+ import sqlite3
4
+
5
+ #Calculate the distance between two points on the earth specified in decimal degrees
6
+ def point_to_point(lat1, lon1, lat2, lon2, mode):
7
+ mode = mode
8
+ #Convert latitude and longitude from degrees to radians
9
+ lat1_rad = math.radians(lat1)
10
+ lon1_rad = math.radians(lon1)
11
+ lat2_rad = math.radians(lat2)
12
+ lon2_rad = math.radians(lon2)
13
+
14
+ #Haversine formula
15
+ dlon = lon2_rad - lon1_rad
16
+ dlat = lat2_rad - lat1_rad
17
+ a = math.sin(dlat / 2)**2 + math.cos(lat1_rad) * math.cos(lat2_rad) * math.sin(dlon / 2)**2
18
+ c = 2 * math.asin(math.sqrt(a))
19
+
20
+ #Radius of earth in miles (mean radius)
21
+ r=3959.87433
22
+
23
+ #Calculate the distance
24
+ distance = c * r
25
+
26
+ #Print the distance between the two points or airports based on the mode
27
+ if mode == "NULL":
28
+ print(f"Distance between points: {distance} miles")
29
+ elif mode == "airport":
30
+ print(f"Distance between airports: {distance} miles")
31
+
32
+ #Find the distance between two airports given their ICAO codes
33
+ def airport_to_airport(airport1, airport2):
34
+ #Connect to the SQLite database
35
+ conn = sqlite3.connect("aviationtools/airports.db")
36
+ cursor = conn.cursor()
37
+
38
+ #Query the database for the latitude and longitude of the airports
39
+ cursor.execute("SELECT LAT_DECIMAL, LONG_DECIMAL FROM airports WHERE ICAO_ID = ?", (airport1,))
40
+ result1 = cursor.fetchone()
41
+ cursor.execute("SELECT LAT_DECIMAL, LONG_DECIMAL FROM airports WHERE ICAO_ID = ?", (airport2,))
42
+ result2 = cursor.fetchone()
43
+
44
+ #Close the database connection
45
+ conn.close()
46
+
47
+ #Check if both airports were found
48
+ if result1 is None or result2 is None:
49
+ raise ValueError("One or both ICAO codes not found in the database.")
50
+ lat1, lon1 = result1
51
+ lat2, lon2 = result2
52
+
53
+ #Calculate the distance using the point_to_point function
54
+ distance = point_to_point(lat1, lon1, lat2, lon2, "airport")
55
+ return distance
56
+
57
+
58
+
59
+
60
+
61
+
aviationtools/icao.py ADDED
@@ -0,0 +1,11 @@
1
+ import sqlite3
2
+
3
+ def get_icao_code(city, state):
4
+
5
+ #Define an object of the airports database airports.db
6
+ conn = sqlite3.connect("aviationtools/airports.db")
7
+ cursor = conn.cursor()
8
+ cursor.execute("SELECT ICAO_ID, ARPT_NAME, FSS_ID FROM airports WHERE CITY = ? AND STATE_CODE = ?", (city, state))
9
+ rows = cursor.fetchall()
10
+ for row in rows:
11
+ print(row[0],row[1], row[2])
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: aviationtools
3
+ Version: 0.1.0
4
+ Summary: A collection of aviation-related tools and utilities.
5
+ Author-email: "George L. Carlson II" <carlsongeorge61@yahoo.com>
6
+ Classifier: Development Status :: 3 - Alpha
7
+ Classifier: Intended Audience :: Developers
8
+ Classifier: Programming Language :: Python :: 3.11
9
+ Classifier: Topic :: Scientific/Engineering
10
+ Requires-Python: >=3.11
11
+ Description-Content-Type: text/markdown
12
+ License-File: License.txt
13
+ Dynamic: license-file
14
+
15
+ # Project name:
16
+ aviationtools
17
+
18
+ ## Author:
19
+ George L. Carlson II
20
+ email: carlsongeorge61@yahoo.com
21
+ Website or GitHub link None at this time
22
+
23
+ ## License:
24
+ This project is licensed under the MIT License - see the LICENSE file for details.
25
+
26
+ ## Description:
27
+ This project is a collection of tools and utilities for aviation enthusiasts, pilots, and professionals.
28
+ It currently includes functions to calculate the distance between two points
29
+ on the earth's surface given the decimal degree of latitude and longitude for
30
+ each point. Included is a function tha calcutaes the distance between two
31
+ airports given their ICAO_ID. Additionally the aviation package includes a
32
+ function to determine the ICAO_ID by querying an airports database by
33
+ CITY by STATE.
34
+
35
+ ## Usage:
36
+ To use the aviationtools package, pip install aviationtools into your virtual
37
+ environment, then you can import aviationtools into your Python script
38
+ and call the available functions.
39
+
40
+ For example, to calculate the distance between two points, you can use the
41
+ point_to_point(lat1, long1, lat2, long2, mode) function where lat and long parameters
42
+ are in degree decimal format and mode is "NULL".
43
+
44
+ To calculate the distance between two airports call the airport_to_airport(airport1, airport2)
45
+ function where airport1 and airport2 are the ICAO_ID of the airports. Example
46
+ KBUF and KTPA if you are flying from Buffalo Ny to Tampa Fl.
47
+
48
+ To determine the ICAO_ID of an airport by city and state, call the
49
+ get_icao_code("CITY", "STATE_CODE"). Example get_icao_code("BUFFALO", "NY")
50
+ and the function will return all the ICAO codes found in Buffalo NY and the
51
+ User can then select the airport interested in and use that ICAO code to calculate
52
+ the distance to another airport. CITY and STATE_CODE are case sensitive and
53
+ must be entered in capital letters.
54
+
55
+ ## Contributing:
56
+
57
+ ## Versioning:
58
+ Version 0.1.0
59
+
60
+
61
+
62
+
63
+ `
64
+
65
+
@@ -0,0 +1,8 @@
1
+ aviationtools/__init__.py,sha256=frcCV1k9oG9oKj3dpUqdJg1PxRT2RSN_XKdLCPjaYaY,2
2
+ aviationtools/distance.py,sha256=Ei7yMwMQBIYPOFKKOg0MtR8bG_B9p50gM5p4wVDpM3Q,2022
3
+ aviationtools/icao.py,sha256=YcbvTZJA-JaAvXVn6TYIo7clWaQfdgeerhQ8MlSS6dk,408
4
+ aviationtools-0.1.0.dist-info/licenses/License.txt,sha256=iIn9YtHYh7I38O0NoFygKysznlGJWEGIKIzqzfzxVOU,1984
5
+ aviationtools-0.1.0.dist-info/METADATA,sha256=6ILqQYPPpygo2XYwZVmKwR8lpSBcrFtlDh4RbOSK52k,2450
6
+ aviationtools-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
7
+ aviationtools-0.1.0.dist-info/top_level.txt,sha256=QnyDW2ZN_SU9nBnwdZyn_ykyxsm6uPDtNaFKXIucj8U,14
8
+ aviationtools-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,26 @@
1
+ aviationtools is licensed under MIT License.
2
+
3
+ Copyright (c) 2026 George L. Carlson II
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
6
+ to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
7
+ sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
8
+ following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
13
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR(S) OR COPYRIGHT HOLDER(S)
14
+ BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
15
+ OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16
+
17
+ In addition, the following disclaimer applies to aviationtools:
18
+
19
+ In no event shall the author or copyright holder be liable for any direct, indirect, incidental, special, exemplary,
20
+ or consequential damages or losses (including, but not limited to, procurement of substitute goods or services;
21
+ loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract,
22
+ strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software,
23
+ even if advised of the possibility of such damage.
24
+
25
+ And further that the name of the author or copyright holder shall not be used in advertising or otherwise to promote the sale,
26
+ use, or other dealings in this software without prior written authorization from the author or copyright holder.
@@ -0,0 +1 @@
1
+ aviationtools