import time from pycallisto import fitsfile from urldl import download callisto_archives = "http://soleil80.cs.technik.fhnw.ch/" \ "solarradio/data/2002-20yy_Callisto/" date_xpath = "2011/08/09/" filename = "BLEN7M_20110809_083004_24.fit.gz" start = time.time() download(callisto_archives + date_xpath + filename) fitsfile.ECallistoFitsFile.plot_fits_files_list([filename]) print("Executed in {:.2f} seconds".format(time.time() - start))
from urldl import download from pycallisto import chromosphericevaporation as ce import json callisto_archives = 'http://soleil80.cs.technik.fhnw.ch/' \ 'solarradio/data/2002-20yy_Callisto/' filename = "ROSWELL-NM_20140329_174500_59.fit.gz" fits_year = filename.split('_')[1][:4] fits_month = filename.split('_')[1][4:6] fits_day = filename.split('_')[1][-2:] fits_url = f'{callisto_archives}/{fits_year}/{fits_month}/' \ f'{fits_day}/{filename}' download(fits_url) ce_fits = ce.ChromosphericEvaporationFitsFile(filename) ce_fits.plot_db_above_background(True) ce_fits.set_fits_linear_regression() ce_fits.set_fits_linear_regression_function() inf_time = 17.7805 sup_time = 17.8065 ce_fits.set_front_velocity(inf_time, sup_time) with open("front-info.txt", "w") as f: f.write(json.dumps(ce_fits.get_front())) f.write("\n")
dirs = [] noaa_url = "ftp.ngdc.noaa.gov" daily_reports_dir = "STP/swpc_products/daily_reports" ftp = ftplib.FTP(noaa_url) ftp.login() ftp.cwd(daily_reports_dir) reports = ftp.nlst() for directory in reports: try: ftp.cwd("/".join([directory, "2011", "02"])) files = ftp.nlst() for filename in files: if "0216" in filename: file_url = "ftp://" + noaa_url + "/".join([ftp.pwd(), filename]) download(file_url, directory) ftp.cwd("../../../") except ftplib.error_perm: pass ftp.cwd("/".join([directory, "docs"])) doc_files = ftp.nlst() for doc in doc_files: doc_url = "ftp://" + noaa_url + "/".join([ftp.pwd(), doc]) download(doc_url, path.join(directory, "docs")) ftp.cwd("../../") ftp.quit()