520 Rate this article:
No rating

ENVI 5.4: ENVITASK schema change

If you had a task with ENVI 5.3.1 and you try to run it with ENVI 5.4, you encounter the following error message:

Error: ENVITASK: Invalid task definition: Task template missing required "schema" attribute

The reason this error is occurring is because the schema was changed between ENVI 5.3.1 and ENVI 5.4. To fix this issue, you need to add a line that says "version":"5.3" to the ".task" file associated with the older tasks. The reason you need to add '"version":"5.3"' to the task file is to tell ENVI 5.4 that this is a task is going to use ENVI 5.3 syntax.  

For example, the ".task" file below would work with ENVI 5.3.1: 

{
  "name": "BandMathExample",
  "baseClass": "ENVITaskFromProcedure",
  "routine": "bandmathexample",
  "displayName": "ENVI Band Math Example",
  "description": "This is an example of a custom task that performs band math on two rasters.",
  "parameters":[
    {
      "name": "INPUT_RASTER1",
      "displayName": "Input Raster 1",
      "dataType": "ENVIRASTER",
      "direction": "input",
      "parameterType": "required",
      "description": "Specify the first raster on which to perform band math. This raster is used to determine data type on output."
    },
    {
      "name": "INPUT_RASTER2",
      "displayName": "Input Raster 2",
      "dataType": "ENVIRASTER",
      "direction": "input",
      "parameterType": "required",
      "description": "Specify a second raster on which to perform band math."
    },
    {
      "name": "OUTPUT_RASTER",
      "displayName": "Output Raster",
      "dataType": "ENVIRASTER",
      "direction": "output",
      "parameterType": "required",
      "description": "This is a reference to the output raster of filetype ENVI."
    }
  ]
}

 


To get the ".task" file to work with ENVI 5.4, the file would need to be changed to the following:


{

  "name": "BandMathExample",
  "version":"5.3",
  "baseClass": "ENVITaskFromProcedure",
  "routine": "bandmathexample",
  "displayName": "ENVI Band Math Example",
  "description": "This is an example of a custom task that performs band math on two rasters.",
  "parameters":[
    {
      "name": "INPUT_RASTER1",
      "displayName": "Input Raster 1",
      "dataType": "ENVIRASTER",
      "direction": "input",
      "parameterType": "required",
      "description": "Specify the first raster on which to perform band math. This raster is used to determine data type on output."
    },
    {
      "name": "INPUT_RASTER2",
      "displayName": "Input Raster 2",
      "dataType": "ENVIRASTER",
      "direction": "input",
      "parameterType": "required",
      "description": "Specify a second raster on which to perform band math."
    },
    {
      "name": "OUTPUT_RASTER",
      "displayName": "Output Raster",
      "dataType": "ENVIRASTER",
      "direction": "output",
      "parameterType": "required",
      "description": "This is a reference to the output raster of filetype ENVI."
    }
  ]
 }




Written by DS 12/5/2016 Reviewed by MM

Please login or register to post comments.