import sunkit_instruments.suvi import sunpy.map from glob import glob import os import matplotlib.pyplot as plt import numpy as np import time import sys from datetime import datetime # You will need a system with ImageMagick, bzip2 (may come with distro) & Python 3 (with SunPy, sunkit-instruments and Matplotlib) installed. I strongly recommend using a Conda environment for Python! This script is only set up to run under Linux. escape = '\\' Dat = sys.argv[1] Yea=Dat[:4] Mon=Dat[4:6] Day=Dat[6:8] Hou=Dat[8:10] Min=Dat[10:] time_slot = datetime(int(Yea), int(Mon), int(Day), int(Hou), int(Min)) Slo = time_slot.strftime("%Y%j%H%M") txtm = time_slot.strftime("%Y%m%d%H%M") # You only need to change the following three lines to point to your appropriate directories. The input data is assumed bulk ie how TelliCast delivers it, and the images of both bands will be deposited in the output directory. # Make sure folders do not have a trailing slash! tmpdir = '>' datadir = '' outdir = '' tmpfiles = tmpdir+'/*.nc*' senslist = ["Fe195", "He303"] half = 'A' def get_files(): if half == 'A': hmin = '0-4' else: hmin = '5-9' filenames_comp = datadir+'/OR_SUVI-L1b-'+Sens+'_G16_s'+Slo+'['+hmin+']*.nc.bz2' os.chdir(tmpdir) os.system('rm -f '+tmpdir+'/*.nc*') #time.sleep(1) os.system('cp '+filenames_comp+' '+tmpdir) #time.sleep(5) os.system('bzip2 -d '+tmpfiles) #time.sleep(1) def get_image(): smap = sunkit_instruments.suvi.files_to_map(filenames, only_long_exposures=True) figure = plt.figure(frameon=False,figsize=(1.280, 1.280), dpi=100) ax = plt.axes([0, 0, 1, 1]) ax.set_axis_off() norm = smap.plot_settings['norm'] norm.vmin, norm.vmax = np.percentile(smap.data, [1, 99.9]) ax.imshow(smap.data, norm=norm, cmap=smap.plot_settings['cmap'], origin="lower") plt.savefig('GOES16_SUVI_'+Sens+'_'+txtm+'_tmp.png', dpi=1000) for Sens in senslist: try: get_files() filenames = glob(tmpdir + '/*.nc') try: get_image() except: half = 'B' get_files() filenames = glob(tmpdir = '/*.nc') get_image() infile = 'GOES16_SUVI_'+Sens+'_'+txtm+'_tmp.png' outfile = outdir+'/GOES16_SUVI_'+Sens+'_'+txtm+'.png' legdraw = '-draw \"fill white text +5,3 \'GOES-16 SUVI data © NOAA - source data via EUMETCast on Eutelsat 10B '+Yea+'/'+Mon+'/'+Day+' '+Hou+':'+Min+'Z Band: '+Sens+' \'\"' magick = 'convert '+infile+' -gravity south -background rgb'+escape+'(0,0,0'+escape+') -splice 0x23 -pointsize 15 -gravity south -font Noto-Sans-Regular '+legdraw+' '+outfile os.system(magick) os.system('rm -f '+tmpdir+'/'+infile) except: pass