1

I am trying to analyse some MODIS LST data (MOD11_L2) and am having some difficulty projecting the files into WGS84. I know that I can use the MODIS Reprojection Swath Tools, but I am trying to do the whole process using gdal (which I am currently running through python as this is where the rest of my process is).

In python, I have been using:

import subprocess
subprocess.call(some gdal functions)

I have tried the gdal_warp function but am having trouble with the parameters of the tool. Here is an example file: http://e4ftl01.cr.usgs.gov//MODIS_Dailies_F/MOLT/MOD11_L2.041/2015.08.15/MOD11_L2.A2015227.0215.041.2015228093331.hdf.

I have tried looking at the help here: How to reproject MODIS Swath data to WGS84 but it does not seem to work with the LST data which I am using.

I want this to work so I end up with a Geotiff file in WGS84.

I'm fairly new to both gdal and python!

6
  • Consider reading the answer to this question: gis.stackexchange.com/questions/81361/… It should give you a good starting point (and most likely the entire answer). Oct 17, 2016 at 12:20
  • Thank you for your reply. Unfortunately the answer provided via that link does not work with this data. I am not sure as to why. The file I have linked to, when running gdalinfo does not have any GCPs... may be one reason why but as I said, I'm unsure. I will update my gdal to see if that makes any difference, but it should be the latest.
    – tda
    Oct 17, 2016 at 12:33
  • 2
    I unfortunately don't have much time to look at it, but the HDF4 to XYZ to TIFF process shouldn't be affected by the lack of valid GCP data. It's a bit more cumbersome, but it should be doable without too much messing about. You could also use MRT-Swath in much the same way as you are currently attempting to use GDAL, and MRT-swath very rarely has issues reading any MODIS file. Oct 17, 2016 at 12:45
  • Thank you for your help. I will try the XYZ method and see if I can get it to work. My issue with MRT-Swath is that the input parameter files require me to have separate geolocation files for each MODIS LST file... which is frustrating and makes the process very long (having to create different param files for all of my ~100 images). If I find the answer using XYZ, I will post up a full answer.
    – tda
    Oct 17, 2016 at 13:07
  • You can reuse parameter files from MRTSwath. You can even skip the parameter file entirely and give it all the information through the command-line. Oct 17, 2016 at 13:54

1 Answer 1

1

The link you provided had a not found error. But I used a different MODIS file and it works: https://corteva.github.io/rioxarray/stable/examples/reproject.html

import rioxarray
rds = rioxarray.open_rasterio(
    "MOD09GA.A2008061.h08v04.006.2015172051346.hdf",
    variable="SolarZenith_1"
)
rds.SolarZenith_1.rio.reproject("EPSG:4326").rio.to_raster("SolarZenith_1.tif")
!gdalinfo SolarZenith_1.tif

Driver: GTiff/GeoTIFF
Files: SolarZenith_1.tif
Size is 1641, 431
Coordinate System is:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Origin = (-155.572382657535627,49.999999995506855)
Pixel Size = (0.023202928554154,-0.023202928554154)
...

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.