X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 17 May 2019 12:47 AM by  Anna Wojtowicz-Nowakowska
NNDiffuse Pan Sharpening error
 6 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Anna Wojtowicz-Nowakowska



New Member


Posts:9
New Member


--
16 May 2019 03:47 AM
    I try to do a big model with whole workflow of pre-procesing and I can not connect PanSharpening with Dark Substraction Correction.

    My model looks like bellow:

    multispectral rasters -> iterator -> radiometric calibration -> raster statistic -> dark substraction correction ->agregator -> iterator -> NNDiffuse PS
    -> ->

    panchromaticl rasters -> iterator -> radiometric calibration -> raster statistic -> dark substraction correction ->agregator -> Extract Element -> NNDiffuse PS
    -> ->

    This both model are connecting by NNDiffuse Pan Sharpening.
    But when I run model I get the error: "Parameter INPUT_HIGH_RESOLUTION_RASTER faild validation: Value must be a scalar ENVIRaster".

    Could you please help me with this?

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    16 May 2019 05:09 AM
    "Value must be a scalar ENVIRaster"
    Do a print statement on the result of this raster - does it return an array? It must be a scalar.

    Anna Wojtowicz-Nowakowska



    New Member


    Posts:9
    New Member


    --
    16 May 2019 05:50 AM
    So what I have to do with my model in this particular case?

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    16 May 2019 07:14 AM
    You have to pass a single raster rather than an array. So, if you want to pass the first raster of an array of rasters:

    input_raster=raster[0]

    or similar depending on what your raster object returns.

    Anna Wojtowicz-Nowakowska



    New Member


    Posts:9
    New Member


    --
    16 May 2019 07:51 AM
    Yes, I understand. But I don't use IDL, I know only modeler.
    I have to use iterator and Extract Element because I have 10 multi spectral raster after DOS and 10 panchromatic after DOS too.
    I don't have a problem when I process two different models: one for DOS and one for pan sharpening. But I would like to combine these in one model and run everything once.

    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    16 May 2019 09:46 AM
    Yes, you need to use Extract Bands from Raster to extract one of the rasters from your open raster. However you will need to figure out exactly what you are passing. Why is a multiband high resolution raster passed to this routine? Did you stack them into a file?

    Anna Wojtowicz-Nowakowska



    New Member


    Posts:9
    New Member


    --
    17 May 2019 12:47 AM
    I made separate models for the Dark Subtraction model, separately for multispectral and panchromatic bands. Now I would like to combine these models into one and add NNDiffuse PS functions to it.
    I don't have a problem when I process two different models: one for DOS and one for pan sharpening. But I would like to combine these in one model and run everything once.
    I think that the issue is caused by the Aggregator and Extract Elements From Array. But I don't know how to change it.
    Still I get the error: "Parameter INPUT_HIGH_RESOLUTION_RASTER faild validation: Value must be a scalar ENVIRaster".

    In IDL the model looks like below:

    ; -----------------------------
    ; Generated by the ENVI Modeler
    ; ENVI 5.5.1, API 3.3
    ; -----------------------------
    pro MyProgram
    compile_opt idl2, hidden
    on_error, 2

    aggregator_1 = Dictionary()
    list_aggregator_1 = List()

    aggregator_2 = Dictionary()
    list_aggregator_2 = List()

    ; --------
    ; Iterator
    ; --------
    foreach iterator_2, raster_2, iterator_2_index do begin

    ; -----------------
    ; Generate Filename
    ; -----------------
    task_8 = ENVITask('GenerateFilename')
    task_8.number = iterator_2_index
    task_8.directory = "C:\"
    task_8.prefix = 'DSM_PAN_'
    task_8.random = !false
    task_8.Execute

    ; -----------------------
    ; Radiometric Calibration
    ; -----------------------
    task_5 = ENVITask('RadiometricCalibration')
    task_5.input_raster = iterator_2
    task_5.Execute

    ; -----------------
    ; Raster Statistics
    ; -----------------
    task_6 = ENVITask('RasterStatistics')
    task_6.input_raster = task_5.output_raster
    task_6.Execute

    ; ---------------------------
    ; Dark Subtraction Correction
    ; ---------------------------
    task_7 = ENVITask('DarkSubtractionCorrection')
    task_7.values = task_6.min
    task_7.input_raster = task_5.output_raster
    task_7.output_raster_uri = task_8.output_filename
    task_7.Execute

    ; ----------
    ; Aggregator
    ; ----------
    list_aggregator_2.Add, task_7.output_raster, /EXTRACT
    aggregator_2.output = list_aggregator_2

    endforeach

    ; --------
    ; Iterator
    ; --------
    foreach iterator_1, raster_1, iterator_1_index do begin

    ; -----------------
    ; Generate Filename
    ; -----------------
    task_4 = ENVITask('GenerateFilename')
    task_4.number = iterator_1_index
    task_4.directory = "C:\"
    task_4.prefix = 'DSM_'
    task_4.random = !false
    task_4.Execute

    ; -----------------------
    ; Radiometric Calibration
    ; -----------------------
    task_1 = ENVITask('RadiometricCalibration')
    task_1.input_raster = iterator_1
    task_1.Execute

    ; -----------------
    ; Raster Statistics
    ; -----------------
    task_2 = ENVITask('RasterStatistics')
    task_2.input_raster = task_1.output_raster
    task_2.Execute

    ; ---------------------------
    ; Dark Subtraction Correction
    ; ---------------------------
    task_3 = ENVITask('DarkSubtractionCorrection')
    task_3.values = task_2.min
    task_3.input_raster = task_1.output_raster
    task_3.output_raster_uri = task_4.output_filename
    task_3.Execute

    ; ----------
    ; Aggregator
    ; ----------
    list_aggregator_1.Add, task_3.output_raster, /EXTRACT
    aggregator_1.output = list_aggregator_1

    endforeach

    ; --------
    ; Iterator
    ; --------
    foreach iterator_3, aggregator_1.output, iterator_3_index do begin

    ; -----------------
    ; Generate Filename
    ; -----------------
    task_10 = ENVITask('GenerateFilename')
    task_10.number = iterator_3_index
    task_10.directory = "C:\"
    task_10.prefix = 'PAN_SH_'
    task_10.random = !false
    task_10.Execute

    ; ---------------------------
    ; Extract Elements from Array
    ; ---------------------------
    elementExtractor_1 = Dictionary()
    elementExtractor_1.output_element = aggregator_2.output[[iterator_3_index]]

    ; ------------------------
    ; NNDiffuse Pan Sharpening
    ; ------------------------
    task_9 = ENVITask('NNDiffusePanSharpening')
    task_9.output_raster_uri = task_10.output_filename
    task_9.input_low_resolution_raster = iterator_3
    task_9.input_high_resolution_raster = elementExtractor_1.output_element
    task_9.Execute

    endforeach

    end
    You are not authorized to post a reply.