1+ # maggeo/__init__.py
2+ """
3+ MagGeo: Data fusion library for annotating GPS trajectories with geomagnetic satellite data from Swarm mission from ESA.
4+ Authors: Fernando Benitez-Paez, Urška Demšar, Jed Long, Ciaran Beggan
5+
6+ This package materialise a data fusion method to annotate GPS trajectories with geomagnetic data from the Swarm satellite mission.
7+ It includes functions for data retrieval, processing, and annotation, as well as debugging utilities.
8+ For more information, please refer to the paper:
9+
10+ Benitez-Paez, F., Brum-Bastos, V.d., Beggan, C.D. et al.
11+ Fusion of wildlife tracking and satellite geomagnetic data for the study of animal migration.
12+ Mov Ecol 9, 31 (2021). https://doi.org/10.1186/s40462-021-00268-4
13+
14+ """
15+
16+ __version__ = "0.2.0"
17+ __author__ = "Fernando Benitez-Paez, Urška Demšar, Jed Long, Ciaran Beggan"
18+ __email__ = "Fernando.Benitez@st-andrews.ac.uk"
19+
20+ # Lazy imports to avoid immediate dependency loading
21+ def get_main_function ():
22+ """Get the main annotation function with lazy import."""
23+ try :
24+ from .core import annotate_gps_with_geomag
25+ return annotate_gps_with_geomag
26+ except ImportError as e :
27+ raise ImportError (f"Could not import core functionality. Please ensure all dependencies are installed: { e } " )
28+
29+ # Only expose main function, date utilities, indices, parallel functions, and swarm data manager to avoid import issues
30+ __all__ = ['annotate_gps_with_geomag' , 'identify_unique_dates' , 'get_ae_index' , 'get_sme_index' , 'merge_indices_with_maggeo' ,
31+ 'SwarmDataManager' , 'download_swarm_data_for_trajectory' , 'load_swarm_data' ,
32+ 'parallel_row_handler' , 'parallel_st_idw_process' , 'parallel_chaos_ground_values' , '__version__' ]
33+
34+ # Make main function, date utilities, indices, parallel functions, and swarm data manager available
35+ try :
36+ from .core import annotate_gps_with_geomag
37+ from .date_utils import identify_unique_dates
38+ from .parallel_processing import parallel_row_handler
39+ from .interpolation import parallel_st_idw_process
40+ from .chaos import parallel_chaos_ground_values
41+ from .indices import get_ae_index , get_sme_index , merge_indices_with_maggeo
42+ from .swarm_data_manager import SwarmDataManager , download_swarm_data_for_trajectory , load_swarm_data
43+ except ImportError :
44+ # Provide informative error message
45+ def annotate_gps_with_geomag (* args , ** kwargs ):
46+ raise ImportError (
47+ "MagGeo core functionality is not available. "
48+ "Please ensure all dependencies are installed:\n "
49+ "pip install viresclient chaosmagpy pandas netCDF jupyterlab \n "
50+ "or install MagGeo with conda using the provided environment.yml"
51+ )
52+
53+ def identify_unique_dates (* args , ** kwargs ):
54+ raise ImportError (
55+ "MagGeo core functionality is not available. "
56+ "Please ensure all dependencies are installed:\n "
57+ "pip install viresclient chaosmagpy pandas netCDF jupyterlab hapiclient \n "
58+ "or install MagGeo with conda using the provided environment.yml"
59+ )
60+
61+ def get_ae_index (* args , ** kwargs ):
62+ raise ImportError (
63+ "MagGeo indices functionality is not available. "
64+ "Please ensure all dependencies are installed:\n "
65+ "pip install hapiclient pandas numpy \n "
66+ "or install MagGeo with conda using the provided environment.yml"
67+ )
68+
69+ def get_sme_index (* args , ** kwargs ):
70+ raise ImportError (
71+ "MagGeo indices functionality is not available. "
72+ "Please ensure all dependencies are installed:\n "
73+ "pip install hapiclient pandas numpy \n "
74+ "or install MagGeo with conda using the provided environment.yml"
75+ )
76+
77+ def merge_indices_with_maggeo (* args , ** kwargs ):
78+ raise ImportError (
79+ "MagGeo indices functionality is not available. "
80+ "Please ensure all dependencies are installed:\n "
81+ "pip install hapiclient pandas numpy \n "
82+ "or install MagGeo with conda using the provided environment.yml"
83+ )
0 commit comments