...
Given the above request url we could download all related hmi-meta data which is, however, not recommended. Resolving hmi-meta data requires some time whereas we may not be interessted in all meta data for or all SHARP images. For this reason, we can reload specific meta data for a given set of images.
As an example, the above request reloads the area, cmask and distcoef meta data from the SHARP image 5601499. The corresponding url request looks like this:
Code Block | ||
---|---|---|
| ||
http://localhost:8001/HMI/hmi.sharp_720s/meta/5601499?fields=area,cmask,distcoef |
The result of this query is a list of header informations and meta data for each requested SHARP image:
Code Block | ||
---|---|---|
| ||
{
"5601499": {
"date__obs": "2015-12-11T23:34:08.800000Z",
"download_time": null,
"exptime": null,
"harpnum": 6167,
"mask_cadence": null,
"meta": {
"area": 3507.3125,
"cmask": 6423,
"distcoef": "/home/jsoc/cvs/Development/JSOC/proj/lev1.5_hmi/apps//../libs/lev15/"
},
"nbr_update": 0,
"quality": 0,
"recnum": 5601499,
"recnum_init": null,
"series_name": "hmi.sharp_720s",
"t_rec_index": 1005598,
"time": "2016-05-26T15:39:51Z",
"type": null,
"urls": [],
"wavelnth": 6173
}
} |
The same way as given in the first code example of this section we can now access those meta data using python and requests:
Code Block | ||
---|---|---|
| ||
# define the query parameter
sharp_image = 5601499
fields = ['area', 'cmask', 'distcoef']
# retrieving list of meta data
print('loading meta data...')
meta_data = requests.get("http://cluster-r730-1:8001/HMI/hmi.sharp_720s/meta/%s?fields=%s" % (str(sharp_image), ','.join(fields))).json() |
Downloading Images
With the metadata it is now possible to download the actual images. To do this we have written a tiny function which needs a url as parameter and downloads the file. The image name will be obtained from the header of the http response. The files are written in to the same folder where the script is.
...