A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

pyglow

A Python module that wraps several upper atmosphere climatological models written in FORTRAN.
https://github.com/timduly4/pyglow

Category: Atmosphere
Sub Category: Atmospheric Composition and Dynamics

Last synced: about 2 hours ago
JSON representation

Repository metadata

Upper atmosphere climatological models in Python

README.md

Semaphore CI: Build Status

Travis CI: Build Status

(airglow viewed aboard the ISS)

Overview

pyglow is a Python module that wraps several upper atmosphere climatological models written in FORTRAN, such as the Horizontal Wind Model (HWM), the International Geomagnetic Reference Field (IGRF), the International Reference Ionosphere (IRI), and the Mass Spectrometer and Incoherent Scatter Radar (MSIS).

It includes the following upper atmospheric models:

  • HWM 1993
  • HWM 2007
  • HWM 2014
  • IGRF 11
  • IGRF 12
  • IRI 2012
  • IRI 2016
  • MSIS 2000

pyglow also provides access to the the following geophysical indices:

  • AP
  • Kp
  • F10.7
  • DST
  • AE

pyglow offers access to these models & indices in a convenient, high-level object-oriented interface within Python.

Prerequisites

pyglow requires the following packages for installation:

  1. gfortran ($ sudo apt-get install gfortran)
  2. f2py ($ pip install numpy --upgrade)
  3. Python packages listed in requirements.txt ($ pip install -r requirements.txt)

Installation

I'm Feeling Lucky:

First, checkout the repository:

$ git clone git://github.com/timduly4/pyglow.git pyglow

Change directories into the repository folder, compile the f2py bindings, then install the Python package:

$ cd pyglow/
$ make -C src/pyglow/models source
$ python3 setup.py install --user

Troubleshooting

As of Apr 2023, pyglow is far behind on maintenance. A fresh installation is difficult. In case it helps, here are the steps I used to successfully install it:

  • use Python3.8 (pyglow is incompatible with Python3.10)
  • pip install ipykernel jupyter numpy==1.20 scipy matplotlib future charset_normalizer pandas==1.3

A solution to Issue #139 is sorely needed.

Trouble in downloading model files:

If you have problems downloading files from the official websites, follow the next steps:

(1) Create the local http server:

$ cd static/
$ python3 -m http.server 8080

(2) Edit the file src/pyglow/models/Makefile, replace the appropriate line with the following code:

download:
  python get_models_offline.py

(3) Compile the f2py bindings, then install the Python package:

$ cd pyglow/
$ make -C src/pyglow/models source
$ python3 setup.py install --user

Note: The model files may not be latest.

Individual installation steps:

If you have troubles, follow the individual installation steps:

(1) Download the package:

$ git clone git://github.com/timduly4/pyglow.git
$ cd pyglow/

(2) Download the climatological models and wrap them with f2py:

$ cd ./src/pyglow/models/
$ make all
  • If successful, there should be a *.so file in each of the ./models/dl_models/<model>/ directories:

    $ find . -name "*.so"
    ./dl_models/hwm07/hwm07py.so
    ./dl_models/hwm93/hwm93py.so
    ./dl_models/hwm14/hwm14py.so
    ./dl_models/igrf11/igrf11py.so
    ./dl_models/igrf12/igrf12py.so
    ./dl_models/iri12/iri12py.so
    ./dl_models/iri16/iri16py.so
    ./dl_models/msis/msis00py.so
    

(3) Install the Python package

$ cd ../../../   # get back to root directory
$ python3 setup.py install --user
  • On a mac, the folder pyglow and *.so files from ./models/dl_models/<model>/ should be in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages
  • The --user flag installs the package locally (i.e., you do not need sudo access)

Unit tests

See unit tests in ./test. For example, run the unittest suite with:

$ pytest test/

(Be sure that the f2py modules have been compiled via $ make -C src/pyglow/models source, first.)

Examples

See example scripts located in ./examples for example calls to pyglow.

Docker

We've included a Dockerfile for pyglow. To build the image:

$ docker build -t pyglow .

This will compile and install pyglow within the Docker container.

Run the unit tests within the container via:

$ docker run pyglow

Hints

General

  1. Use tab completion in ipython to view the full set of member data and variables available in the Point class.
  • For example, in the test code, run pt.<TAB><TAB> and class information will be listed.

Updating geophysical indices with pyglow.update_indices()

You'll need to download the geophysical indices as they become available. The update_indices() function is available in pyglow that enables you do this:

# Grabs indices between 2016 and 2018:
$ python3 -c "import pyglow; pyglow.update_indices(2016, 2018)"

Note: you only need to run this function when you would like to update the indices.

You can check if you have geophysical indices between dates with:

$ python3 -c "import pyglow;  pyglow.check_stored_indices('2015-01-01', '2019-01-01')"

Checking: input date range:
  2015-01-01
  to
  2019-01-01
>> We have all of the geophysical indices files between these dates.

Uninstallation

The install directory for pyglow can be outputted via python3 -c "import pyglow; print(pyglow.__file__)". For example:

~ $ python3 -c "import pyglow; print(pyglow.__file__)"
/Users/duly/Library/Python/3.7/lib/python/site-packages/pyglow/__init__.pyc

This tells you the installation location, and then you can remove the package with:

~ $ rm -rf /Users/duly/Library/Python/3.7/lib/python/site-packages/pyglow

Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 207
Total Committers: 11
Avg Commits per committer: 18.818
Development Distribution Score (DDS): 0.28

Commits in past year: 5
Committers in past year: 2
Avg Commits per committer in past year: 2.5
Development Distribution Score (DDS) in past year: 0.2

Name Email Commits
Timothy Duly t****4@g****m 149
bharding512 b****2 20
Mark D. Butala b****a@i****u 18
Timothy Duly d****y@T****l 7
fishnchips1624 f****4 6
Esaeleon l****h@g****m 2
Fubin Zhang z****2@g****m 1
Jeff Klenzing j****g@g****m 1
Pablo M. Reyes 3****2 1
RomanValeryevich 5****h 1
ukamaci 3****i 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 95
Total pull requests: 63
Average time to close issues: 6 months
Average time to close pull requests: 3 months
Total issue authors: 45
Total pull request authors: 17
Average comments per issue: 3.35
Average comments per pull request: 1.0
Merged pull request: 53
Bot issues: 0
Bot pull requests: 0

Past year issues: 2
Past year pull requests: 2
Past year average time to close issues: N/A
Past year average time to close pull requests: about 1 month
Past year issue authors: 2
Past year pull request authors: 2
Past year average comments per issue: 2.0
Past year average comments per pull request: 1.5
Past year merged pull request: 0
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/timduly4/pyglow

Top Issue Authors

  • timduly4 (12)
  • bharding512 (12)
  • aburrell (9)
  • panagiotispir (5)
  • samshidler (3)
  • bcurtiswx (3)
  • jklenzing (3)
  • RobertoMantas (3)
  • adoneill03 (2)
  • cahngkong (2)
  • mkmohamed (2)
  • bzossi (2)
  • dinilbose (2)
  • Luca-ggmb (2)
  • sigvaldm (2)

Top Pull Request Authors

  • timduly4 (38)
  • butala (6)
  • aburrell (3)
  • Esaeleon (2)
  • bharding512 (2)
  • georgegeddes (1)
  • zfb132 (1)
  • jklenzing (1)
  • pmreyes2 (1)
  • drhirsch (1)
  • rafaelluizmesquita (1)
  • FasilGibdaw (1)
  • RomanValeryevich (1)
  • htyeim (1)
  • lschreit (1)

Top Issue Labels

Top Pull Request Labels


Dependencies

requirements.txt pypi
  • coverage *
  • future *
  • numpy *
  • pytest *
  • python-dateutil *
Dockerfile docker
  • python 3.6-alpine build

Score: 7.317876198626496