Sunpy uses sunpyrc configuration files to customize certain properties. You can control a number of key features of SunPy such as where your data will download to. SunPy looks for sunpyrc in two locations, in the following order:
To display where the currently active sunpyrc file was loaded from, one can do the following:
>>> import sunpy
>>> sunpy.print_config()
The default sunpyrc file lives in sunpy/data/. We recommend that you make a copy of this file and put it where Sunpy will find it. See below for the example config file.
You can also dynamically change the default settings in a python script or interactively from the python shell. All of the settings are stored in a Python ConfigParser instance called sunpy.config, which is global to the sunpy package. Settings can be modified directly, for example:
import sunpy
sunpy.config.set('downloads', 'download_dir', '/home/user/Downloads')
;
; SunPy Configuration
;
; This is a sample sunpy configuration file - you can find a copy
; of it on your system in site-packages/sunpy/data/sunpyrc. If you edit it
; there, please note that it will be overridden in your next install.
; If you want to keep a permanent local copy that will not be
; over-written, place it in HOME/.sunpy/sunpyrc (unix/linux
; like systems) and C:\Documents and Settings\yourname\.sunpy
; (win32 systems).
;
; Note that any relative filepaths specified in the SunPy configuration file
; will be relative to SunPy's working directory.
;
;;;;;;;;;;;;;;;;;;;
; General Options ;
;;;;;;;;;;;;;;;;;;;
[general]
; The SunPy working directory is the parent directory where all generated
; and download files will be stored.
; Default Value: <user's home directory>/sunpy
; working_dir = /home/$USER/sunpy
;;;;;;;;;;;;;
; Downloads ;
;;;;;;;;;;;;;
[downloads]
; Location to save download data to. Path should be specified relative to the
; SunPy working directory.
; Default value: data/
;download_dir = /tmp
download_dir = data