Visualization of PRISMA he5

Issue #589 resolved
Former user created an issue

Dear, I have problems with the visualization of PRISMA he5.. When I open a PRISMA SWIR_cube, for example, the software give me a size of 1268x173x1235. The indicated number of bands is 1235. I would have expected that the right number is 173. It can be the reason of the visualization problem? Thank you so much

Comments (91)

  1. Andreas Janz

    PRISMA data is stored in a strange way and can not be displayed correctly as is in QGIS/EnMAP-Box.

    Use the Add Product → PRISMA L2D to reformat it. (Only works for L2D data!)

  2. Prateek Tripathi

    After updating the version to 3.7 of EnMap following error is shown during the opening of L2D datasets:

    Traceback (most recent call last):
    File "C:/Users/Prateek/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\enmapboxplugin\hubdsm\processing\enmapalgorithm.py", line 63, in processAlgorithm
    raise Exception('unexpected error')
    Exception: unexpected error

    Please help.

  3. Andreas Janz

    We expect original file basenames, e.g.: PRS_L1_STD_OFFL_20201107101404_20201107101408_0001.he5

    This isn’t a valid name:

  4. Andreas Janz

    Ok, I could fix the problem by running the OSGeo4W Setup installing the latest available version of h5py:

  5. Andreas Janz

    h5py is part of QGIS, but it requires an update. You can start the setup dialog via the OSGeo4W shell:

  6. Giuseppe Colacicco

    I installed the package you told me but it always gives me the same error, ie :

    ImportError: DLL load failed while importing defs: Unable to find specified procedure.

  7. Andreas Janz

    Ok, I guess there is still a wrong h5py version inside your user folder:

    Try to manually delete the h5py folder. Now the correct version should be used.

  8. Giuseppe Colacicco

    When I convert the he5 file into a geotiff one, I lose all the information about the Wavelength. Is it possible that I’m doing the conversion wrong?

  9. Andreas Janz

    Importing a PRISMA product into the EnMAP-Box already creates a GeoTiff with correct wavelength information:

    If you want to save that GeoTiff to a new location use the “Save raster layer as” algorithm together with the “Copy metadata” option:

  10. Andreas Janz

    Note that if you use the standard QGIS “Save Raster Layer as…” or GDAL “Translate (convert format)”, you will loose your metadata.

  11. Andreas Janz

    So, after you imported the PRISMA product into the EnMAP-Box, you have wavelength information available, correct?

    What exactly are you doing afterwards? Which algorithm do you use, that delets the wavelength?

  12. Giuseppe Colacicco

    Yes, I do have the information when I import the file in EnMap-box, But when I try to export in Geotiff format, they disappear.

  13. Giuseppe Colacicco

    That is the step-by-step process that I’m adopting In order to convert tu .he5 in .tif

    As you can see in the third imagine, I’m selecting the interested band that I want.

    After I execute the process (image 5), the geotiff image is opens in qgis but without the wavelength information.

  14. Andreas Janz

    Ok, you are using the correct algorithms, that is good 🙂

    Now, please check the Layer Properties of your result tif. Can’t you see the wavelength under GDAL Metadata?

  15. Andreas Janz

    Also note that QGIS is not aware of wavelength information. Do not use the QGIS Identify Tool to plot a spectral profile. It will always be plottet against the band indices:

  16. Giuseppe Colacicco

    practically, once carried out the crop with qgis of the bands interested, opening the file with matlab, tells us that the wavelengths are not prensenti inside the file

  17. Andreas Janz

    once carried out the crop with qgis of the bands interested

    Not sure what this means. Please show a screenshot what algorithm / tool you used.

  18. Giuseppe Colacicco

    As you can see from the image, when I bring the . tif file to Matlab it loses information about the wavelengths it had in qgis.

  19. Andreas Janz

    I guess the hypercube function expects the wavelength to be in a specific format/location.

    EnMAP-Box stores wavelength information in the GDAL PAM file:

    Your Matlab function is not aware of that.

    You need to prepare your tif file (i.e. the wavelength information) with respect to the Matlab function.

    Unfortunately, I can’t help you with that.

  20. Dimitris Poursanidis

    Maybe spamming but relevant to the title.

    The panchromatic band is not accessible throught EnMAP yet.

    Are plans for that dataset to be accessed ?

  21. Giuseppe Colacicco

    Hi, do you know how to extract reflectance values from an L2D prism product on enmap-box ?

  22. Giuseppe Colacicco

    Hi, do you know how to extract reflectance values from an L2D prism product on enmap-box ?

  23. Andreas Janz

    What do you mean by “extract reflectance values”? Given a point vector layer: extract spectral profiles for all points? Or something else?

  24. Prateek Tripathi

    You can extract the spectral profile for any pixel in ENMAP using the tool in the toolbar at the top.

  25. Andreas Janz

    Yes, for interactive profile extraction, use the spectral view.

    To extract profiles for all points in a layer, use this algorithm:

    Sampled values are stored in an attribute table with columns “Sample_1”, … “Sample_N” for each Band from 1 to N.

  26. Giuseppe Colacicco

    When I open the L2D product on Enmap-Box these are the metadata that appear to me. I would like to know, if possible, which of these may be reflectance values ?

  27. Andreas Janz

    Your screenshot shows metadata, e.g. Band 175 is located at a center wavelength of 2061 nanometers and has a full width at half maximum (fwhm) of ~11 nanometers.

    To see actual reflectance data use the spectral view for plotting pixel profiles like suggested by @Prateek Tripathi .

    Or maybe I don’t get your question? Please explain a bit more in detail, what exactly you want to do.

  28. Andreas Janz

    Alright, but this is not really a PRISMA-related question 🙂

    To get all data of Band 42, do this:

  29. Giuseppe Colacicco

    No, to find the data of a band I right click and then I go to "Layer Properties" and then I go to "GDAL Metadata". But I can’t see the reflectance data.

  30. Andreas Janz

    I still don’t get what you want to achieve.

    Under Layer Properties > GDAL Metadata you only find metadata.

    To get the actual reflectance data of a PRISMA band, you need to do something like that:

    This gives you the reflectance value of each pixel as an array.

    Isn’t that what you want?

  31. Andreas Janz

    With the code snippet I presented:

    from enmapboxprocessing.rasterreader import RasterReader
    layer = QgsRasterLayer('<path to my raster layer>')
    reader = RasterReader(layer)
    array = reader.array(bandList=[42])
    

  32. Giuseppe Colacicco

    All right, I’ll try it in the morning and let you know how it goes, thank you very much.

  33. Giuseppe Colacicco

    When I put the following script in the Python console:

    from enmapboxprocessing.rasterreader import RasterReader
    layer = QgsRasterLayer('C:\Users\conte\Desktop\PRS_L2D_019_SR.tif')
    reader = RasterReader(layer)
    array = reader.array(bandList=[169])

    It gives me the following error:

    Traceback (most recent call last):
    File "C:\PROGRA~1/QGIS32~1.1/apps/qgis/./python/plugins\processing\script\ScriptEditorDialog.py", line 228, in runAlgorithm
    exec(self.editor.text(), _locals)
    File "<string>", line 2
    layer = QgsRasterLayer('C:\Users\conte\Desktop\PRS_L2D_019_SR.tif')
    ^
    SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

  34. Andreas Janz

    You need to put an r (raw) in front of the string because of the backslashes:

    r'C:\Users\conte\Desktop\PRS_L2D_019_SR.tif'

  35. Giuseppe Colacicco

    When I put the following script in the Python console:

    from enmapboxprocessing.rasterreader import RasterReader
    layer = QgsRasterLayer(r'C:\Users\conte\Desktop\PRS_L2D_019_SR.tif')
    reader = RasterReader(layer)
    array = reader.array(bandList=[169])

    It gives me the following error:

    Traceback (most recent call last):
    File "C:\PROGRA~1/QGIS32~1.1/apps/qgis/./python/plugins\processing\script\ScriptEditorDialog.py", line 228, in runAlgorithm
    exec(self.editor.text(), _locals)
    File "<string>", line 2, in <module>
    NameError: name 'QgsRasterLayer' is not defined

  36. Giuseppe Colacicco

    Can you help me solve this last problem, which is to extract the reflectance matrix from this TIF file?

  37. Nicole Trenholm

    I am trying to visualize 750-800nm of my PRISMA VNIR satellite images.

    I also want to look at Ocean Colour analysis with ONNS algorithm applied for my PRISMA images.

    I tried to open the He5 in Acolite to generate Ocean Color algorithms satellite image plots but failed.

    I found a R code (https://ranghetti.github.io/prismaread/) that converts the PRISMA he5 L2C to L2D. I am not sure if I converted correctly but at least I outputted the L2C files to geotiffs.

    I cant tell if the code converted my files to L2D or not.

    Below I was able to open the .he5 or geotiff in enmap-box but the RGB values are between 0-0.327547, I would have expected these VNIR images to have values from 400-1100nm.

    I really am having a difficult time figuring out the correct processing steps to best utilize enmap-box for my data analysis interests. I am a graduate student and will truly be grateful for any guidance anyone may have with PRISMA data and enmap-box to reach my goals! ntrenholm@umces.edu

  38. Andreas Janz

    @Giuseppe Colacicco outside of QGIS you need to import the QgsRasterLayer class on your own first:

    >>>from qgis.core import QgsRasterLayer
    

  39. Andreas Janz

    @Nicole Trenholm thanks for your questions.

    I am trying to visualize 750-800nm of my PRISMA VNIR satellite images.

    I also want to look at Ocean Colour analysis with ONNS algorithm applied for my PRISMA images.

    ONNS is a third-party application. Please contact the developer directly:
    Martin Hieronymi (martin.hieronymi@hzg.de)

    I tried to open the He5 in Acolite to generate Ocean Color algorithms satellite image plots but failed.

    I found a R code (https://ranghetti.github.io/prismaread/) that converts the PRISMA he5 L2C to L2D. I am not sure if I converted correctly but at least I outputted the L2C files to geotiffs.

    I cant tell if the code converted my files to L2D or not.

    Sorry, I’m not familiar with the Acolite and prismaread tools.

    Below I was able to open the .he5 or geotiff in enmap-box but the RGB values are between 0-0.327547, I would have expected these VNIR images to have values from 400-1100nm.

    The values are reflectance values between 0 (0% reflectance) and 1 (100% reflectance).

    The values between 400-1100nm would be the center wavelength of the individual bands. Those are reported here:

    I really am having a difficult time figuring out the correct processing steps to best utilize enmap-box for my data analysis interests. I am a graduate student and will truly be grateful for any guidance anyone may have with PRISMA data and enmap-box to reach my goals! ntrenholm@umces.edu

    Note that after importing the PRISMA data into the EnMAP-Box it is handled like any other (spectral) raster layer. You may use all the QGIS or EnMAP-Box algorithms available:

    You may also ReadTheDoc:

    https://enmap-box.readthedocs.io/en/latest/usr_section/usr_gettingstarted.html

    https://enmap-box.readthedocs.io/en/latest/usr_section/usr_cookbook/usr_cookbook.html

    https://enmap-box.readthedocs.io/en/latest/usr_section/application_tutorials/index.html

  40. Giuseppe Colacicco

    @Andreas Janz How can I import the Qgsrasterlayer class outside of QGIS? Where should I insert this script outside of QGIS?

  41. Giuseppe Colacicco

    @Andreas Janz When I try to execute the script you gave me, it gives me this error message which says: "It seems like there is no valid script in the file".

    Have you got any idea on how to solve this? I'm new to qgis and I'm using it for a university project so I don't use it so often. Thank you.

  42. Giuseppe Colacicco

    Is it possible to have the spectral library not in pixel by pixel but of the whole image? I mean, is it possible to have this graph of the whole image?

  43. Andreas Janz

    Do you really want to plot more than a million pixel profiles at the same time?

    Or do you rather want to read the whole spectral image cube into an array of size [nrows, ncols, nbands] and do something else with the data?

  44. Giuseppe Colacicco

    For a university project, I have to calculate the CIBR (Continuum Interpolated Band Ratio) which is calculated with this formula:
    Lc/[(A_Ll) + (B_Lr)]
    Where Lc, Ll, and Lr are the radiance at a given channel (for example Lc is the radiance at band n.169, Ll at band 167 and Lr at band 173) and A and B are weight coefficients. I know the values of the weight coefficients A and B.
    Since I have a L2D product, I am not able to get the radiance. So, just for studying purposes, I want to use the reflectance instead.
    I was wondering if there is a way to get the reflectance values to use them in the formula I wrote before.
    I'm attaching the image of the formula.

  45. Andreas Janz

    Ah now it makes more sense 🙂

    For calculating formulars you should simply use one of the available Raster Calculators:

  46. Giuseppe Colacicco

    I’m gonna download the version you sent me this weekend and test it to see how it’s doing with my computer.

  47. Giuseppe Colacicco

    I tried the version of Enmap that you sent me and on my PC it works well as you do not notice any particular slowdowns or bugs. I also take this opportunity to thank you for your availability and your help in this university project. I wish you a good weekend.

  48. Aravind Bharathvaj

    I too have the same issue of the wavelength info not getting embedded with the tiff file. I do understand that the QGIS environment shows the wavelength details very clearly. But I am trying to use the tiff file in ENVI 5.3, along with other files, where i am not getting the wavelength information. I have attached some screenshots for your perusal.

  49. G C

    Hi all,

    could you gently tell me if is possible to

    • apply a scale factor of 100
    • Perform QUAC atmospheric correction

    to a prisma L1 product using enmap box?

    I have a problem in dealing with prisma on ENVI since I have version 5.0 and 5.3 which do no support natively PRISMA data

  50. Log in to comment