SDO provides near-real-time (NRT) images that are updated every 15 minutes. They are designed for Space Weather operators and citizen scientists. You can examine the images on the SDO website or download them for use elsewhere. The best way to regularly download our latest NRT images is a script using either a wget or curl command. Once a script tailored to your needs has been developed it can be invoked automatically as a cron job.
The best method to download our NRT images is to use the wget utility.
Best practice would be to retrieve a new images once every fifteen minutes.
*/15 * * * * bash /path/to/script > /path/to/output 2>&1 &
Our latest images are located in the /assets/inmg/latest directory and have a common naming convention as see below. There are four resolutions available and 15 images.
URL: https://sdo.gsfc.nasa.gov/assets/img/latest/latest_[ resolution ]_[ wavelength ].jpg
Resolutions: [ 4096, 2048, 1024, 512 ]
Wavelengths: [ 0094, 0193, 0171, 0304, 0211, 0131, 0335, 1600, 1700, hmib, hmii, hmibc, hmiic, hmiif, hmid ]
#!/bin/sh LATEST_URL=https://sdo.gsfc.nasa.gov/assets/img/latest WAVELENGTHS=( 0094 0131 0171 0193 0211 0304 0335 1600 1700 HMIB HMII HMID HMIBC HMIIF HMIIC ) RESOLUTIONS=( 2048 1024 512 ) for WAVE in ${WAVELENGTHS[@]} do FILENAME="latest_4096_"$WAVE".jpg" #wget command wget --quiet --tries=1 $LATEST_URL/$FILENAME --output-document=/PATH/TO/$FILENAME for RES in ${RESOLUTIONS[@]} do convert -resize $RESx$RES /PATH/TO/$FILENAME "/PATH/TO/latest_"$RES"_"$WAVE".jpg" done done
The browse directories are the drilldown directories deliniated by date. These images also have a common naming convention consisting of date/time stamp, resolution, and instrument or wavelength.
We publish times files consisting of the latest timestamps. Best practice would be to get the approriate times file, parse the timestamp and use that to build your wget command. See the example below.
#!/bin/sh WAVE=$1 SDOURL=https://sdo.gsfc.nasa.gov SDOTIMES=$SDOURL"/assets/img/latest/times"$WAVE".txt" BROWSEDIR=$SDOURL"/assets/img/browse" LOCALDIR=/PATH/TO/LOCAL/DIRECTORY RESOLUTIONS=( 2048 1024 512 ) wget $SDOTIMES --output-document=$LOCALDIR"/times"$WAVE".txt" if [[ -s $LOCALDIR"/times"$WAVE".txt" ]] then TIMEFILE=$LOCALDIR"/times"$WAVE".txt" LASTTIMEFILE=$LOCALDIR"/lasttimes"$WAVE".txt" ONELINE=`awk 'NR==1' "$TIMEFILE"` LASTONELINE=`awk 'NR==1' "$LASTTIMEFILE"` DATETIME=${ONELINE:6:15} LASTDATETIME=${LASTONELINE:6:15} if [[ $DATETIME != $LASTDATETIME ]] then DATETIMEPATH=${DATETIME:0:4}"/"${DATETIME:4:2}"/"${DATETIME:6:2} FILE4k=${DATETIME:0:8}"_"${DATETIME:9:6}"_4096_"$WAVE".jpg" FILE2048=${DATETIME:0:8}"_"${DATETIME:9:6}"_2048_"$WAVE".jpg" FILE1024=${DATETIME:0:8}"_"${DATETIME:9:6}"_1024_"$WAVE".jpg" FILE512=${DATETIME:0:8}"_"${DATETIME:9:6}"_512_"$WAVE".jpg" wget $BROWSEDIR/$DATETIMEPATH/$FILE4k --output-document=$LOCALDIR/$FILE4k for RES in ${RESOLUTIONS[@]} do file="FILE"$RES convert -resize $RESx$RES $LOCALDIR/$FILE4k $LOCALDIR"/"${!file} done cp $TIMEFILE $LASTTIMEFILE else echo times file has not changed fi else echo Times file is empty fi