### Install PPIGRF from source Source: https://pypi.org/project/ppigrf/2.1.0 Clone the repository and install the PPIGRF library by running the setup script. ```bash python setup.py install ``` -------------------------------- ### Install PPIGRF using pip Source: https://pypi.org/project/ppigrf/2.1.0 Install the PPIGRF library using pip. Ensure Numpy and Pandas are installed as dependencies. ```bash pip install ppigrf ``` -------------------------------- ### Install pytest Source: https://pypi.org/project/ppigrf/2.1.0 Install the pytest testing framework using pip. This is a prerequisite for running the tests. ```bash pip install pytest ``` -------------------------------- ### Import PPIGRF library Source: https://pypi.org/project/ppigrf/2.1.0 Import the PPIGRF library into your Python project after installation. ```python import ppigrf ``` -------------------------------- ### Run ppigrf tests Source: https://pypi.org/project/ppigrf/2.1.0 Execute the installed ppigrf package's tests using the pytest command. The -v flag provides verbose output. ```bash pytest -v ``` -------------------------------- ### Import PPIGRF library Source: https://pypi.org/project/ppigrf Import the PPIGRF library into your Python project. ```python import ppigrf ``` -------------------------------- ### Calculate IGRF on a Grid with Multiple Dates Source: https://pypi.org/project/ppigrf/2.1.0 Calculate IGRF values on a grid using multiple longitude and latitude points, and a list of dates. The output shape will broadcast according to the input coordinate shapes and the number of dates. Requires NumPy for array creation. ```python import numpy as np from datetime import datetime lon = np.array([20, 120, 220]) lat = np.array([[60, 60, 60], [-60, -60, -60]]) h = 0 dates = [datetime(y, 1, 1) for y in np.arange(1960, 2021, 20)] Be, Bn, Bu = ppigrf.igrf(lon, lat, h, dates) ``` -------------------------------- ### Calculate IGRF with Geodetic Coordinates Source: https://pypi.org/project/ppigrf/2.1.0 Calculate the Earth's magnetic field components (east, north, up) using geodetic coordinates and a specific date. Ensure the `datetime` object is imported. ```python from datetime import datetime lon = 5.32415 # degrees east lat = 60.39299 # degrees north h = 0 # kilometers above sea level date = datetime(2021, 3, 28) Be, Bn, Bu = ppigrf.igrf(lon, lat, h, date) # returns east, north, up ``` -------------------------------- ### Calculate IGRF with geodetic coordinates Source: https://pypi.org/project/ppigrf Calculate IGRF model values using geodetic coordinates (longitude, latitude, height) and a datetime object. Returns east, north, and up components. ```python from datetime import datetime lon = 5.32415 # degrees east lat = 60.39299 # degrees north h = 0 # kilometers above sea level date = datetime(2021, 3, 28) Be, Bn, Bu = ppigrf.igrf(lon, lat, h, date) # returns east, north, up ``` -------------------------------- ### Calculate IGRF with geocentric coordinates Source: https://pypi.org/project/ppigrf Calculate IGRF model values using geocentric coordinates (radius, colatitude, longitude) and a datetime object. Returns radial, south, and east components. ```python r = 6500 # kilometers from center of Earht theta = 30 # colatitude in degrees phi = 4 # degrees east (same as lon) Br, Btheta, Bphi = ppigrf.igrf_gc(r, theta, phi, date) # returns radial, south, east ``` -------------------------------- ### Calculate IGRF with Geocentric Coordinates Source: https://pypi.org/project/ppigrf/2.1.0 Calculate the Earth's magnetic field components (radial, south, east) using geocentric coordinates and a specific date. Ensure the `datetime` object is imported. ```python r = 6500 # kilometers from center of Earht theta = 30 # colatitude in degrees phi = 4 # degrees east (same as lon) Br, Btheta, Bphi = ppigrf.igrf_gc(r, theta, phi, date) # returns radial, south, east ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.