Installation
+You can install the actinia Python library via:
+pip3 install actinia-python-client
+
+For newest version see releases.
+ +diff --git a/.nojekyll b/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/02_installation/index.html b/02_installation/index.html new file mode 100644 index 0000000..50f6dfc --- /dev/null +++ b/02_installation/index.html @@ -0,0 +1,152 @@ + + +
+ + + + +You can install the actinia Python library via:
+pip3 install actinia-python-client
+
+For newest version see releases.
+ +Connecting actinia Python library with actinia
+from actinia import Actinia
+
+actinia_mundialis = Actinia()
+actinia_mundialis.get_version()
+
+or connect to actinia-dev with version 3:
+from actinia import Actinia
+
+actinia_dev_mundialis = Actinia("https://actinia-dev.mundialis.de/", "v3")
+actinia_dev_mundialis.get_version()
+
+Set authentication to get access to the actinia functionallity
+actinia_mundialis.set_authentication("demouser", "gu3st!pa55w0rd")
+
+
+ With the location management the locations can be requested as well as +information of each location. Also a location can be created and deleted if the user is permitted.
+First connecting actinia Python library with actinia and +set authentication (Attention: The demouser is not permitted to create or delete a location!)
+from actinia import Actinia
+
+actinia_mundialis = Actinia()
+actinia_mundialis.get_version()
+actinia_mundialis.set_authentication("demouser", "gu3st!pa55w0rd")
+
+locations = actinia_mundialis.get_locations()
+print(locations.keys())
+locations["nc_spm_08"].get_info()
+# or
+actinia_mundialis.locations["nc_spm_08"].get_info()
+
+new_location = actinia_mundialis.create_location("test_location", 25832)
+print(new_location.name)
+print(new_location.region)
+print([loc for loc in actinia_mundialis.locations])
+
+actinia_mundialis.locations["test_location"].delete()
+print([loc for loc in actinia_mundialis.locations()])
+
+
+ With the mapset management the mapsets of a specified location can be +requested as well as information of each mapset. +Also a mapsest can be created and deleted if the user is permitted.
+First connecting actinia Python library with actinia and +set authentication (Attention: The demouser is not permitted to create or delete a mapset!)
+from actinia import Actinia
+
+actinia_mundialis = Actinia()
+actinia_mundialis.get_version()
+actinia_mundialis.set_authentication("demouser", "gu3st!pa55w0rd")
+
+# request all locations
+locations = actinia_mundialis.get_locations()
+
+Get mapsets of the nc_spm_08 location:
+mapsets = actinia_mundialis.locations["nc_spm_08"].get_mapsets()
+print(mapsets.keys())
+
+Create test_mapset in nc_spm_08 location:
+mapset_name = "test_mapset"
+locations["nc_spm_08"].create_mapset(mapset_name)
+print(mapsets.keys())
+
+Delete test_mapset mapset:
+locations["nc_spm_08"].delete_mapset(mapset_name)
+print(mapsets.keys())
+
+
+ from actinia import Actinia
+
+actinia_mundialis = Actinia()
+actinia_mundialis.get_version()
+actinia_mundialis.set_authentication("demouser", "gu3st!pa55w0rd")
+
+# request all locations
+locations = actinia_mundialis.get_locations()
+# Get Mapsets of nc_spm_08 location
+mapsets = actinia_mundialis.locations["nc_spm_08"].get_mapsets()
+
+Get all rasters of the PERMANENT
mapsets
rasters = mapsets["PERMANENT"].get_raster_layers()
+print(rasters.keys())
+
+Get information of the raster zipcodes
info = rasters["zipcodes"].get_info()
+
+Upload a GTif as raster layer to a user mapset (here the user mapset will be +created before)
+mapset_name = "test_mapset"
+
+# mapset creation
+locations["nc_spm_08"].create_mapset(mapset_name)
+
+# upload tif
+raster_layer_name = "test"
+file = "/home/testuser/data/elevation.tif"
+locations["nc_spm_08"].mapsets[mapset_name].upload_raster(raster_layer_name, file)
+print(locations["nc_spm_08"].mapsets[mapset_name].raster_layers.keys())
+
+Delete a raster layer
+locations["nc_spm_08"].mapsets[mapset_name].delete_raster(raster_layer_name)
+print(locations["nc_spm_08"].mapsets[mapset_name].raster_layers.keys())
+
+# delete mapset
+locations["nc_spm_08"].delete_mapset(mapset_name)
+
+Get all vector maps of the PERMANENT
mapsets
vectors = mapsets["PERMANENT"].get_vector_layers()
+print(vectors.keys())
+
+Get information of the vector boundary_county
info = vectors["boundary_county"].get_info()
+
+Upload a GeoJSON as vector layer to a user mapset (here the user mapset will +be created before)
+mapset_name = "test_mapset"
+
+# mapset creation
+locations["nc_spm_08"].create_mapset(mapset_name)
+
+# upload tif
+vector_layer_name = "test"
+file = "/home/testuser/data/firestations.geojson"
+locations["nc_spm_08"].mapsets[mapset_name].upload_vector(vector_layer_name, file)
+print(locations["nc_spm_08"].mapsets[mapset_name].vector_layers.keys())
+
+Delete a raster layer
+locations["nc_spm_08"].mapsets[mapset_name].delete_vector(vector_layer_name)
+print(locations["nc_spm_08"].mapsets[mapset_name].vector_layers.keys())
+
+# delete mapset
+locations["nc_spm_08"].delete_mapset(mapset_name)
+
+
+ A process chain can be validated before a job is started.
+First connecting actinia Python library with actinia and set authentication:
+from actinia import Actinia
+
+actinia_mundialis = Actinia()
+actinia_mundialis.get_version()
+actinia_mundialis.set_authentication("demouser", "gu3st!pa55w0rd")
+
+# request all locations
+locations = actinia_mundialis.get_locations()
+
+pc = {
+ "list": [
+ {
+ "id": "r_mapcalc",
+ "module": "r.mapcalc",
+ "inputs": [
+ {
+ "param": "expression",
+ "value": "elevation=42"
+ }
+ ]
+ }
+ ],
+ "version": "1"
+}
+pc = {"list": [{"id": "r_mapcalc","module": "r.mapcalc","inputs": [{"param": "expression","value": "elevation=42"}]}],"version": "1"}
+actinia_mundialis.locations["nc_spm_08"].validate_process_chain_sync(pc)
+
+pc = {
+ "list": [
+ {
+ "id": "r_mapcalc",
+ "module": "r.mapcalc",
+ "inputs": [
+ {
+ "param": "expression",
+ "value": "elevation=42"
+ }
+ ]
+ }
+ ],
+ "version": "1"
+}
+pc = {"list": [{"id": "r_mapcalc","module": "r.mapcalc","inputs": [{"param": "expression","value": "elevation=42"}]}],"version": "1"}
+val_job = actinia_mundialis.locations["nc_spm_08"].validate_process_chain_async(pc)
+val_job.poll_until_finished()
+print(val_job.status)
+print(val_job.message)
+
+
+ Start a processing job with a valid process chain.
+First connect actinia Python library with actinia and set authentication:
+from actinia import Actinia
+
+actinia_mundialis = Actinia()
+actinia_mundialis.get_version()
+actinia_mundialis.set_authentication("demouser", "gu3st!pa55w0rd")
+
+# request all locations
+locations = actinia_mundialis.get_locations()
+
+Start an ephemeral processing job
+pc = {
+ "list": [
+ {
+ "id": "r_mapcalc",
+ "module": "r.mapcalc",
+ "inputs": [
+ {
+ "param": "expression",
+ "value": "baum=5"
+ }
+ ]
+ }
+ ],
+ "version": "1"
+}
+job = actinia_mundialis.locations["nc_spm_08"].create_processing_export_job(pc, "test")
+job.poll_until_finished()
+
+print(job.status)
+print(job.message)
+
+Start a persistent processing job
+pc = {
+ "list": [
+ {
+ "id": "r_mapcalc",
+ "module": "r.mapcalc",
+ "inputs": [
+ {
+ "param": "expression",
+ "value": "baum=5"
+ }
+ ]
+ }
+ ],
+ "version": "1"
+}
+# create user mapset (persistent processing can only be done in a user mapset)
+mapset_name = "test_mapset"
+locations["nc_spm_08"].create_mapset(mapset_name)
+
+# create job
+job = locations["nc_spm_08"].mapsets[mapset_name].create_processing_job(pc, "test")
+job.poll_until_finished()
+
+print(job.status)
+print(job.message)
+
+# print rasters in "test_mapset"
+rasters = locations["nc_spm_08"].mapsets[mapset_name].get_raster_layers()
+print(rasters.keys())
+
+# delete user mapset
+locations["nc_spm_08"].delete_mapset(mapset_name)
+print(locations["nc_spm_08"].mapsets.keys())
+
+
+ Page not found
+ + +Access actinia - The GRASS GIS REST API via Python.
+actinia-python-client is a Python library to access an actinia server easily via python.
+ + +' + escapeHtml(summary) +'
' + noResultsText + '
'); + } +} + +function doSearch () { + var query = document.getElementById('mkdocs-search-query').value; + if (query.length > min_search_length) { + if (!window.Worker) { + displayResults(search(query)); + } else { + searchWorker.postMessage({query: query}); + } + } else { + // Clear results for short queries + displayResults([]); + } +} + +function initSearch () { + var search_input = document.getElementById('mkdocs-search-query'); + if (search_input) { + search_input.addEventListener("keyup", doSearch); + } + var term = getSearchTermFromLocation(); + if (term) { + search_input.value = term; + doSearch(); + } +} + +function onWorkerMessage (e) { + if (e.data.allowSearch) { + initSearch(); + } else if (e.data.results) { + var results = e.data.results; + displayResults(results); + } else if (e.data.config) { + min_search_length = e.data.config.min_search_length-1; + } +} + +if (!window.Worker) { + console.log('Web Worker API not supported'); + // load index in main thread + $.getScript(joinUrl(base_url, "search/worker.js")).done(function () { + console.log('Loaded worker'); + init(); + window.postMessage = function (msg) { + onWorkerMessage({data: msg}); + }; + }).fail(function (jqxhr, settings, exception) { + console.error('Could not load worker.js'); + }); +} else { + // Wrap search in a web worker + var searchWorker = new Worker(joinUrl(base_url, "search/worker.js")); + searchWorker.postMessage({init: true}); + searchWorker.onmessage = onWorkerMessage; +} diff --git a/search/search_index.json b/search/search_index.json new file mode 100644 index 0000000..90118c8 --- /dev/null +++ b/search/search_index.json @@ -0,0 +1 @@ +{"config":{"indexing":"full","lang":["en"],"min_search_length":3,"prebuild_index":false,"separator":"[\\s\\-]+"},"docs":[{"location":"","text":"actinia-python-client Fork Me On GitHub Access actinia - The GRASS GIS REST API via Python. actinia-python-client is a Python library to access an actinia server easily via python. Installation Quickstart Location Management Mapset Management Raster, Vector, STRDS Management Process Chain Validation Processing","title":"actinia-python-client"},{"location":"#actinia-python-client","text":"Fork Me On GitHub Access actinia - The GRASS GIS REST API via Python. actinia-python-client is a Python library to access an actinia server easily via python. Installation Quickstart Location Management Mapset Management Raster, Vector, STRDS Management Process Chain Validation Processing","title":"actinia-python-client"},{"location":"02_installation/","text":"Installation You can install the actinia Python library via: pip3 install actinia-python-client For newest version see releases .","title":"Installation"},{"location":"02_installation/#installation","text":"You can install the actinia Python library via: pip3 install actinia-python-client For newest version see releases .","title":"Installation"},{"location":"03_quickstart/","text":"Quickstart Connecting actinia Python library with actinia from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() or connect to actinia-dev with version 3: from actinia import Actinia actinia_dev_mundialis = Actinia(\"https://actinia-dev.mundialis.de/\", \"v3\") actinia_dev_mundialis.get_version() Set authentication to get access to the actinia functionallity actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\")","title":"Quickstart"},{"location":"03_quickstart/#quickstart","text":"Connecting actinia Python library with actinia from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() or connect to actinia-dev with version 3: from actinia import Actinia actinia_dev_mundialis = Actinia(\"https://actinia-dev.mundialis.de/\", \"v3\") actinia_dev_mundialis.get_version() Set authentication to get access to the actinia functionallity actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\")","title":"Quickstart"},{"location":"04_location_management/","text":"Location Management With the location management the locations can be requested as well as information of each location. Also a location can be created and deleted if the user is permitted. First connecting actinia Python library with actinia and set authentication (Attention: The demouser is not permitted to create or delete a location!) from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") Get locations and locaton information of a special location: locations = actinia_mundialis.get_locations() print(locations.keys()) locations[\"nc_spm_08\"].get_info() # or actinia_mundialis.locations[\"nc_spm_08\"].get_info() Create a new location new_location = actinia_mundialis.create_location(\"test_location\", 25832) print(new_location.name) print(new_location.region) print([loc for loc in actinia_mundialis.locations]) Delete a location actinia_mundialis.locations[\"test_location\"].delete() print([loc for loc in actinia_mundialis.locations()])","title":"Location Management"},{"location":"04_location_management/#location-management","text":"With the location management the locations can be requested as well as information of each location. Also a location can be created and deleted if the user is permitted. First connecting actinia Python library with actinia and set authentication (Attention: The demouser is not permitted to create or delete a location!) from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\")","title":"Location Management"},{"location":"04_location_management/#get-locations-and-locaton-information-of-a-special-location","text":"locations = actinia_mundialis.get_locations() print(locations.keys()) locations[\"nc_spm_08\"].get_info() # or actinia_mundialis.locations[\"nc_spm_08\"].get_info()","title":"Get locations and locaton information of a special location:"},{"location":"04_location_management/#create-a-new-location","text":"new_location = actinia_mundialis.create_location(\"test_location\", 25832) print(new_location.name) print(new_location.region) print([loc for loc in actinia_mundialis.locations])","title":"Create a new location"},{"location":"04_location_management/#delete-a-location","text":"actinia_mundialis.locations[\"test_location\"].delete() print([loc for loc in actinia_mundialis.locations()])","title":"Delete a location"},{"location":"05_mapset_managment/","text":"Mapset Management With the mapset management the mapsets of a specified location can be requested as well as information of each mapset. Also a mapsest can be created and deleted if the user is permitted. First connecting actinia Python library with actinia and set authentication (Attention: The demouser is not permitted to create or delete a mapset!) from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations() Get Mapsets of Specified Location Get mapsets of the nc_spm_08 location: mapsets = actinia_mundialis.locations[\"nc_spm_08\"].get_mapsets() print(mapsets.keys()) Create and delete Mapset in Specified Location Create test_mapset in nc_spm_08 location: mapset_name = \"test_mapset\" locations[\"nc_spm_08\"].create_mapset(mapset_name) print(mapsets.keys()) Delete test_mapset mapset: locations[\"nc_spm_08\"].delete_mapset(mapset_name) print(mapsets.keys())","title":"Mapset Management"},{"location":"05_mapset_managment/#mapset-management","text":"With the mapset management the mapsets of a specified location can be requested as well as information of each mapset. Also a mapsest can be created and deleted if the user is permitted. First connecting actinia Python library with actinia and set authentication (Attention: The demouser is not permitted to create or delete a mapset!) from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations()","title":"Mapset Management"},{"location":"05_mapset_managment/#get-mapsets-of-specified-location","text":"Get mapsets of the nc_spm_08 location: mapsets = actinia_mundialis.locations[\"nc_spm_08\"].get_mapsets() print(mapsets.keys())","title":"Get Mapsets of Specified Location"},{"location":"05_mapset_managment/#create-and-delete-mapset-in-specified-location","text":"Create test_mapset in nc_spm_08 location: mapset_name = \"test_mapset\" locations[\"nc_spm_08\"].create_mapset(mapset_name) print(mapsets.keys()) Delete test_mapset mapset: locations[\"nc_spm_08\"].delete_mapset(mapset_name) print(mapsets.keys())","title":"Create and delete Mapset in Specified Location"},{"location":"06_raster_vector_strds_managment/","text":"Raster, Vector and STRDS Management from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations() # Get Mapsets of nc_spm_08 location mapsets = actinia_mundialis.locations[\"nc_spm_08\"].get_mapsets() Raster manangement Get all rasters of the PERMANENT mapsets rasters = mapsets[\"PERMANENT\"].get_raster_layers() print(rasters.keys()) Get information of the raster zipcodes info = rasters[\"zipcodes\"].get_info() Upload a GTif as raster layer to a user mapset (here the user mapset will be created before) mapset_name = \"test_mapset\" # mapset creation locations[\"nc_spm_08\"].create_mapset(mapset_name) # upload tif raster_layer_name = \"test\" file = \"/home/testuser/data/elevation.tif\" locations[\"nc_spm_08\"].mapsets[mapset_name].upload_raster(raster_layer_name, file) print(locations[\"nc_spm_08\"].mapsets[mapset_name].raster_layers.keys()) Delete a raster layer locations[\"nc_spm_08\"].mapsets[mapset_name].delete_raster(raster_layer_name) print(locations[\"nc_spm_08\"].mapsets[mapset_name].raster_layers.keys()) # delete mapset locations[\"nc_spm_08\"].delete_mapset(mapset_name) Vector management Get all vector maps of the PERMANENT mapsets vectors = mapsets[\"PERMANENT\"].get_vector_layers() print(vectors.keys()) Get information of the vector boundary_county info = vectors[\"boundary_county\"].get_info() Upload a GeoJSON as vector layer to a user mapset (here the user mapset will be created before) mapset_name = \"test_mapset\" # mapset creation locations[\"nc_spm_08\"].create_mapset(mapset_name) # upload tif vector_layer_name = \"test\" file = \"/home/testuser/data/firestations.geojson\" locations[\"nc_spm_08\"].mapsets[mapset_name].upload_vector(vector_layer_name, file) print(locations[\"nc_spm_08\"].mapsets[mapset_name].vector_layers.keys()) Delete a raster layer locations[\"nc_spm_08\"].mapsets[mapset_name].delete_vector(vector_layer_name) print(locations[\"nc_spm_08\"].mapsets[mapset_name].vector_layers.keys()) # delete mapset locations[\"nc_spm_08\"].delete_mapset(mapset_name)","title":"Raster, Vector and STRDS Management"},{"location":"06_raster_vector_strds_managment/#raster-vector-and-strds-management","text":"from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations() # Get Mapsets of nc_spm_08 location mapsets = actinia_mundialis.locations[\"nc_spm_08\"].get_mapsets()","title":"Raster, Vector and STRDS Management"},{"location":"06_raster_vector_strds_managment/#raster-manangement","text":"Get all rasters of the PERMANENT mapsets rasters = mapsets[\"PERMANENT\"].get_raster_layers() print(rasters.keys()) Get information of the raster zipcodes info = rasters[\"zipcodes\"].get_info() Upload a GTif as raster layer to a user mapset (here the user mapset will be created before) mapset_name = \"test_mapset\" # mapset creation locations[\"nc_spm_08\"].create_mapset(mapset_name) # upload tif raster_layer_name = \"test\" file = \"/home/testuser/data/elevation.tif\" locations[\"nc_spm_08\"].mapsets[mapset_name].upload_raster(raster_layer_name, file) print(locations[\"nc_spm_08\"].mapsets[mapset_name].raster_layers.keys()) Delete a raster layer locations[\"nc_spm_08\"].mapsets[mapset_name].delete_raster(raster_layer_name) print(locations[\"nc_spm_08\"].mapsets[mapset_name].raster_layers.keys()) # delete mapset locations[\"nc_spm_08\"].delete_mapset(mapset_name)","title":"Raster manangement"},{"location":"06_raster_vector_strds_managment/#vector-management","text":"Get all vector maps of the PERMANENT mapsets vectors = mapsets[\"PERMANENT\"].get_vector_layers() print(vectors.keys()) Get information of the vector boundary_county info = vectors[\"boundary_county\"].get_info() Upload a GeoJSON as vector layer to a user mapset (here the user mapset will be created before) mapset_name = \"test_mapset\" # mapset creation locations[\"nc_spm_08\"].create_mapset(mapset_name) # upload tif vector_layer_name = \"test\" file = \"/home/testuser/data/firestations.geojson\" locations[\"nc_spm_08\"].mapsets[mapset_name].upload_vector(vector_layer_name, file) print(locations[\"nc_spm_08\"].mapsets[mapset_name].vector_layers.keys()) Delete a raster layer locations[\"nc_spm_08\"].mapsets[mapset_name].delete_vector(vector_layer_name) print(locations[\"nc_spm_08\"].mapsets[mapset_name].vector_layers.keys()) # delete mapset locations[\"nc_spm_08\"].delete_mapset(mapset_name)","title":"Vector management"},{"location":"07_process_chain_validation/","text":"Process Chain Validation A process chain can be validated before a job is started. First connecting actinia Python library with actinia and set authentication: from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations() Synchronous process chain validation pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"elevation=42\" } ] } ], \"version\": \"1\" } pc = {\"list\": [{\"id\": \"r_mapcalc\",\"module\": \"r.mapcalc\",\"inputs\": [{\"param\": \"expression\",\"value\": \"elevation=42\"}]}],\"version\": \"1\"} actinia_mundialis.locations[\"nc_spm_08\"].validate_process_chain_sync(pc) Asynchronous process chain validation: pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"elevation=42\" } ] } ], \"version\": \"1\" } pc = {\"list\": [{\"id\": \"r_mapcalc\",\"module\": \"r.mapcalc\",\"inputs\": [{\"param\": \"expression\",\"value\": \"elevation=42\"}]}],\"version\": \"1\"} val_job = actinia_mundialis.locations[\"nc_spm_08\"].validate_process_chain_async(pc) val_job.poll_until_finished() print(val_job.status) print(val_job.message)","title":"Process Chain Validation"},{"location":"07_process_chain_validation/#process-chain-validation","text":"A process chain can be validated before a job is started. First connecting actinia Python library with actinia and set authentication: from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations()","title":"Process Chain Validation"},{"location":"07_process_chain_validation/#synchronous-process-chain-validation","text":"pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"elevation=42\" } ] } ], \"version\": \"1\" } pc = {\"list\": [{\"id\": \"r_mapcalc\",\"module\": \"r.mapcalc\",\"inputs\": [{\"param\": \"expression\",\"value\": \"elevation=42\"}]}],\"version\": \"1\"} actinia_mundialis.locations[\"nc_spm_08\"].validate_process_chain_sync(pc)","title":"Synchronous process chain validation"},{"location":"07_process_chain_validation/#asynchronous-process-chain-validation","text":"pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"elevation=42\" } ] } ], \"version\": \"1\" } pc = {\"list\": [{\"id\": \"r_mapcalc\",\"module\": \"r.mapcalc\",\"inputs\": [{\"param\": \"expression\",\"value\": \"elevation=42\"}]}],\"version\": \"1\"} val_job = actinia_mundialis.locations[\"nc_spm_08\"].validate_process_chain_async(pc) val_job.poll_until_finished() print(val_job.status) print(val_job.message)","title":"Asynchronous process chain validation:"},{"location":"08_processing/","text":"Processing Start a processing job with a valid process chain. First connect actinia Python library with actinia and set authentication: from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations() Ephemeral Processing Start an ephemeral processing job pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"baum=5\" } ] } ], \"version\": \"1\" } job = actinia_mundialis.locations[\"nc_spm_08\"].create_processing_export_job(pc, \"test\") job.poll_until_finished() print(job.status) print(job.message) Persistent Processing Start a persistent processing job pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"baum=5\" } ] } ], \"version\": \"1\" } # create user mapset (persistent processing can only be done in a user mapset) mapset_name = \"test_mapset\" locations[\"nc_spm_08\"].create_mapset(mapset_name) # create job job = locations[\"nc_spm_08\"].mapsets[mapset_name].create_processing_job(pc, \"test\") job.poll_until_finished() print(job.status) print(job.message) # print rasters in \"test_mapset\" rasters = locations[\"nc_spm_08\"].mapsets[mapset_name].get_raster_layers() print(rasters.keys()) # delete user mapset locations[\"nc_spm_08\"].delete_mapset(mapset_name) print(locations[\"nc_spm_08\"].mapsets.keys())","title":"Processing"},{"location":"08_processing/#processing","text":"Start a processing job with a valid process chain. First connect actinia Python library with actinia and set authentication: from actinia import Actinia actinia_mundialis = Actinia() actinia_mundialis.get_version() actinia_mundialis.set_authentication(\"demouser\", \"gu3st!pa55w0rd\") # request all locations locations = actinia_mundialis.get_locations()","title":"Processing"},{"location":"08_processing/#ephemeral-processing","text":"Start an ephemeral processing job pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"baum=5\" } ] } ], \"version\": \"1\" } job = actinia_mundialis.locations[\"nc_spm_08\"].create_processing_export_job(pc, \"test\") job.poll_until_finished() print(job.status) print(job.message)","title":"Ephemeral Processing"},{"location":"08_processing/#persistent-processing","text":"Start a persistent processing job pc = { \"list\": [ { \"id\": \"r_mapcalc\", \"module\": \"r.mapcalc\", \"inputs\": [ { \"param\": \"expression\", \"value\": \"baum=5\" } ] } ], \"version\": \"1\" } # create user mapset (persistent processing can only be done in a user mapset) mapset_name = \"test_mapset\" locations[\"nc_spm_08\"].create_mapset(mapset_name) # create job job = locations[\"nc_spm_08\"].mapsets[mapset_name].create_processing_job(pc, \"test\") job.poll_until_finished() print(job.status) print(job.message) # print rasters in \"test_mapset\" rasters = locations[\"nc_spm_08\"].mapsets[mapset_name].get_raster_layers() print(rasters.keys()) # delete user mapset locations[\"nc_spm_08\"].delete_mapset(mapset_name) print(locations[\"nc_spm_08\"].mapsets.keys())","title":"Persistent Processing"}]} \ No newline at end of file diff --git a/search/worker.js b/search/worker.js new file mode 100644 index 0000000..8628dbc --- /dev/null +++ b/search/worker.js @@ -0,0 +1,133 @@ +var base_path = 'function' === typeof importScripts ? '.' : '/search/'; +var allowSearch = false; +var index; +var documents = {}; +var lang = ['en']; +var data; + +function getScript(script, callback) { + console.log('Loading script: ' + script); + $.getScript(base_path + script).done(function () { + callback(); + }).fail(function (jqxhr, settings, exception) { + console.log('Error: ' + exception); + }); +} + +function getScriptsInOrder(scripts, callback) { + if (scripts.length === 0) { + callback(); + return; + } + getScript(scripts[0], function() { + getScriptsInOrder(scripts.slice(1), callback); + }); +} + +function loadScripts(urls, callback) { + if( 'function' === typeof importScripts ) { + importScripts.apply(null, urls); + callback(); + } else { + getScriptsInOrder(urls, callback); + } +} + +function onJSONLoaded () { + data = JSON.parse(this.responseText); + var scriptsToLoad = ['lunr.js']; + if (data.config && data.config.lang && data.config.lang.length) { + lang = data.config.lang; + } + if (lang.length > 1 || lang[0] !== "en") { + scriptsToLoad.push('lunr.stemmer.support.js'); + if (lang.length > 1) { + scriptsToLoad.push('lunr.multi.js'); + } + if (lang.includes("ja") || lang.includes("jp")) { + scriptsToLoad.push('tinyseg.js'); + } + for (var i=0; i < lang.length; i++) { + if (lang[i] != 'en') { + scriptsToLoad.push(['lunr', lang[i], 'js'].join('.')); + } + } + } + loadScripts(scriptsToLoad, onScriptsLoaded); +} + +function onScriptsLoaded () { + console.log('All search scripts loaded, building Lunr index...'); + if (data.config && data.config.separator && data.config.separator.length) { + lunr.tokenizer.separator = new RegExp(data.config.separator); + } + + if (data.index) { + index = lunr.Index.load(data.index); + data.docs.forEach(function (doc) { + documents[doc.location] = doc; + }); + console.log('Lunr pre-built index loaded, search ready'); + } else { + index = lunr(function () { + if (lang.length === 1 && lang[0] !== "en" && lunr[lang[0]]) { + this.use(lunr[lang[0]]); + } else if (lang.length > 1) { + this.use(lunr.multiLanguage.apply(null, lang)); // spread operator not supported in all browsers: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_operator#Browser_compatibility + } + this.field('title'); + this.field('text'); + this.ref('location'); + + for (var i=0; i < data.docs.length; i++) { + var doc = data.docs[i]; + this.add(doc); + documents[doc.location] = doc; + } + }); + console.log('Lunr index built, search ready'); + } + allowSearch = true; + postMessage({config: data.config}); + postMessage({allowSearch: allowSearch}); +} + +function init () { + var oReq = new XMLHttpRequest(); + oReq.addEventListener("load", onJSONLoaded); + var index_path = base_path + '/search_index.json'; + if( 'function' === typeof importScripts ){ + index_path = 'search_index.json'; + } + oReq.open("GET", index_path); + oReq.send(); +} + +function search (query) { + if (!allowSearch) { + console.error('Assets for search still loading'); + return; + } + + var resultDocuments = []; + var results = index.search(query); + for (var i=0; i < results.length; i++){ + var result = results[i]; + doc = documents[result.ref]; + doc.summary = doc.text.substring(0, 200); + resultDocuments.push(doc); + } + return resultDocuments; +} + +if( 'function' === typeof importScripts ) { + onmessage = function (e) { + if (e.data.init) { + init(); + } else if (e.data.query) { + postMessage({ results: search(e.data.query) }); + } else { + console.error("Worker - Unrecognized message: " + e); + } + }; +} diff --git a/sitemap.xml b/sitemap.xml new file mode 100644 index 0000000..6b0b972 --- /dev/null +++ b/sitemap.xml @@ -0,0 +1,43 @@ + +