geomodels.data module

Tools for geographic models data download and installation.

class geomodels.data.EArchiveType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumerate the archive type.

BZ2 = '.tar.bz2'
ZIP = '.zip'
class geomodels.data.EGeoidModel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumerate geoid models.

EGM2008_1 = 'egm2008-1'
EGM2008_2_5 = 'egm2008-2_5'
EGM2008_5 = 'egm2008-5'
EGM84_15 = 'egm84-15'
EGM84_30 = 'egm84-30'
EGM96_15 = 'egm96-15'
EGM96_5 = 'egm96-5'
static get_model_type() EModelType[source]

Return the model type corresponding to the enumeration.

class geomodels.data.EGravityModel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumerate gravity models.

EGM2008 = 'egm2008'
EGM84 = 'egm84'
EGM96 = 'egm96'
GRS80 = 'grs80'
WGS84 = 'wgs84'
static get_model_type() EModelType[source]

Return the model type corresponding to the enumeration.

class geomodels.data.EMagneticModel(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumerate magnetic field models.

EMM2010 = 'emm2010'
EMM2015 = 'emm2015'
EMM2017 = 'emm2017'
IGRF11 = 'igrf11'
IGRF12 = 'igrf12'
IGRF13 = 'igrf13'
IGRF14 = 'igrf14'
WMM2010 = 'wmm2010'
WMM2015 = 'wmm2015'
WMM2015V2 = 'wmm2015v2'
WMM2020 = 'wmm2020'
WMM2025 = 'wmm2025'
WMMHR2025 = 'wmmhr2025'
static get_model_type() EModelType[source]

Return the model type corresponding to the enumeration.

class geomodels.data.EModelGroup(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Model groups.

ALL = 'all'
MINIMAL = 'minimal'
RECOMMENDED = 'recommended'
class geomodels.data.EModelType(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

Enumerate geographic model types.

GEOID = 'geoids'
GRAVITY = 'gravity'
MAGNETIC = 'magnetic'
geomodels.data.get_default_data_path() str[source]

Return the default data path.

The GEOGRAPHICLIB_DATA environment variable is used if available to locate the location where the geographic model data are installed.

If GEOGRAPHICLIB_DATA is not set, then then it is returned the path configured at build time.

geomodels.data.get_model_url(model: EGeoidModel | EGravityModel | EMagneticModel, base_url: str | None = None, archive_type: EArchiveType = EArchiveType.BZ2) str[source]

Return the download URL for the specified geographic model.

Parameters:
  • model – the enumeration corresponding to the desired geographic model. It can be one of the enumerates defined in EGeoidModel, EGravityModel or EMagneticModel.

  • base_url (str) – (optional) base URL for data download. The full URL is build from this function starting from base_url and model information.

  • archive_type (EArchiveType) – specifies the archive type that should be downloaded. Default: data:`EArchiveType.BZ2.

geomodels.data.install(model: EModelGroup | EModelType | EGeoidModel | EGravityModel | EMagneticModel = EModelGroup.MINIMAL, datadir: str | PathLike[str] | None = None, base_url: str | None = None, archive_type: EArchiveType = EArchiveType.BZ2, progress: bool = True)[source]

Install the specified geographic model data.

Parameters:
  • model – the enumeration corresponding to the desired geographic model. It can be one of the enumerates defined in EGeoidModel, EGravityModel, EMagneticModel, or one of the enumerates defined in EModelType to indicate that all geographic models of the specified type shall be installed, or one of the enumerates defined in EModelGroup to indicate that a specific group of model data shall be installed: EModelGroup.ALL (all available models of any kind), EModelGroup.MINIMAL (only the default model for each type) or EModelGroup.RECOMMENDED.

  • datadir (PathType) – (optional) specify the target location where geographic model data shall be installed. If not specified that the path returned by get_default_data_path() is assumed.

  • base_url (str) – (optional) base URL for data download. The full URL is built from this function starting from base_url and model information.

  • archive_type (EArchiveType) – specifies the archive type that should be downloaded. Default: EArchiveType.BZ2.

  • progress (bool) – enable/disable progress information display (default: True)