Skip to content

Commit

Permalink
Changes for version 0.2.0
Browse files Browse the repository at this point in the history
- Changes in README.md
- Clean up the requirements
- Removes app footer
- Changes in css style
- Upgrade beta_columns
  • Loading branch information
AthKouloumvakos committed Oct 20, 2021
1 parent 17baa7b commit 19d91d9
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 56 deletions.
29 changes: 18 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,37 @@
# Space Weather Monitor Application (SWMA)

An open-source app framework built specifically for visualizing realtime space weather related data.
An open-source app framework built specifically for visualizing realtime space weather related data. An online preview of this tool is available at [https://athkouloumvakos.github.io/swma](https://athkouloumvakos.github.io/swma) .

## Installation

To run localy this application you have to create a virtual enviroment in python, install the required python packages, and then run the application with streamlit. The package requirements are listed in the requirements.txt. So in your terminal:

```python
# Create a virtual environment in python
# see https://docs.python.org/3/library/venv.html
# You can create a virtual environment in Python inside the project folder.
# see https://docs.python.org/3/library/venv.html
python3 -m venv env

# Activate the enviroment
source env/bin/activate

# install the required packages using pip3
pip3 install -r requirements.txt

# Now run the the application from streamlit
streamlit run app.py

# You can deactivate a virtual environment by
# typing “deactivate” in your shell.
# When you are done you can deactivate a virtual environment
deactivate
```
The application should now open in the default browser!

## Run localy the SWMA application

After installing the required Python packages and activating the enviroment as shown above, run the application with streamlit.
```python
# In the terminal:
streamlit run swma.py
```

The application should open in the default browser.

## Availiable realtime monitors 🖵:

- Soft x-ray flux (NOAA-GOES)
Expand All @@ -39,11 +46,11 @@ The application should now open in the default browser!

**Proton flux (NOAA-GOES)**: Visualize real-time measurements of **proton flux** from GOES satelites. The proton flux data are provided from the NOAA Solar Weather Prediction Center (SWPC) in JSON format and are updated every 1-minute.

**Solar Events Forecast (NOAA)**: Visualize near-real-time measurements of forecasts of the likelihood (probability) of the occurrence of a solar event. the flare and the solar proton event foracast data are provided from the NOAA Solar Weather Prediction Center (SWPC) in JSON format and are updated daily. The flare forecasts are daily probabilistic forecasts, ranging from 1% to 99%, of the likelihood of a given class x-ray flare to occur within a time interval.
**Solar Events Forecast (NOAA)**: Visualize near-real-time **forecasts** of the likelihood (probability) of the occurrence of a solar event. the flare and the solar proton event foracast data are provided from the NOAA Solar Weather Prediction Center (SWPC) in JSON format and are updated daily. The flare forecasts are daily probabilistic forecasts, ranging from 1% to 99%, of the likelihood of a given class x-ray flare to occur within a time interval.

**EUV Images (SDO/AIA)**: Show near-real-time images of the solar chromosphere and corona from observations of the Atmospheric Imaging Assembly (AIA) on board the Solar Dynamics Observatory (SDO) in extreme ultraviolet (EUV). SDO is a NASA mission which has been observing the Sun since 2010. The AIA provides continuous near-real-time observations of the solar chromosphere and corona in seven channels in EUV. The near-real-time EUV images are provided from NASA/SDO in .png format.
**EUV Images (SDO/AIA)**: Show near-real-time images of the solar chromosphere and corona from observations of the Atmospheric Imaging Assembly (AIA) on board the Solar Dynamics Observatory (SDO) in extreme ultraviolet (EUV). SDO is a NASA mission which has been observing the Sun since 2010. The AIA provides continuous near-real-time observations of the solar chromosphere and corona in seven channels in EUV. The images are provided from NASA/SDO in .png format.

**Coronagraphic Images (SoHO/LASCO)**: Show near-real-time images of the solar corona in white light from observations of the Large Angle and Spectrometric Coronagraph (LASCO) on board the Solar and Heliospheric Observatory satellite (SoHO). The near-real-time coronagraphic images are provided from NASA/nascom in .jpg format.
**Coronagraphic Images (SoHO/LASCO)**: Show near-real-time images of the solar corona in white light from observations of the Large Angle and Spectrometric Coronagraph (LASCO) on board the Solar and Heliospheric Observatory satellite (SoHO). The coronagraphic images are provided from NASA/nascom in .jpg format.

## Usefull python packages 📦:
Expand Down
Binary file removed buy_me_a_coffee.png
Binary file not shown.
18 changes: 3 additions & 15 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
numpy
pandas
astropy
astroquery
sunpy
matplotlib
numpy
pandas
streamlit
wget
requests
reproject
colorama
beautifulsoup4
Pillow
lxml
zeep
drms
tqdm

sunpy
30 changes: 4 additions & 26 deletions swma.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def current_conditions():
import json
from pandas import json_normalize
st.sidebar.markdown("""---""")
st.sidebar.markdown("""## Current Space Weather Conditions ☂: """)
st.sidebar.markdown("""## Space Weather Conditions ☂: """)

with urllib.request.urlopen('https://services.swpc.noaa.gov/json/goes/primary/xray-flares-latest.json') as fp:
data = json.loads(fp.read().decode())
Expand Down Expand Up @@ -166,21 +166,21 @@ def run():
#MainMenu {visibility: hidden;}
footer {visibility: hidden;}
</style> """, unsafe_allow_html=True)

# Do some css styling tricks here (e.g. remove the padding)
# https://medium.com/ssense-tech/streamlit-tips-tricks-and-hacks-for-data-scientists-d928414e0c16
padding = 1
st.markdown(f""" <style>
.reportview-container .main .block-container{{
padding-top: {padding}rem;
margin-top: -1.5rem;
margin-top: -3.0rem;
max-width: 50rem;
padding-right: {padding}rem;
padding-left: {padding}rem;
padding-bottom: {padding}rem;
}} </style> """, unsafe_allow_html=True)
st.markdown(f""" <style>
.reportview-container .css-1lcbmhc .block-container{{
margin-top: -1.0rem;
margin-top: -3.0rem;
}} </style> """, unsafe_allow_html=True)
# Reduce the space in horizontal component
st.markdown(f""" <style>
Expand Down Expand Up @@ -213,27 +213,5 @@ def run():

current_conditions()

# Make the footer
footer="""<style>
.footer {
position: fixed;
bottom: 0;
max-width: 100%;
height: auto;
background-color: white;
color: black;
text-align: center;
}
</style>
<div class="footer">
<a href="https://www.buymeacoffee.com/akouloumvako">
<img src='data:image/png;base64,""" + """{}' class='img-fluid' width=300 height=45>
<a/>
</div>
""".format(
img_to_bytes("buy_me_a_coffee.png")
)
st.sidebar.markdown(footer,unsafe_allow_html=True)

if __name__ == "__main__":
run()
8 changes: 4 additions & 4 deletions tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def aia_realtime():
pfss = 'pfss'
else:
pfss = ''
left_column, right_column = st.beta_columns(2)
left_column, right_column = st.columns(2)
image = Image.open(
requests.get('https://sdo.gsfc.nasa.gov/'
'assets/img/latest/f_211_193_171pfss_1024.jpg',
Expand All @@ -210,7 +210,7 @@ def aia_realtime():
)
right_column.image(image, caption='')

one_, two_, three_, four_ = st.beta_columns(4)
one_, two_, three_, four_ = st.columns(4)
image = Image.open(
requests.get('https://sdo.gsfc.nasa.gov/'
f'assets/img/latest/latest_1024_0171{pfss}.jpg',
Expand All @@ -236,7 +236,7 @@ def aia_realtime():
)
four_.image(image, caption='')

one_, two_, three_, four_ = st.beta_columns(4)
one_, two_, three_, four_ = st.columns(4)
image = Image.open(
requests.get('https://sdo.gsfc.nasa.gov/'
f'assets/img/latest/latest_1024_0094{pfss}.jpg',
Expand Down Expand Up @@ -289,7 +289,7 @@ def lasco_realtime():
"""
View real-time coronagraphic images from SoHO/LASCO.
"""
left_column, right_column = st.beta_columns(2)
left_column, right_column = st.columns(2)
image = Image.open(
requests.get('https://sohowww.nascom.nasa.gov/'
'data/realtime/c2/1024/latest.jpg',
Expand Down

0 comments on commit 19d91d9

Please sign in to comment.