Code Monkey home page Code Monkey logo

solarmach's Introduction

solarmach

pypi Version conda version license python version

The Solar MAgnetic Connection Haus (Solar-MACH) tool is a multi-spacecraft longitudinal configuration plotter. This is the repository of the pip/conda package of Solar-MACH, called solarmach. For the corresponding streamlit repository, which is used for solar-mach.github.io, see github.com/jgieseler/Solar-MACH.

Installation

solarmach requires python >= 3.6.

It can be installed either from PyPI using:

pip install solarmach

or from conda using:

conda install -c conda-forge solarmach

Usage

from solarmach import SolarMACH, print_body_list

# optional: get list of available bodies/spacecraft
print(print_body_list().index)

# necessary:
body_list = ['STEREO-A', 'Earth', 'BepiColombo', 'PSP', 'Solar Orbiter', 'Mars']
vsw_list = [400, 400, 400, 400, 400, 400, 400]
date = '2021-10-28 15:15:00'

# optional:
reference_long = 273                             # Carrington longitude of reference (None to omit)
reference_lat = 0                                # Carrington latitude of reference (None to omit)
plot_spirals = True                              # plot Parker spirals for each body
plot_sun_body_line = True                        # plot straight line between Sun and body
show_earth_centered_coord = False                # display Earth-aligned coordinate system
reference_vsw = 400                              # define solar wind speed at reference
transparent = False                              # make output figure background transparent
numbered_markers = True                          # plot each body with a numbered marker
filename = 'Solar-MACH_'+date.replace(' ', '_')  # define filename of output figure

# optional
# if input coordinates for reference are Stonyhurst, convert them to Carrington for further use
import astropy.units as u
from astropy.coordinates import SkyCoord
from sunpy.coordinates import frames
reference_long = 2                               # Stonyhurst longitude of reference (None to omit)
reference_lat = 26                               # Stonyhurst latitude of reference (None to omit)
coord = SkyCoord(reference_long*u.deg, reference_lat*u.deg, frame=frames.HeliographicStonyhurst, obstime=date)
coord = coord.transform_to(frames.HeliographicCarrington(observer='Sun'))
reference_long = coord.lon.value                 # Carrington longitude of reference
reference_lat = coord.lat.value                  # Carrington latitude of reference

# initialize
sm = SolarMACH(date, body_list, vsw_list, reference_long, reference_lat)

# make plot
sm.plot(
   plot_spirals=plot_spirals,
   plot_sun_body_line=plot_sun_body_line,
   show_earth_centered_coord=show_earth_centered_coord,
   reference_vsw=reference_vsw,
   transparent=transparent,
   numbered_markers=numbered_markers,
   outfile=filename+'.png'
)

# obtain data as Pandas DataFrame
display(sm.coord_table)

Example output figure

Example Notebook

solarmach can easily be run in a Jupyter Notebook.

Acknowledgements

The Solar-MACH tool was originally developed at Kiel University, Germany and further discussed within the ESA Heliophysics Archives USer (HAUS) group (original code).

Powered by: matplotlib sunpy

solarmach's People

Contributors

jgieseler avatar nakadie avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.