{"_id":"583c619c1210131900a109e6","user":"55fae9d4825d5f19001fa379","__v":0,"parentDoc":null,"version":{"_id":"55faeacad0e22017005b8268","project":"55faeacad0e22017005b8265","__v":32,"createdAt":"2015-09-17T16:31:06.800Z","releaseDate":"2015-09-17T16:31:06.800Z","categories":["55faeacbd0e22017005b8269","55faf550764f50210095078e","55faf5b5626c341700fd9e96","55faf8a7825d5f19001fa386","560052f91503430d007cc88f","560054f73aa0520d00da0b1a","56005aaf6932a00d00ba7c62","56005c273aa0520d00da0b3f","5601ae7681a9670d006d164d","5601ae926811d00d00ceb487","5601aeb064866b1900f4768d","5601aee850ee460d0002224c","5601afa02499c119000faf19","5601afd381a9670d006d1652","561d4c78281aec0d00eb27b6","561d588d8ca8b90d00210219","563a5f934cc3621900ac278c","5665c5763889610d0008a29e","566710a36819320d000c2e93","56ddf6df8a5ae10e008e3926","56e1c96b2506700e00de6e83","56e1ccc4e416450e00b9e48c","56e1ccdfe63f910e00e59870","56e1cd10bc46be0e002af26a","56e1cd21e416450e00b9e48e","56e3139a51857d0e008e77be","573b4f62ef164e2900a2b881","57c9d1335fd8ca0e006308ed","57e2bd9d1e7b7220000d7fa5","57f2b992ac30911900c7c2b6","58adb5c275df0f1b001ed59b","58c81b5c6dc7140f003c3c46"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"v1","version_clean":"1.0.0","version":"1"},"category":{"_id":"573b4f62ef164e2900a2b881","__v":0,"project":"55faeacad0e22017005b8265","version":"55faeacad0e22017005b8268","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-05-17T17:05:38.443Z","from_sync":false,"order":6,"slug":"algorithm-guide","title":"Certified Algorithms"},"project":"55faeacad0e22017005b8265","updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-11-28T16:55:56.766Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":16,"body":"## Table of Contents\n\nSection | Description\n--- | ---\n[Example Output](#Example Output) | An example of the task's output\n[Quickstart](#Quickstart) | Get started with a Python-based quickstart tutorial\n[Task Runtime](#Task Runtime) | Benchmark runtimes for the algorithm\n[Input Options](#Input Options) | Required and optional task inputs\n[Outputs](#Outputs) | Task outputs and example contents\n[Advanced Options](#Advanced Options) | Additional information for advanced users\n[Known Issues](#Known Issues) | Issues users should be aware of\n\n\n## <a name=\"Example Output\"></a>Example Output\nThe output of this task is a string. For descriptions of the output string data, see \"Data Structure for Expected Outputs\" in the [Outputs](#Outputs) section.\n\n\n\n## <a name=\"Quickstart\"></a>Quickstart Tutorial\nExample Script: Run in a python environment (i.e. - IPython) using the gbdxtools interface.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"from gbdxtools import Interface\\ngbdx = Interface()\\n\\nenvi = gbdx.Task(\\\"ENVI_GetSpectrumFromLibrary\\\")\\nenvi.inputs.input_spectral_library_filename = 'veg_2grn.sli'\\nenvi.inputs.spectrum_name = 'Dry Grass' # example from Spectral Index veg_2grn.sli\\n\\nworkflow = gbdx.Workflow([ getspectrum ])\\n\\t\\nworkflow.savedata(\\n    envi.outputs.task_meta_data,\\n    location=location='GetSpecLib/task_meta_data'\\n)\\n\\nprint workflow.execute()\\nprint workflow.status\\n# Repeat workflow.status as needed to monitor progress.\",\n      \"language\": \"python\"\n    }\n  ]\n}\n[/block]\n## <a name=\"Task Runtime\"></a>Task Runtime\nThere are no runtime bench marks for this task.\n\n\n## <a name=\"Input Options\"></a>Input Options\nThe following table lists all inputs for this task. For details regarding the use of all ENVI input types refer to the [ENVI Task Runner Inputs]([See ENVIRASTER input type](https://github.com/TDG-Platform/docs/blob/master/ENVI_Task_Runner_Inputs.md)) documentation.\n\n| Name                            | Required | Default |               Valid Values               | Description                              |\n| ------------------------------- | :------: | :-----: | :--------------------------------------: | ---------------------------------------- |\n| input_spectral_library          |  False   |  None   |              A valid S3 URL              | Specify a spectral library from which to retrieve a particular spectrum. This may be an ENVI library or a library that you have uploaded.  It is required if you are using a custom library. — Value Type: [ENVISPECTRALLIBRARY](https://github.com/TDG-Platform/docs/blob/master/ENVI_Task_Runner_Inputs.md#envispectrallibrary) |\n| input_spectral_library_filename |  False   |  None   | string name (see ENVI software for available libraries) | String name of the ENVI spectral library file .sli -- Value Type: STRING [(See Task Runner details)](https://github.com/TDG-Platform/docs/blob/master/ENVI_Task_Runner_Inputs.md#envispectrallibrary) |\n| spectrum_name                   |   True   |   N/A   |                  string                  | Provide a string with the material spectrum to be retreived. |\n\n\n\n## <a name=\"Outputs\"></a>Outputs\n\nThe following table lists all the tasks outputs.\n\n| Name                     | Required | Description                              |\n| ------------------------ | :------: | ---------------------------------------- |\n| task_meta_data           |  False   | GBDX Option. Output location for task meta data such as execution log and output JSON. |\n| wavelengths              |   True   | A double array representing the wavelength values of the spectrum. -- Value Type: DOUBLE[*] |\n| wavelength_units         |   True   | A string representing the wavelength units of the spectrum. -- Value Type: STRING |\n| y_range                  |   True   | The range of spectrum values. -- Value Type: DOUBLE[*] |\n| spectrum                 |   True   | A double array representing the spectrum that matches the input spectrum name. -- Value Type: DOUBLE[*] |\n| reflectance_scale_factor |   True   | Scale factor to be used in converting spectra to reflectance. -- Value Type: DOUBLE |\n\n##### Output Structure\n\nThe output are string values that can be passed to another chained task. The values are also written to an `output.json` in the `task_meta_data` port. \n\n## <a name=\"Advanced Options\"></a>Advanced Options\nThe advanced script for this task demonstrates loading your own spectrum data to run the task. The Advanced Script example uses the ENVI  *\"veg_1dry.sli\"* spectral index file and the *CDE054: Pinyon Pine (SAP)* spectrum. If you use your own spectral data, and it is a .sli file, you must create an \"HDR\" file.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"from gbdxtools import Interface\\ngbdx = Interface()\\n\\n# Ikonos\\nwavelengths = '[480.00000, 552.00000, 666.00000, 803.00000]'\\nwavelength_units = 'Nanometers'\\n\\ngetspec = gbdx.Task(\\\"ENVI_GetSpectrumFromLibrary\\\")\\ngetspec.input_spectral_library_filename = \\\"veg_1dry.sli\\\"\\ngetspec.inputs.input_spectral_library = \\ngetspec.inputs.spectrum_name = \\\"CDE054: Pinyon Pine (SAP)\\\"\\n\\nresample = gbdx.Task(\\\"ENVI_ResampleSpectrum\\\")\\nresample.inputs.input_spectrum = task1.outputs.spectrum.value\\nresample.inputs.input_wavelengths = task1.outputs.wavelengths.value\\nresample.inputs.input_wavelength_units = task1.outputs.wavelength_units.value\\nresample.inputs.resample_wavelengths = wavelengths\\nresample.inputs.resample_wavelength_units = wavelength_units\\n\\nworkflow = gbdx.Workflow([ getspec, resample ])\\n\\nworkflow.savedata(\\n    resample.outputs.task_meta_data, \\n    location='GetSpecLib/task_meta_data'\\n)\\n\\nprint workflow.execute()\\nprint workflow.status\\n# Repeat workflow.status as needed to monitor progress.\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n##<a name=\"Known Issues\"></a>Known Issues\nNone at this time.\n\n##Background \nFor additional background information on this task please refer to the <a href=\"http://www.harrisgeospatial.com/docs/home.html\">Harris Geospatial ENVI documentation.</a>​\n\n\n\n#### Contact Us   \nIf you have any questions or issues with this task, please contact [**gbdx-support:::at:::digitalglobe.com** ](mailto:gbdx-support@digitalglobe.com).","excerpt":"This task retrieves the details of a specified material from a spectral library.\n\t\n**GBDX Registered Name:** ENVI_GetSpectrumFromLibrary\n**Provider:** Harris\tGeospatial Solutions\nFor more information on how to execute this task please refer to the [ENVI® Task Runner Inputs](doc:envi-task-runner-inputs) .","slug":"envi-get-spectrum-from-library","type":"basic","title":"ENVI® Get Spectrum from Library"}

ENVI® Get Spectrum from Library

This task retrieves the details of a specified material from a spectral library. **GBDX Registered Name:** ENVI_GetSpectrumFromLibrary **Provider:** Harris Geospatial Solutions For more information on how to execute this task please refer to the [ENVI® Task Runner Inputs](doc:envi-task-runner-inputs) .

## Table of Contents Section | Description --- | --- [Example Output](#Example Output) | An example of the task's output [Quickstart](#Quickstart) | Get started with a Python-based quickstart tutorial [Task Runtime](#Task Runtime) | Benchmark runtimes for the algorithm [Input Options](#Input Options) | Required and optional task inputs [Outputs](#Outputs) | Task outputs and example contents [Advanced Options](#Advanced Options) | Additional information for advanced users [Known Issues](#Known Issues) | Issues users should be aware of ## <a name="Example Output"></a>Example Output The output of this task is a string. For descriptions of the output string data, see "Data Structure for Expected Outputs" in the [Outputs](#Outputs) section. ## <a name="Quickstart"></a>Quickstart Tutorial Example Script: Run in a python environment (i.e. - IPython) using the gbdxtools interface. [block:code] { "codes": [ { "code": "from gbdxtools import Interface\ngbdx = Interface()\n\nenvi = gbdx.Task(\"ENVI_GetSpectrumFromLibrary\")\nenvi.inputs.input_spectral_library_filename = 'veg_2grn.sli'\nenvi.inputs.spectrum_name = 'Dry Grass' # example from Spectral Index veg_2grn.sli\n\nworkflow = gbdx.Workflow([ getspectrum ])\n\t\nworkflow.savedata(\n envi.outputs.task_meta_data,\n location=location='GetSpecLib/task_meta_data'\n)\n\nprint workflow.execute()\nprint workflow.status\n# Repeat workflow.status as needed to monitor progress.", "language": "python" } ] } [/block] ## <a name="Task Runtime"></a>Task Runtime There are no runtime bench marks for this task. ## <a name="Input Options"></a>Input Options The following table lists all inputs for this task. For details regarding the use of all ENVI input types refer to the [ENVI Task Runner Inputs]([See ENVIRASTER input type](https://github.com/TDG-Platform/docs/blob/master/ENVI_Task_Runner_Inputs.md)) documentation. | Name | Required | Default | Valid Values | Description | | ------------------------------- | :------: | :-----: | :--------------------------------------: | ---------------------------------------- | | input_spectral_library | False | None | A valid S3 URL | Specify a spectral library from which to retrieve a particular spectrum. This may be an ENVI library or a library that you have uploaded. It is required if you are using a custom library. — Value Type: [ENVISPECTRALLIBRARY](https://github.com/TDG-Platform/docs/blob/master/ENVI_Task_Runner_Inputs.md#envispectrallibrary) | | input_spectral_library_filename | False | None | string name (see ENVI software for available libraries) | String name of the ENVI spectral library file .sli -- Value Type: STRING [(See Task Runner details)](https://github.com/TDG-Platform/docs/blob/master/ENVI_Task_Runner_Inputs.md#envispectrallibrary) | | spectrum_name | True | N/A | string | Provide a string with the material spectrum to be retreived. | ## <a name="Outputs"></a>Outputs The following table lists all the tasks outputs. | Name | Required | Description | | ------------------------ | :------: | ---------------------------------------- | | task_meta_data | False | GBDX Option. Output location for task meta data such as execution log and output JSON. | | wavelengths | True | A double array representing the wavelength values of the spectrum. -- Value Type: DOUBLE[*] | | wavelength_units | True | A string representing the wavelength units of the spectrum. -- Value Type: STRING | | y_range | True | The range of spectrum values. -- Value Type: DOUBLE[*] | | spectrum | True | A double array representing the spectrum that matches the input spectrum name. -- Value Type: DOUBLE[*] | | reflectance_scale_factor | True | Scale factor to be used in converting spectra to reflectance. -- Value Type: DOUBLE | ##### Output Structure The output are string values that can be passed to another chained task. The values are also written to an `output.json` in the `task_meta_data` port. ## <a name="Advanced Options"></a>Advanced Options The advanced script for this task demonstrates loading your own spectrum data to run the task. The Advanced Script example uses the ENVI *"veg_1dry.sli"* spectral index file and the *CDE054: Pinyon Pine (SAP)* spectrum. If you use your own spectral data, and it is a .sli file, you must create an "HDR" file. [block:code] { "codes": [ { "code": "from gbdxtools import Interface\ngbdx = Interface()\n\n# Ikonos\nwavelengths = '[480.00000, 552.00000, 666.00000, 803.00000]'\nwavelength_units = 'Nanometers'\n\ngetspec = gbdx.Task(\"ENVI_GetSpectrumFromLibrary\")\ngetspec.input_spectral_library_filename = \"veg_1dry.sli\"\ngetspec.inputs.input_spectral_library = \ngetspec.inputs.spectrum_name = \"CDE054: Pinyon Pine (SAP)\"\n\nresample = gbdx.Task(\"ENVI_ResampleSpectrum\")\nresample.inputs.input_spectrum = task1.outputs.spectrum.value\nresample.inputs.input_wavelengths = task1.outputs.wavelengths.value\nresample.inputs.input_wavelength_units = task1.outputs.wavelength_units.value\nresample.inputs.resample_wavelengths = wavelengths\nresample.inputs.resample_wavelength_units = wavelength_units\n\nworkflow = gbdx.Workflow([ getspec, resample ])\n\nworkflow.savedata(\n resample.outputs.task_meta_data, \n location='GetSpecLib/task_meta_data'\n)\n\nprint workflow.execute()\nprint workflow.status\n# Repeat workflow.status as needed to monitor progress.", "language": "json" } ] } [/block] ##<a name="Known Issues"></a>Known Issues None at this time. ##Background For additional background information on this task please refer to the <a href="http://www.harrisgeospatial.com/docs/home.html">Harris Geospatial ENVI documentation.</a>​ #### Contact Us If you have any questions or issues with this task, please contact [**gbdx-support@digitalglobe.com** ](mailto:gbdx-support@digitalglobe.com).