diff --git a/notebooks/actinia_leafmap.ipynb b/notebooks/actinia_leafmap.ipynb index 6d1aae8..ffe2bfe 100644 --- a/notebooks/actinia_leafmap.ipynb +++ b/notebooks/actinia_leafmap.ipynb @@ -22,27 +22,47 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 1, "id": "01931d34-d109-4252-8ae4-48d23beec801", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.2\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" + ] + } + ], "source": [ - "!pip install --quiet leafmap" + "!pip3 install --quiet leafmap" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 2, "id": "540b669f-e7f2-4c3d-aa2e-5aaf65fa4797", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.2\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" + ] + } + ], "source": [ - "!pip install --quiet rio-cogeo ipysheet" + "!pip3 install --quiet rio-cogeo ipysheet" ] }, { "cell_type": "code", - "execution_count": null, + "execution_count": 3, "id": "36fcfca4-8a6a-456a-91fd-c77a27cd3aab", "metadata": {}, "outputs": [], @@ -66,12 +86,22 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 4, "id": "bdddba59-e6c4-4fca-88fa-9e0d13ca439c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.2\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" + ] + } + ], "source": [ - "!pip install --quiet localtileserver" + "!pip3 install --quiet localtileserver" ] }, { @@ -96,15 +126,53 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 5, "id": "47b7743f", "metadata": {}, - "outputs": [], - "source": [ - "# install actinia-python-client, update version as needed\n", - "!wget -c https://github.com/actinia-org/actinia-python-client/releases/download/0.3.0/actinia_python_client-0.3.0-py3-none-any.whl\n", - "\n", - "!pip3 install actinia_python_client-0.3.0-py3-none-any.whl" + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Defaulting to user installation because normal site-packages is not writeable\n", + "Requirement already satisfied: actinia-python-client in /home/aweinmann/.local/lib/python3.10/site-packages (0.3.2)\n", + "Requirement already satisfied: jinja2 in /home/aweinmann/.local/lib/python3.10/site-packages (from actinia-python-client) (3.1.2)\n", + "Requirement already satisfied: requests in /home/aweinmann/.local/lib/python3.10/site-packages (from actinia-python-client) (2.31.0)\n", + "Requirement already satisfied: sphinx-material in /home/aweinmann/.local/lib/python3.10/site-packages (from actinia-python-client) (0.0.36)\n", + "Requirement already satisfied: MarkupSafe>=2.0 in /home/aweinmann/.local/lib/python3.10/site-packages (from jinja2->actinia-python-client) (2.1.3)\n", + "Requirement already satisfied: charset-normalizer<4,>=2 in /home/aweinmann/.local/lib/python3.10/site-packages (from requests->actinia-python-client) (3.2.0)\n", + "Requirement already satisfied: idna<4,>=2.5 in /usr/lib/python3/dist-packages (from requests->actinia-python-client) (3.3)\n", + "Requirement already satisfied: urllib3<3,>=1.21.1 in /usr/lib/python3/dist-packages (from requests->actinia-python-client) (1.26.5)\n", + "Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3/dist-packages (from requests->actinia-python-client) (2020.6.20)\n", + "Requirement already satisfied: sphinx>=2.0 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx-material->actinia-python-client) (7.2.6)\n", + "Requirement already satisfied: beautifulsoup4 in /usr/lib/python3/dist-packages (from sphinx-material->actinia-python-client) (4.10.0)\n", + "Requirement already satisfied: python-slugify[unidecode] in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx-material->actinia-python-client) (8.0.1)\n", + "Requirement already satisfied: css-html-js-minify in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx-material->actinia-python-client) (2.5.5)\n", + "Requirement already satisfied: lxml in /usr/lib/python3/dist-packages (from sphinx-material->actinia-python-client) (4.8.0)\n", + "Requirement already satisfied: sphinxcontrib-applehelp in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (1.0.7)\n", + "Requirement already satisfied: sphinxcontrib-devhelp in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (1.0.5)\n", + "Requirement already satisfied: sphinxcontrib-jsmath in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (1.0.1)\n", + "Requirement already satisfied: sphinxcontrib-htmlhelp>=2.0.0 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (2.0.4)\n", + "Requirement already satisfied: sphinxcontrib-serializinghtml>=1.1.9 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (1.1.9)\n", + "Requirement already satisfied: sphinxcontrib-qthelp in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (1.0.6)\n", + "Requirement already satisfied: Pygments>=2.14 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (2.17.2)\n", + "Requirement already satisfied: docutils<0.21,>=0.18.1 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (0.20.1)\n", + "Requirement already satisfied: snowballstemmer>=2.0 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (2.2.0)\n", + "Requirement already satisfied: babel>=2.9 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (2.13.1)\n", + "Requirement already satisfied: alabaster<0.8,>=0.7 in /usr/lib/python3/dist-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (0.7.12)\n", + "Requirement already satisfied: imagesize>=1.3 in /usr/lib/python3/dist-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (1.3.0)\n", + "Requirement already satisfied: packaging>=21.0 in /home/aweinmann/.local/lib/python3.10/site-packages (from sphinx>=2.0->sphinx-material->actinia-python-client) (23.1)\n", + "Requirement already satisfied: text-unidecode>=1.3 in /home/aweinmann/.local/lib/python3.10/site-packages (from python-slugify[unidecode]->sphinx-material->actinia-python-client) (1.3)\n", + "Requirement already satisfied: Unidecode>=1.1.1 in /usr/lib/python3/dist-packages (from python-slugify[unidecode]->sphinx-material->actinia-python-client) (1.3.3)\n", + "\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip is available: \u001b[0m\u001b[31;49m23.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m23.3.2\u001b[0m\n", + "\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n" + ] + } + ], + "source": [ + "# install actinia-python-client\n", + "!pip3 install actinia-python-client" ] }, { @@ -129,7 +197,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "id": "7edfcd39", "metadata": {}, "outputs": [], @@ -148,7 +216,10 @@ "def print_dict_keys(input_dict, text=None):\n", " if text:\n", " print(text)\n", - " print(\", \".join(input_dict.keys()))" + " if input_dict is None:\n", + " print(\"\")\n", + " else:\n", + " print(\", \".join(input_dict.keys()))" ] }, { @@ -163,10 +234,46 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 7, "id": "ac487ff1", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Version is:\n", + "{\n", + " \"api_version\": \"3.4.0\",\n", + " \"grass_version\": {\n", + " \"build_date\": \"2023-11-20\",\n", + " \"build_off_t_size\": \"8\",\n", + " \"build_platform\": \"x86_64-pc-linux-musl\",\n", + " \"date\": \"2023\",\n", + " \"gdal\": \"3.6.4\",\n", + " \"geos\": \"3.11.2\",\n", + " \"libgis_date\": \"2023-11-20T07:58:32+00:00\",\n", + " \"libgis_revision\": \"8.3.2dev\",\n", + " \"proj\": \"9.2.1\",\n", + " \"revision\": \"79322c7\",\n", + " \"sqlite\": \"3.41.2\",\n", + " \"version\": \"8.3.2dev\"\n", + " },\n", + " \"plugin_versions\": {\n", + " \"actinia_metadata_plugin\": \"1.0.2\",\n", + " \"actinia_module_plugin\": \"2.5.0\",\n", + " \"actinia_satellite_plugin\": \"0.1.0\",\n", + " \"actinia_stac_plugin\": \"0.1.1\",\n", + " \"actinia_statistic_plugin\": \"0.2.1\"\n", + " },\n", + " \"plugins\": \"actinia_statistic_plugin,actinia_satellite_plugin,actinia_metadata_plugin,actinia_module_plugin,actinia_stac_plugin\",\n", + " \"python_version\": \"3.11.6 (main, Oct 4 2023, 06:22:18) [GCC 12.2.1 20220924]\",\n", + " \"running_since\": \"n/a\",\n", + " \"version\": \"4.12.0\"\n", + "}\n" + ] + } + ], "source": [ "# connect to default actinia server (actinia.mundialis.de)\n", "from actinia import Actinia\n", @@ -189,10 +296,18 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "id": "d7dd0313", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Connected to actinia server.\n" + ] + } + ], "source": [ "# define user/password for connection\n", "#actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\")\n", @@ -213,10 +328,19 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 9, "id": "d79ea4f3", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Locations: \n", + "ECAD, nc_spm_08, fossgis2023_epsg25832_utm32N, latlong_wgs84\n" + ] + } + ], "source": [ "# obtain the list of locations (which are accessible to current user)\n", "locations = actinia_mundialis.get_locations()\n", @@ -233,10 +357,43 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 10, "id": "8e14bbff", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Location info:\n", + "{\n", + " \"projection\": \"PROJCRS[\\\"NAD83(HARN) / North Carolina\\\",BASEGEOGCRS[\\\"NAD83(HARN)\\\",DATUM[\\\"NAD83 (High Accuracy Reference Network)\\\",ELLIPSOID[\\\"GRS 1980\\\",6378137,298.257222101,LENGTHUNIT[\\\"metre\\\",1]]],PRIMEM[\\\"Greenwich\\\",0,ANGLEUNIT[\\\"degree\\\",0.0174532925199433]],ID[\\\"EPSG\\\",4152]],CONVERSION[\\\"SPCS83 North Carolina zone (meters)\\\",METHOD[\\\"Lambert Conic Conformal (2SP)\\\",ID[\\\"EPSG\\\",9802]],PARAMETER[\\\"Latitude of false origin\\\",33.75,ANGLEUNIT[\\\"degree\\\",0.0174532925199433],ID[\\\"EPSG\\\",8821]],PARAMETER[\\\"Longitude of false origin\\\",-79,ANGLEUNIT[\\\"degree\\\",0.0174532925199433],ID[\\\"EPSG\\\",8822]],PARAMETER[\\\"Latitude of 1st standard parallel\\\",36.1666666666667,ANGLEUNIT[\\\"degree\\\",0.0174532925199433],ID[\\\"EPSG\\\",8823]],PARAMETER[\\\"Latitude of 2nd standard parallel\\\",34.3333333333333,ANGLEUNIT[\\\"degree\\\",0.0174532925199433],ID[\\\"EPSG\\\",8824]],PARAMETER[\\\"Easting at false origin\\\",609601.22,LENGTHUNIT[\\\"metre\\\",1],ID[\\\"EPSG\\\",8826]],PARAMETER[\\\"Northing at false origin\\\",0,LENGTHUNIT[\\\"metre\\\",1],ID[\\\"EPSG\\\",8827]]],CS[Cartesian,2],AXIS[\\\"easting (X)\\\",east,ORDER[1],LENGTHUNIT[\\\"metre\\\",1]],AXIS[\\\"northing (Y)\\\",north,ORDER[2],LENGTHUNIT[\\\"metre\\\",1]],USAGE[SCOPE[\\\"Engineering survey, topographic mapping.\\\"],AREA[\\\"United States (USA) - North Carolina - counties of Alamance; Alexander; Alleghany; Anson; Ashe; Avery; Beaufort; Bertie; Bladen; Brunswick; Buncombe; Burke; Cabarrus; Caldwell; Camden; Carteret; Caswell; Catawba; Chatham; Cherokee; Chowan; Clay; Cleveland; Columbus; Craven; Cumberland; Currituck; Dare; Davidson; Davie; Duplin; Durham; Edgecombe; Forsyth; Franklin; Gaston; Gates; Graham; Granville; Greene; Guilford; Halifax; Harnett; Haywood; Henderson; Hertford; Hoke; Hyde; Iredell; Jackson; Johnston; Jones; Lee; Lenoir; Lincoln; Macon; Madison; Martin; McDowell; Mecklenburg; Mitchell; Montgomery; Moore; Nash; New Hanover; Northampton; Onslow; Orange; Pamlico; Pasquotank; Pender; Perquimans; Person; Pitt; Polk; Randolph; Richmond; Robeson; Rockingham; Rowan; Rutherford; Sampson; Scotland; Stanly; Stokes; Surry; Swain; Transylvania; Tyrrell; Union; Vance; Wake; Warren; Washington; Watauga; Wayne; Wilkes; Wilson; Yadkin; Yancey.\\\"],BBOX[33.83,-84.33,36.59,-75.38]],ID[\\\"EPSG\\\",3358]]\\n\",\n", + " \"region\": {\n", + " \"b\": 0.0,\n", + " \"cells\": 29535,\n", + " \"cells3\": 29535,\n", + " \"cols\": 179,\n", + " \"cols3\": 179,\n", + " \"depths\": 1,\n", + " \"e\": 639530.0,\n", + " \"ewres\": 10.0,\n", + " \"ewres3\": 10.0,\n", + " \"n\": 221230.0,\n", + " \"nsres\": 10.0,\n", + " \"nsres3\": 10.0,\n", + " \"projection\": 99,\n", + " \"rows\": 165,\n", + " \"rows3\": 165,\n", + " \"s\": 219580.0,\n", + " \"t\": 1.0,\n", + " \"tbres\": 1.0,\n", + " \"w\": 637740.0,\n", + " \"zone\": 0\n", + " }\n", + "}\n" + ] + } + ], "source": [ "print_dict(actinia_mundialis.locations[\"nc_spm_08\"].get_info(), \"Location info:\")" ] @@ -257,10 +414,28 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 11, "id": "1fc46492", "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Status of hillshading job is accepted: Resource accepted\n", + "Status of hillshading job is finished: Processing successfully finished\n" + ] + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "finished\n", + "Processing successfully finished\n", + "https://actinia.mundialis.de/api/v3/resources/fossgis2023/resource_id-01b231c5-0517-4bf8-994d-4bcff9bc03df/hillshade.tif\n" + ] + } + ], "source": [ "pc = {\n", " \"list\": [\n", @@ -325,7 +500,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 12, "id": "56b74052", "metadata": {}, "outputs": [], @@ -335,7 +510,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 13, "id": "1c0468e8", "metadata": {}, "outputs": [], @@ -364,7 +539,7 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 14, "id": "c13c439a-ecf2-4820-8e3a-f3cde32a684a", "metadata": {}, "outputs": [], @@ -390,10 +565,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 15, "id": "cd103e3e-3823-4e7c-9a61-4f05850b7e4d", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "(True, [], [])" + ] + }, + "execution_count": 15, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "leafmap.cog_validate(url)" ] @@ -408,10 +594,21 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 16, "id": "207f7475-e22a-4e5d-a312-ac13d8f3eb5c", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "Info(Path='https://fossgis2023:ieh0ahweefavicieca6g@actinia.mundialis.de/api/v3/resources/fossgis2023/resource_id-01b231c5-0517-4bf8-994d-4bcff9bc03df/hillshade.tif', Driver='GTiff', COG=True, Compression='LZW', ColorSpace=None, COG_errors=None, COG_warnings=None, Profile=Profile(Bands=1, Width=1500, Height=1350, Tiled=True, Dtype='int16', Interleave='BAND', AlphaBand=False, InternalMask=False, Nodata=-32768.0, ColorInterp=('gray',), ColorMap=False, Scales=(1.0,), Offsets=(0.0,)), GEO=Geo(CRS='EPSG:3358', BoundingBox=(630000.0, 215000.0, 645000.0, 228500.0), Origin=(630000.0, 228500.0), Resolution=(10.0, -10.0), MinZoom=11, MaxZoom=14), Tags={'Image Metadata': {'AREA_OR_POINT': 'Area'}, 'Image Structure': {'COMPRESSION': 'LZW', 'INTERLEAVE': 'BAND', 'LAYOUT': 'COG'}}, Band_Metadata={'Band 1': BandMetadata(Description=None, ColorInterp='gray', Offset=0.0, Scale=1.0, Metadata={})}, IFD=[IFD(Level=0, Width=1500, Height=1350, Blocksize=(512, 512), Decimation=0), IFD(Level=1, Width=750, Height=675, Blocksize=(512, 512), Decimation=2), IFD(Level=2, Width=375, Height=337, Blocksize=(512, 512), Decimation=4)])" + ] + }, + "execution_count": 16, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "leafmap.cog_validate(url, verbose=True)" ] @@ -426,10 +623,26 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 17, "id": "e136527e-64fc-4c92-ae64-6ec3571b7eb0", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "application/vnd.jupyter.widget-view+json": { + "model_id": "c15d464ebd594795b48a83e2f5bb4c21", + "version_major": 2, + "version_minor": 0 + }, + "text/plain": [ + "Map(center=[20, 0], controls=(ZoomControl(options=['position', 'zoom_in_text', 'zoom_in_title', 'zoom_out_text…" + ] + }, + "execution_count": 17, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "m = leafmap.Map()\n", "\n", @@ -440,7 +653,7 @@ "\n", "m.add_colorbar(colors=colors, vmin=vmin, vmax=vmax)\n", "\n", - "m.add_cog_layer(url, name=\"North Carolina elevation hillshaded map\", \n", + "m.add_cog_layer(url, name=\"North Carolina elevation hillshaded map\",\n", " attribution='https://grass.osgeo.org/download/data/')\n", "# show map\n", "m" @@ -471,7 +684,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.2" + "version": "3.10.12" } }, "nbformat": 4,