1

I wish to analyse several days' worth of Aerosol Optical Depth retrievals from (MYD04_L2) data over the Atlantic Ocean. I have limited experience of using GDAL, but only analysing a single MODIS tile at a time. I'm still relatively new to using remote sensing data.

Could anybody point me in the direction of how to visualise several MODIS tiles simultaneously on a map?

2 Answers 2

1

You can project to whatever you want using gdalwarp. I'm using two MOD04_L2 files here, but you could use however many you wanted and made sense (these two probably don't make sense as they are from different days, but whatever!)

gdalwarp -of GTIFF -tps -t_srs EPSG:4326 \
HDF4_EOS:EOS_SWATH:"MOD04_L2.A2020151.0950.061.2020151191628.hdf":mod04:Image_Optical_Depth_Land_And_Ocean \
HDF4_EOS:EOS_SWATH:"MOD04_L2.A2020152.1030.061.2020152191431.hdf":mod04:Image_Optical_Depth_Land_And_Ocean\
output_file.tif

The trick here is to use the tps option to do some interpolation of the swath locations to a regular grid.

If you wanted to reproject this to a different projection, spatial region, etc (this will tell GDAL to come up with its own box and spatial resolution), you can check the t_srs option (for the new projection), xRes and yRes for x and y spatial resolution and the te option to define the corner coordinates of interest.

You can also do this in Python directly:

import numpy as np
import matplotlib.pyplot as plt
import gdal

f_tmpl ='HDF4_EOS:EOS_SWATH:"%s":mod04:Image_Optical_Depth_Land_And_Ocean'
fnames = ["MOD04_L2.A2020151.0950.061.2020151191628.hdf",
          "MOD04_L2.A2020152.1030.061.2020152191431.hdf"
         ]
ffs = [f_tmpl % f for f in fnames]
g = gdal.Warp("", ffs, format="MEM", 
              tps=True, dstSRS="EPSG:4326")
data = g.ReadAsArray()
plt.imshow(data)
0

If you are working with python, you should use the pymodis package http://www.pymodis.org to easily download, reproject and mosaic the data to the extent of your are of interest.

1
  • Not sure this is right, the MYD04_L2 is a swath product, not gridded, and I think pymodis only deals with gridded products.
    – Jose
    Commented Jun 12, 2020 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.