Created
June 11, 2017 12:47
-
-
Save erget/2a0a451a130224fe089f919ec00bea70 to your computer and use it in GitHub Desktop.
CODA Presence: Demonstration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"# CODA Presence: A demonstration\n", | |
"\n", | |
"CODA Presence makes it easier to communicate with EUMETSAT's Copernicus Online Data Access (CODA) platform. Install it like this:" | |
] | |
}, | |
{ | |
"cell_type": "raw", | |
"metadata": {}, | |
"source": [ | |
"pip3 install codaPresence" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"You can query for products using thematic and geospatial criteria:" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"['452401ff-e7fd-42ce-972f-682f6f25fcfa',\n", | |
" '94e6d328-a697-43d3-8266-7b96f44bce38',\n", | |
" 'd2209d18-bfb8-4f68-9250-57d8ac6f60f8',\n", | |
" 'e866b3b6-e1d9-4122-8779-c28ea456edcb',\n", | |
" '91fa53f8-02c1-4712-94c1-2824c021c105',\n", | |
" '70433bd2-ffb2-4e36-8078-f5f6504b431c',\n", | |
" '82adbac4-f403-461b-bd62-7641a958199b',\n", | |
" '06052248-0684-40ec-9e35-c08e95e451da',\n", | |
" 'a9f34bf4-7513-4361-bf67-70f1c8bf3645',\n", | |
" '2d19ae21-efb9-4ff4-8ab6-7402c31cfb50',\n", | |
" '9ac32a3b-d16d-4441-8fa1-3367cbc364e8',\n", | |
" 'f68bdc61-ea01-4f4b-82f4-56bd607d64c7',\n", | |
" '7ccc94be-d47f-4893-93b9-97504e2d2ca2',\n", | |
" '05977804-0ea3-435e-9564-3173ee321963',\n", | |
" '7b581fa9-5bc2-4d6f-9e56-5df16650d58b',\n", | |
" '76bff2af-bbed-4e37-bc78-15514fbca791',\n", | |
" 'f10fe91c-9b6c-4838-a346-d4284c509697',\n", | |
" '626bce39-414e-48ce-b4ba-146eca89901c',\n", | |
" 'b60aa2df-4a56-489d-aada-dcd5936c361d',\n", | |
" 'dd0410b8-49be-49f5-8530-222a46c3c395',\n", | |
" 'f02a7328-57a8-4752-a422-6235e7245b70',\n", | |
" '135124f6-d1ec-4b9b-a96f-261e5676b0b8',\n", | |
" '523c38d8-3b89-44c9-979b-515d10556eac',\n", | |
" '7263a0bd-4bf1-4476-a34c-9d5f64a246af',\n", | |
" '0091a872-4a5d-4d1e-bd60-cf791ebc139f',\n", | |
" 'd1aba97a-1262-4286-9f84-342567c15b58',\n", | |
" '376d9509-8412-412d-b370-d29a20d79239',\n", | |
" '98667e22-6b0d-465d-8a6d-a0471a7e3549',\n", | |
" 'c9d8621e-b4ed-4c75-b3dd-91eadd56d365',\n", | |
" '193c1e42-a0a9-45b6-b980-dda04634c82e',\n", | |
" '08e5ae99-92fd-46aa-9f95-3942dac3cce0',\n", | |
" '87e6103c-5960-40ea-863a-b764d1b0c77a',\n", | |
" 'c646696c-3122-4130-81a6-f3c073c96ebd',\n", | |
" 'e8079724-fb94-40eb-be34-e9102f5daef8',\n", | |
" '6069be7a-9652-4667-aeba-7a0f8aea8132',\n", | |
" '20a26882-bbb6-4eb0-9da5-bc0e99605739',\n", | |
" 'd4882a71-bd4f-454f-84bd-c8806ee2dad8',\n", | |
" '085e8240-eaf9-48fb-aff7-8fdb590f4c3e',\n", | |
" 'b06c503c-b0ef-421e-ac75-f220d193c2d9',\n", | |
" 'ea93008f-017c-413e-98df-c01f51df7b61',\n", | |
" 'c447ca6f-2233-4fa5-9ba5-86fb5a325873',\n", | |
" 'e393a0df-7c84-4593-bad1-c357248d6a11',\n", | |
" '93ad1687-9dc6-4b69-aaaa-88de59591227',\n", | |
" 'cc87f362-1585-4c5c-9837-289517487af4',\n", | |
" '87836195-5f0e-4d30-9621-b31d212ab020',\n", | |
" '356d2748-5759-46fb-b80d-4837b8e97779',\n", | |
" '3abe6942-602a-4d85-aad9-eef5954aa283',\n", | |
" 'ef90e06e-c4af-4b4b-b89c-9d40666abccf',\n", | |
" '818931d0-6af9-4c6a-8e7d-ea3be85e4bd9',\n", | |
" 'd61049b3-a0f6-4082-8f96-0800660aa5d7',\n", | |
" 'd016eb6e-55b2-4125-a534-4be48675fb32',\n", | |
" '98377468-e5b1-4fcc-a497-45d3db516c24',\n", | |
" '5a1dcf2a-de11-4d79-b849-6dc9ebe464b9',\n", | |
" '8b933e87-ad78-486e-82eb-f1df3be0f709',\n", | |
" '6483aec7-2ed0-475f-8f2c-86b4ab893bae',\n", | |
" 'c81e5eed-a04c-4248-82a0-e07e99b594f2',\n", | |
" '230b3cee-4ec7-469b-b298-97ac81fa2ac0',\n", | |
" '76b8dfc3-098f-4650-a546-fa0b635d2efb',\n", | |
" 'ce923fe4-40aa-4264-9baf-aebb1036c571',\n", | |
" 'c99a44bf-29f3-4317-aca2-b3b16c9f891f',\n", | |
" '5a9b2ceb-978f-40f5-aa35-c15205b97816',\n", | |
" '6e800a2a-76d3-4f58-be48-b3544d08bac3',\n", | |
" '28ea6e9f-be84-4247-b453-8b64316ea3df',\n", | |
" 'e67509aa-8c11-444b-a405-46ef0d3c4150',\n", | |
" 'b039147c-102f-4336-9076-83c89cd393a4',\n", | |
" 'a99138aa-e87b-466a-b627-fe27cfdf6661',\n", | |
" 'a46fd19f-0794-4841-a66f-b4dfe9b80292',\n", | |
" 'b45ae2f8-ce57-4aac-a5ab-9fd53c6d6d69',\n", | |
" '019bbd2f-54ef-4289-ae75-6c15144badc7',\n", | |
" '2c9e8f31-512b-4aba-bffe-04ea7bcec3fa',\n", | |
" 'a20e04d7-b63f-49b1-9389-8eeefc2da009',\n", | |
" 'ee9af9d1-6284-4e6b-a714-50993c71e56d',\n", | |
" '731a84fa-ad06-48b3-beea-a23a7cf02617',\n", | |
" 'cfa71afc-52dd-4203-8fa4-cdb790344cc8',\n", | |
" '21048f09-2165-4ce9-bcf1-003ae3f0c875',\n", | |
" '7995b799-299d-405d-8364-c17045829660',\n", | |
" '36d78283-9946-4086-8e43-8a89b1312074',\n", | |
" '2104a4dc-71de-4a51-b965-56a913e25836',\n", | |
" 'bc7ba746-5cad-41da-b9db-c557100445c5',\n", | |
" '063c7f4d-79b7-4304-8ea6-bffd91e88db3',\n", | |
" '69e49525-2149-4328-a799-31137257a244',\n", | |
" '1e5824dd-46fb-4e3e-8f68-7f61190943a7',\n", | |
" 'e4dbadfa-f491-48bf-ae76-d4d27ce8642e',\n", | |
" '71f05c9e-eab0-428e-a5d6-a1d69dde1517',\n", | |
" 'f496a38a-fbf8-4588-b082-c7b5a014f573',\n", | |
" '2e87a06a-6c03-45ee-943c-070c8124242e',\n", | |
" '8133c40c-1b72-473f-838a-2c4ce9ee0ac5',\n", | |
" '5d1c2f87-81a8-414e-b230-382e3db97eb5',\n", | |
" '8a5c25e4-8e57-41bc-9291-5f5656ccb6b1',\n", | |
" '179ecd51-0e00-4c60-9cba-6a5f2fa59b63',\n", | |
" '462fa72e-008b-4f5d-b1b9-78b9d1422980',\n", | |
" '3843d80d-5cee-49ed-92ad-0b8f34c18c7c',\n", | |
" 'a738c8c1-5b81-44fc-baba-b4aa26897b53',\n", | |
" '173754da-d18c-4e3e-a1d4-2c479ab40197',\n", | |
" '13ceebe1-6763-42f6-817d-56678db4b7c2',\n", | |
" 'caf9752d-72da-43ff-b627-e4f3769252a1',\n", | |
" 'e9bf307f-1c2c-4aef-a00f-5132c3ae1288',\n", | |
" '7891ae61-eda7-4610-a605-7f3a44bd43e8',\n", | |
" '9c7335fb-f4a9-4ef4-8691-4e924680a0df',\n", | |
" 'a8fc63e1-5611-45d8-a73f-ab6e6cebe557']" | |
] | |
}, | |
"execution_count": 1, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"from datetime import datetime\n", | |
"\n", | |
"from codaPresence import Query, Product\n", | |
"\n", | |
"# We only use temporal subsetting\n", | |
"sral_prods = Query(\"SR_2_WAT\", datetime(2017, 2, 1), datetime(2017, 2, 2), None)\n", | |
"olci_prods = Query(\"OL_1\", datetime(2017, 2, 1), datetime(2017, 2, 3), None)\n", | |
"\n", | |
"# We want all results\n", | |
"sral_prods.get_uuids()\n", | |
"# Here we want only 50 results\n", | |
"olci_prods.get_uuids(50)" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"You can use the product IDs to access products. Individual nodes within the product are discovered and downloaded only when needed." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n", | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n" | |
] | |
}, | |
{ | |
"data": { | |
"text/plain": [ | |
"['Oa01_radiance.nc',\n", | |
" 'Oa02_radiance.nc',\n", | |
" 'Oa03_radiance.nc',\n", | |
" 'Oa04_radiance.nc',\n", | |
" 'Oa05_radiance.nc',\n", | |
" 'Oa06_radiance.nc',\n", | |
" 'Oa07_radiance.nc',\n", | |
" 'Oa08_radiance.nc',\n", | |
" 'Oa09_radiance.nc',\n", | |
" 'Oa10_radiance.nc',\n", | |
" 'Oa11_radiance.nc',\n", | |
" 'Oa12_radiance.nc',\n", | |
" 'Oa13_radiance.nc',\n", | |
" 'Oa14_radiance.nc',\n", | |
" 'Oa15_radiance.nc',\n", | |
" 'Oa16_radiance.nc',\n", | |
" 'Oa17_radiance.nc',\n", | |
" 'Oa18_radiance.nc',\n", | |
" 'Oa19_radiance.nc',\n", | |
" 'Oa20_radiance.nc',\n", | |
" 'Oa21_radiance.nc',\n", | |
" 'geo_coordinates.nc',\n", | |
" 'instrument_data.nc',\n", | |
" 'qualityFlags.nc',\n", | |
" 'removed_pixels.nc',\n", | |
" 'tie_geo_coordinates.nc',\n", | |
" 'tie_geometries.nc',\n", | |
" 'tie_meteo.nc',\n", | |
" 'time_coordinates.nc']" | |
] | |
}, | |
"execution_count": 2, | |
"metadata": {}, | |
"output_type": "execute_result" | |
} | |
], | |
"source": [ | |
"olci = Product(olci_prods.get_uuids()[0], \"/tmp\")\n", | |
"olci.files" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"metadata": {}, | |
"source": [ | |
"Now you can access the files you want. They're only downloaded once." | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/usr/lib/python3.4/site-packages/requests/packages/urllib3/connectionpool.py:768: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html\n", | |
" InsecureRequestWarning)\n" | |
] | |
} | |
], | |
"source": [ | |
"olci.get(\"geo_coordinates.nc\")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"collapsed": false | |
}, | |
"outputs": [], | |
"source": [ | |
"# This time no network transaction is used\n", | |
"olci.get(\"geo_coordinates.nc\")" | |
] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.4.5" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
laeuft