<jupyter_start><jupyter_text>Earth Polychromatic Imaging CameraThe EPIC API provides information on the daily imagery collected by DSCOVR's Earth Polychromatic Imaging Camera (EPIC) instrument. Uniquely positioned at the Earth-Sun Lagrange point, EPIC provides full disc imagery of the Earth and captures unique perspectives of certain astronomical events such as lunar transits using a 2048x2048 pixel CCD (Charge Coupled Device) detector coupled to a 30-cm aperture Cassegrain telescope.Image metadata and key information are provided by the JSON API and can be requested by date and for the most recent available date. A listing of all available dates can also be retrieved via the API for more granular control.Development of the EPIC API began in 2015, and is supported by the web development team for the Laboratory for Atmospheres in the Earth Sciences Division of the Goddard Space Flight Center. More information regarding the API and retrieval of the imagery for download can be found on the EPIC website.  Basic Declaration of Some functions<jupyter_code>import requests
import json
import os
import PIL
import urllib
from datetime import date, time, datetime


# Basic function to clean up output
def jprint(obj):
    # create a formatted string of the Python JSON object
    text = json.dumps(obj, sort_keys=True, indent=4)
    print(text)
    
    
# Getting the API Key into the script
with open(os.path.join(os.getcwd(), "My_API_KEY"), 'r') as file:
    my_api_key = file.read()<jupyter_output><empty_output><jupyter_text>Setting the Date on which we want the Image<jupyter_code>image_date = date(2022, 2, 5)
params = {
    'natural/date': image_date,
    'api_key' : my_api_key 
}<jupyter_output><empty_output><jupyter_text>Requesting and making a list of all the images that were taken on that day<jupyter_code>response = requests.get(f'https://api.nasa.gov/EPIC/api/natural/images?', params)
images_list = [i.get('image') for i in response.json()]
for i, image_name in enumerate(images_list):
    image_month = image_date.strftime('%m')
    image_day = image_date.strftime('%d')
    url = f'https://api.nasa.gov/EPIC/archive/natural/{image_date.year}/{image_month}/{image_day}/png/{image_name}.png?api_key={my_api_key}'
    urllib.request.urlretrieve(url, os.path.join(os.getcwd(), 'Earth', f'{image_date} {i}.jpg'))<jupyter_output>https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_20220205004554.png?api_key=YTus5EwF0eWE3EterzdeFFmk4RcGXfOarJiY8Fpk
https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_20220205023357.png?api_key=YTus5EwF0eWE3EterzdeFFmk4RcGXfOarJiY8Fpk
https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_20220205042159.png?api_key=YTus5EwF0eWE3EterzdeFFmk4RcGXfOarJiY8Fpk
https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_20220205061001.png?api_key=YTus5EwF0eWE3EterzdeFFmk4RcGXfOarJiY8Fpk
https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_20220205075804.png?api_key=YTus5EwF0eWE3EterzdeFFmk4RcGXfOarJiY8Fpk
https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_20220205094606.png?api_key=YTus5EwF0eWE3EterzdeFFmk4RcGXfOarJiY8Fpk
https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_20220205113408.png?api_key=YTus5EwF0eWE3EterzdeFFmk4RcGXfOarJiY8Fpk
https://api.nasa.gov/EPIC/archive/natural/2022/02/05/png/epic_1b_2022[...]
{'fraction_non_alphanumeric': 0.09594755661501787, 'fraction_numerical': 0.06853396901072706, 'mean_word_length': 5.795546558704453, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 12, 'https://': 10, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '326999', 'license': 'MIT', 'n_tokens_mistral': 1394, 'n_tokens_neox': 1256, 'n_words': 273, 'path': 'Earth_Polychromatic_Imaging.ipynb', 'repo_name': 'KrishnarajT/Exploring-NASA-APIs', 'size': '3356'}