iomapapps package

Subpackages

Submodules

iomapapps.Menu module

IO-Aero Menu.

iomapapps.Menu.CHOICE_UG_APP: bool | None
iomapapps.Menu.CHOICE_UG_PAGE: bool | None

iomapapps.glob_local module

Global constants and variables.

iomapapps.mapapps module

IO-MAP-APPS interface.

class iomapapps.mapapps.Global(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum class for defining global constants.

Enum class for defining global constants used throughout the application, particularly for setting configurations that require consistent values in multiple modules. This approach ensures that all parts of the application can reference the same data points without redundancy.

TS_VFR_RASTER_CHARTS_HOST = 'localhost'
TS_VFR_RASTER_CHARTS_PORT = 8080
iomapapps.mapapps.check_arg_task(args: Namespace) None

Check the command line argument: -t / –task.

Args:

args (argparse.Namespace): Command line arguments.

iomapapps.mapapps.get_args() None

Load the command line arguments into the memory.

iomapapps.mapapps.progress_msg(msg: str) None

Create a progress message.

Args:

msg (str): Progress message

iomapapps.mapapps.process_awc_weather_data_airsigmet() None

d_a_a: Download and prepare the AWC AIRMET/SIGMET data.

iomapapps.mapapps.process_awc_weather_data_metar() None

d_a_m: Download and prepare the AWC METAR data.

iomapapps.mapapps.process_awc_weather_data_station() None

d_a_s: Download and prepare the AWC station data.

iomapapps.mapapps.process_awc_weather_data_taf() None

d_a_t: Download and prepare the AWC TAF data.

iomapapps.mapapps.process_faa_dds_sua_data() None

d_d_s: Download and prepare the FAA SUA data.

iomapapps.mapapps.process_faa_nasr_data() None

d_f_n: Download and prepare the FAA NASR data.

iomapapps.mapapps.process_faa_tfr_data() None

d_f_t: Download and prepare the FAA TFR data.

iomapapps.mapapps.process_natural_earth_data() None

d_n_e: Download and prepare the Natural Earth data.

iomapapps.mapapps.progress_msg_time_elapsed(duration: int, event: str) None

Create a time elapsed message.

Args:

duration (int): Time elapsed in ns. event (str): Event description.

iomapapps.mapapps.terminate_fatal(error_msg: str) None

Terminate the application immediately.

Args:

error_msg (str): Error message

iomapapps.mapapps.version() str

Return the version number of the IO-MAP-APPS application.

Returns:

The version number of the IO-MAP-APPS application

Return type:

str

iomapapps.mapapps.run_tile_server_aws_detached() None

Start an AWS tile server that runs independently of the parent process.

iomapapps.mapapps.run_tile_server_local_detached() None

Start a local tile server that runs independently of the parent process.

iomapapps.mapapps.start_tile_server_aws() None

r_t_a: Start the AWS tile server.

iomapapps.mapapps.start_tile_server_locally() None

r_t_l: Start the local tile server.

iomapapps.process_data module

Process Data.

class iomapapps.process_data.ColumnName(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum class for standardizing the column names used across various datasets.

This class helps in maintaining consistency in accessing column names across data processing scripts.

ELEV = 'elev'
ICAOID = 'icaoId'
LAT = 'lat'
LON = 'lon'
PRIORITY = 'priority'
SITE = 'site'
class iomapapps.process_data.Global(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Enum class for defining global constants.

Enum class for defining global constants used throughout the application, particularly for setting configurations that require consistent values in multiple modules. This approach ensures that all parts of the application can reference the same data points without redundancy.

AWC_WEATHER_DATA_AWS = False
AWC_WEATHER_DATA_AWS_KEY = 'AWC/Weather'
AWC_WEATHER_DATA_AWS_REGION = 'us-east-2'
AWC_WEATHER_DATA_AWS_S3_BUCKET = 'io-swiss-maps-97086bd873051c88'
AWC_WEATHER_DATA_DEBUG = True
AWC_WEATHER_DATA_FILE_AIRSIGMET_SOURCE = '.airsigmets.csv'
AWC_WEATHER_DATA_FILE_AIRSIGMET_TARGET = 'airsigmets.geojson'
AWC_WEATHER_DATA_FILE_DIR = 'data/tests/AWC/Weather/'
AWC_WEATHER_DATA_FILE_METAR_SOURCE = '.metars.csv'
AWC_WEATHER_DATA_FILE_METAR_TARGET = 'metars.geojson'
AWC_WEATHER_DATA_FILE_PREFIX = 'data/tests/'
AWC_WEATHER_DATA_FILE_STATION_SOURCE = '.stations.json'
AWC_WEATHER_DATA_FILE_STATION_TARGET = 'stations.geojson'
AWC_WEATHER_DATA_FILE_TAF_SOURCE = '.tafs.csv'
AWC_WEATHER_DATA_FILE_TAF_TARGET = 'tafs.geojson'
AWC_WEATHER_DATA_TIMEOUT = 10
AWC_WEATHER_DATA_URL_AIRSIGMET = 'https://aviationweather.gov/data/cache/airsigmets.cache.csv.gz'
AWC_WEATHER_DATA_URL_METAR = 'https://aviationweather.gov/data/cache/metars.cache.csv.gz'
AWC_WEATHER_DATA_URL_STATION = 'https://aviationweather.gov/data/cache/stations.cache.json.gz'
AWC_WEATHER_DATA_URL_TAF = 'https://aviationweather.gov/data/cache/tafs.cache.csv.gz'
AWC_WEATHER_DATA_WORK_DIR = 'data/temp_test'
FAA_NASR_DATA_AWS = False
FAA_NASR_DATA_AWS_KEY = 'FAA/NASR'
FAA_NASR_DATA_AWS_REGION = 'us-east-2'
FAA_NASR_DATA_AWS_S3_BUCKET = 'io-swiss-maps-97086bd873051c88'
FAA_NASR_DATA_DEBUG = True
FAA_NASR_DATA_FILE_AIRPORTS = 'airports.geojson'
FAA_NASR_DATA_FILE_CLASS_AIRSPACE = 'class_airspace.geojson'
FAA_NASR_DATA_FILE_DIR = 'data/tests/FAA/NASR/'
FAA_NASR_DATA_FILE_PJA_AIRSPACE = 'pja_airspace.geojson'
FAA_NASR_DATA_FILE_PREFIX = 'data/tests/'
FAA_NASR_DATA_TIMEOUT = 10
FAA_NASR_DATA_URL_CLASS_AIRSPACE = 'https://nfdc.faa.gov/webContent/28DaySub/YYYY-MM-DD/class_airspace_shape_files'
FAA_NASR_DATA_WORK_DIR = 'data/tests/temp'
FAA_SUA_DATA_AWS = False
FAA_SUA_DATA_AWS_KEY = 'FAA/DDS'
FAA_SUA_DATA_AWS_REGION = 'us-east-2'
FAA_SUA_DATA_AWS_S3_BUCKET = 'io-swiss-maps-97086bd873051c88'
FAA_SUA_DATA_DEBUG = True
FAA_SUA_DATA_FILE_AIRSPACE = 'sua_airspace.geojson'
FAA_SUA_DATA_FILE_DIR = 'data/tests/FAA/DDS/'
FAA_SUA_DATA_FILE_PREFIX = 'data/tests/'
FAA_SUA_DATA_WORK_DIR_FILE = 'data/tests/Special_Use_Airspace.geojson'
FAA_TFR_DATA_AWS = False
FAA_TFR_DATA_AWS_KEY = 'FAA/TFR'
FAA_TFR_DATA_AWS_REGION = 'us-east-2'
FAA_TFR_DATA_AWS_S3_BUCKET = 'io-swiss-maps-97086bd873051c88'
FAA_TFR_DATA_CRS = 3857
FAA_TFR_DATA_DEBUG = True
FAA_TFR_DATA_FILE_CLASS_AIRSPACE = 'tfr_airspace.geojson'
FAA_TFR_DATA_FILE_DIR = 'data/tests/FAA/TFR/'
FAA_TFR_DATA_FILE_PREFIX = 'data/tests/'
FAA_TFR_DATA_TIMEOUT = 10
FAA_TFR_DATA_URL_CLASS_AIRSPACE = 'https://tfr.faa.gov/tfr2/list.html'
FAA_TFR_DATA_WORK_DIR = 'data/tests/temp'
NATURAL_EARTH_DATA_AWS = False
NATURAL_EARTH_DATA_AWS_KEY = 'Natural Earth'
NATURAL_EARTH_DATA_AWS_REGION = 'us-east-2'
NATURAL_EARTH_DATA_AWS_S3_BUCKET = 'io-swiss-maps-97086bd873051c88'
NATURAL_EARTH_DATA_DEBUG = True
NATURAL_EARTH_DATA_FILE_COUNTRIES = 'countries.geojson'
NATURAL_EARTH_DATA_FILE_DIR = 'data/tests/Natural Earth'
NATURAL_EARTH_DATA_FILE_PLACES = 'places.geojson'
NATURAL_EARTH_DATA_FILE_PREFIX = 'data/tests/'
NATURAL_EARTH_DATA_FILE_STATES = 'states.geojson'
NATURAL_EARTH_DATA_TIMEOUT = 10
NATURAL_EARTH_DATA_URL_COUNTRIES = 'https://github.com/nvkelso/natural-earth-vector/raw/master/10m_cultural/ne_10m_admin_0_boundary_lines_land'
NATURAL_EARTH_DATA_URL_PLACES = 'https://github.com/nvkelso/natural-earth-vector/raw/master/10m_cultural/ne_10m_populated_places_simple'
NATURAL_EARTH_DATA_URL_STATES = 'https://github.com/nvkelso/natural-earth-vector/raw/master/10m_cultural/ne_10m_admin_1_states_provinces_lines'
NATURAL_EARTH_DATA_WORK_DIR = 'data/tests/temp'
TEST = True
iomapapps.process_data.COUNT_FILES_TOTAL: int
iomapapps.process_data.process_awc_weather_data_airsigmet() None

Download and prepare the AWC AIRMET/SIGMET data.

iomapapps.process_data.process_awc_weather_data_metar() None

Download and prepare the AWC METAR data.

iomapapps.process_data.process_awc_weather_data_station() None

Download and prepare the AWC station data.

iomapapps.process_data.process_awc_weather_data_taf() None

Download and prepare the AWC TAF data.

iomapapps.process_data.process_faa_dds_sua_data() None

Download and prepare the FAA DDS SUA data.

iomapapps.process_data.process_faa_nasr_data() None

Download and prepare the FAA Class Airspace data.

iomapapps.process_data.process_faa_tfr_data() None

Download and prepare the FAA TFR data.

iomapapps.process_data.process_natural_earth_data() None

Download and prepare the Natural Earth data.

iomapapps.s3_proxy module

Provides a Flask application that serves as a proxy to AWS S3.

The application generates presigned URLs for accessing private S3 resources. It utilizes Boto3 for interactions with AWS S3 and Flask for handling web requests.

iomapapps.s3_proxy.create_presigned_url(object_name: str, expiration_sec: int = 10) str | None

Generate a presigned URL to a specific object in an S3 bucket.

Args:

object_name (str): The name of the object for which to create the presigned URL. expiration_sec (int): Time in seconds for the presigned URL to expire

(default is 10 seconds).

Returns:

Optional[str]: A presigned URL as a string if successful, None otherwise.

iomapapps.s3_proxy.proxy(resource_path: str) Response

Redirects the request to a presigned S3 URL based on the specified resource path.

Args:

resource_path (str): The path to the resource in the S3 bucket, forming part

of the object name.

Returns:

Response: A Flask response that redirects to the presigned URL or returns a 404 error

if unsuccessful.

iomapapps.utils module

Miscellaneous helper functions.

iomapapps.utils.generate_circle_with_nautical_miles(center: tuple[float, float], radius_nmi: float, num_points: int = 100) Polygon

Generate a polygon that approximates a circle.

Generate a polygon that approximates a circle around a center point with a radius in nautical miles.

Args:

center (tuple): A tuple representing the latitude and longitude of the center. radius_nmi (float): The radius of the circle in nautical miles. num_points (int): The number of vertices in the polygon approximating the circle.

Returns:

geojson.Polygon: A GeoJSON polygon approximating the circle.

iomapapps.utils.get_app_about(app_id: str) str

Present the ‘about’ information for a given application ID.

Args:

app_id (str): The identifier of the application.

Returns:

str: A formatted string containing the ‘about information’ for the specified application.

iomapapps.utils.get_app_user_guide(app_id: str, page_id: str) str

Display the user guide for a specified application and page.

Args:

app_id (str): The identifier of the application. page_id (str): The identifier of the specific page within the application.

Returns:

str: A formatted string containing the user guide for the specified application and page.

iomapapps.utils.get_config_param(param_name: str) int | str

Retrieve a specified configuration parameter from the application’s settings.

This function utilizes pattern matching to fetch and validate configuration parameters based on their expected data types. If the retrieved parameter does not match the expected type, or if the parameter name is unrecognized, the function logs a fatal error and terminates the application.

Parameters:

param_name (str) – The name of the configuration parameter to be retrieved.

Returns:

The value of the requested configuration parameter, assuming it exists and matches the expected type.

Return type:

int | str

Raises:
  • SystemExit – If the parameter does not exist, does not match the expected type,: or if any other error occurs during the retrieval process. Before terminating, the function logs the specific error encountered.

  • Note:

  • The function ensures type safety by explicitly checking the type of each configuration

  • parameter against its expected type. This behavior prevents type-related errors

  • downstream and enforces stricter data integrity.

Module contents

IO-MAP-APPS.