X
PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 07 May 2019 11:14 AM by  Solar Smith
ENVIReprojectGLT MODIS or VIIRS with seperate geo file
 2 Replies
Sort:
You are not authorized to post a reply.
Author Messages

Solar Smith



New Member


Posts:5
New Member


--
02 May 2019 09:34 AM

    I'm trying to use the ENVIReprojectGLT task to georeference MODIS or VIIRS data when the geographic rasters are not in the same file as the image raster. I would like to use the new API rather than resort to the old classic api.

    The example in the documentation has those raster automatically generated with the 'openraster' function when opening an hdf5 file that includes the image data and the geographic data together.
    I'm not sure how to use the task when that information is coming from seperate files.
    I have worked out how to open the image, longitude and latitude rasters. I made a few attempts to create the 'quality' raster but they haven't worked. The task fails with a mysterious divide by zero error.

    Can someone provide guidance or an example of how to use the ENVIReprojectGLT task for MODIS or VIIRS data with separate geolocation files?








    MariM



    Veteran Member


    Posts:2396
    Veteran Member


    --
    02 May 2019 11:03 AM
    I was able to find a way to do this (open and georeference) with separate files for VIIRS. Consider the example code below for two H5 files:
    -----------------------------------------
    ; open image data
    file=’SVI01_npp_d20170807_t1931133_e1943460_b00001_c20170807204544199000_ipop_dev.h5’
    raster_rad=e.openraster(file, DATASET_NAME='/All_Data/VIIRS-I1-SDR_All/Radiance')
    raster_rad=e.openraster(file, DATASET_NAME='/All_Data/VIIRS-I1-SDR_All/Reflectance')

    ;Open geometry raster that holds the x/y information:
    Loc = ‘GIMGO_npp_d20170807_t1931133_e1943460_b00001_c20170807204544199000_ipop_dev.h5'
    lat = e.OpenRaster(Loc, DATASET_NAME='/All_Data/VIIRS-IMG-GEO_All/Latitude')
    lon = e.OpenRaster(Loc, DATASET_NAME='/All_Data/VIIRS-IMG-GEO_All/Longitude')

    ; Get the reprojection task from the catalog of ENVITasks
    Task = ENVITask('ReprojectGLT')

    ; Define inputs
    Task.Input_Raster = raster_rad
    Task.Latitude_Raster = lat
    Task.Longitude_Raster = lon

    ; Define output raster URI
    Task.Output_Raster_URI = ‘radiance_geog.dat'

    ; Run the task
    Task.Execute

    -------------------------------------------

    I also found in my notes that sometimes the lat/lon bands have 'background' values of -999.3. In that case, it can cause issues with reprojection, so I would open them with the data ignore value (div):

    lat = e.OpenRaster(Loc, DATASET_NAME='/All_Data/VIIRS-IMG-GEO_All/Latitude', DATA_IGNORE_VALUE=-999.3d)
    lon = e.OpenRaster(Loc, DATASET_NAME='/All_Data/VIIRS-IMG-GEO_All/Longitude', DATA_IGNORE_VALUE=-999.3d)

    If you want to open more than just the data bands, you can also use the 'Template' open to OpenRaster. When you open your first data set and select all the bands of interest, you can use the 'Save Template' in the dialog. Then when opening similar files, use OpenRaster with template=myDataTemplate.

    Solar Smith



    New Member


    Posts:5
    New Member


    --
    07 May 2019 11:14 AM
    I was able to use the ReprojectGLT task to successfully reproject MODIS L1b data. I still receive an arithmetic error: Floating divide by 0, but it does produce the reprojected raster dataset. However, I would like to be able to control the output pixel resolution. Since MODIS resolution is significantly lower near the edge of swath compared to the center, the median value that is automatically selected throws away a lot of useful information near the center of the scene. I may have to resort to the classic routines after all.
    You are not authorized to post a reply.