Skip to content

Instantly share code, notes, and snippets.

@soxofaan
Created February 10, 2020 11:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save soxofaan/91e31e72a4f1446fbf952e8617158867 to your computer and use it in GitHub Desktop.
Save soxofaan/91e31e72a4f1446fbf952e8617158867 to your computer and use it in GitHub Desktop.
openeo python client issue #107 example
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import openeo\n",
"from pprint import pprint"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'0.1.0a1'"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"openeo.client_version()"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"openeo_url = \"http://openeo.vgt.vito.be/openeo/0.4.2\""
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"conn = openeo.connect(openeo_url)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"s2 = conn.load_collection(\"CGS_SENTINEL2_RADIOMETRY_V102_001\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"a = s2.filter_bands(\"2\")\n",
"b = s2.filter_bands(\"3\")"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'filterbands1': {'arguments': {'bands': '2',\n",
" 'data': {'from_node': 'loadcollection1'}},\n",
" 'process_id': 'filter_bands',\n",
" 'result': False},\n",
" 'loadcollection1': {'arguments': {'id': 'CGS_SENTINEL2_RADIOMETRY_V102_001',\n",
" 'spatial_extent': None,\n",
" 'temporal_extent': None},\n",
" 'process_id': 'load_collection',\n",
" 'result': False}}\n"
]
}
],
"source": [
"pprint(a.graph)"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'filterbands2': {'arguments': {'bands': '3',\n",
" 'data': {'from_node': 'loadcollection1'}},\n",
" 'process_id': 'filter_bands',\n",
" 'result': False},\n",
" 'loadcollection1': {'arguments': {'id': 'CGS_SENTINEL2_RADIOMETRY_V102_001',\n",
" 'spatial_extent': None,\n",
" 'temporal_extent': None},\n",
" 'process_id': 'load_collection',\n",
" 'result': False}}\n"
]
}
],
"source": [
"pprint(b.graph)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
"c = a + b"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"{'filterbands3': {'arguments': {'bands': '2',\n",
" 'data': {'from_node': 'loadcollection2'}},\n",
" 'process_id': 'filter_bands',\n",
" 'result': False},\n",
" 'filterbands4': {'arguments': {'bands': '3',\n",
" 'data': {'from_node': 'loadcollection3'}},\n",
" 'process_id': 'filter_bands',\n",
" 'result': False},\n",
" 'loadcollection2': {'arguments': {'id': 'CGS_SENTINEL2_RADIOMETRY_V102_001',\n",
" 'spatial_extent': None,\n",
" 'temporal_extent': None},\n",
" 'process_id': 'load_collection',\n",
" 'result': False},\n",
" 'loadcollection3': {'arguments': {'id': 'CGS_SENTINEL2_RADIOMETRY_V102_001',\n",
" 'spatial_extent': None,\n",
" 'temporal_extent': None},\n",
" 'process_id': 'load_collection',\n",
" 'result': False},\n",
" 'mergecubes1': {'arguments': {'cube1': {'from_node': 'filterbands3'},\n",
" 'cube2': {'from_node': 'filterbands4'},\n",
" 'overlap_resolver': {'callback': {'sum1': {'arguments': {'data': [{'from_argument': 'cube2'},\n",
" {'from_argument': 'cube2'}]},\n",
" 'process_id': 'sum',\n",
" 'result': True}}}},\n",
" 'process_id': 'merge_cubes',\n",
" 'result': False}}\n"
]
}
],
"source": [
"pprint(c.graph)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "OpenEO env",
"language": "python",
"name": "openeo"
},
"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.5.6"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment