# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 2
#     language: python
#     name: python2
# ---

import os
import cioppy
import getpass

ciop = cioppy.Cioppy()

data_path = '/workspace/data'

username = getpass.getpass("Enter your username:")
api_key = getpass.getpass("Enter the API key:")

if not os.path.isdir(data_path):
    os.makedirs(data_path)

input_references = ['https://catalog.terradue.com/better-ethz-02-01-01/search?uid=F4636C8462A88D225393E23281C011ED477B22A7']

# Sakurajima 31.614,130.658
input_references = ['https://catalog.terradue.com/better-ethz-02-01-01/search?uid=C858B8C24E1B7ED261F1B0D9AF04A39DB11B1C82']

# Mount Merapi -7.507,110.452
input_references = ['https://catalog.terradue.com/better-ethz-02-01-01/search?uid=BDB9FD29E55F127A9874877E0D662F5D95C356E0']

# +
import os
import getpass

vm_user = getpass.getuser()
os.environ['HOME'] = '/home/{}'.format(vm_user)
# -

for input_reference in input_references:
    
    enclosure = ciop.search(end_point=input_reference,
                              params=[('do', 'terradue')],
                              output_fields='enclosure',
                              model='EOP')[0]['enclosure']

    print enclosure
    
    retrieved = ciop.copy(enclosure, data_path, extract=True, credentials='{}:{}'.format(username, api_key))



StarcoderdataJupyterScriptsDedupFiltered