Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update source for F10.7 in updateRamIndices.py which moved from FTP server to HTTPS #118

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions Scripts/updateRamIndices.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import ftplib
import io
import re
from urllib import request
import numpy as np


Expand Down Expand Up @@ -47,15 +48,10 @@ def floatkp(kpstring):
outJDs = [startjd + n + 0.5 for n in range(int(endjd-startjd))]
outdates = [lastdate+dt.timedelta(days=n+1) for n in range(int(endjd-startjd))]

# download updated F10.7 from ftp://ftp.geolab.nrcan.gc.ca/data/solar_flux/daily_flux_values/fluxtable.txt
# download updated F10.7 from http://spaceweather.gc.ca/solar_flux_data/daily_flux_values/fluxtable.txt
# only has data from 2004-10-28 (prior data are in different files)
io_store = io.StringIO()
ftp = ftplib.FTP('ftp.seismo.nrcan.gc.ca')
ftp.login()
ftp.cwd('spaceweather/solar_flux/daily_flux_values')
ftp.retrlines('RETR {0}'.format('fluxtable.txt'), io_store.write)
io_store.seek(0)
conts = io_store.read()
f107url = 'http://spaceweather.gc.ca/solar_flux_data/daily_flux_values/fluxtable.txt'
conts = request.urlopen(f107url).read().decode()

# get first line of data (needs regex as no linebreaks & odd spacing
# then split up, read dates, interpolate to requested JDs
Expand Down
Loading
Loading