[GIS] MODIS downloads using Python

downloadmodispythonrwindows 10

I am trying to get a full-functioning download script specifically for the Modis data (Version 6) on the USG/NASA site (AppEEARS/LPDAAC). I’m running Windows 10. I know that there is an R Modis package (RTS) available from the CRAN site and iterations on various other sites and have installed such things as wget, Rcurl, as well as the MRT reprojection tool and successfully used this manually, however my understanding is that the USGS site has recently changed a few things including getting rid of MRT service (changing tools) and moving from FTP to HTTP which, I understand, causes issues with the R package. Python has been recommended as the way to go, with R used for any analysis required. I’ll look at ArcGIS/ R comparisons for what I want to do analytically further done the track.

I want to be able to access the NASA site, determine product availability (LST, EVI, NDVI, albedo, etc), input the area extent, mosaic required areas, select the dates/product, reproject, use scale/offset factors where required, convert from Julian to usual dates, Kelvin to Celsius and productively use the associated pixel quality data (ideally identifying cloud cover affected areas). Some of this may be better done manually, and I can use various tools in ArcGIS eg raster calculator, for scaling, etc however as I am looking at quite a bit of data (1990 to current at 5 yearly intervals) for a project, to automate this as much as possible would be the ideal way to go. There appear to be services available for some of this on the LPDAAC site.

The AppEEARS site provides API script (uCurl, R and Python) for interacting with the site and getting info and I will probably look at using Python for this. I have started using the Python API to access the site (need logon and also current token info). I have also pulled down the Modis Python toolbox (scaling and quality decoder) from the EarthData site and after some setup requirements (uses pip, arcpy, requests) have got this to run in ArcGIS, although currently not successfully in regards viable outputs re scaling and specifically getting the downloaded quality data into readable and usable format. So at the moment it is a bit bitsy with some things working and others not. Mainly accessing the Earthdata Search, Earth Explorer and AppEEARS sites for the initial searches. AppEEARS has a good “extract area sample” feature for manual, mosaic’ed, etc downloads.

My question is if anybody knows of an essentially complete python script which will allow download of required info and which I can access, similar to the R package? I’m currently looking at PyModis which appears to cover off on some requirements. I have only basic programming skills though working on it. I have looked around and asked questions on the USGS/NASA site itself but currently have had no responses.

Best Answer

Below are some resources related to AppEEARS that should help with some of the things you are trying to accomplish with MODIS data. Using the AppEEARS API, you can determine product availability, and submit requests for a host of geospatial datasets from a variety of federal data archives (including MODIS version 6 data). When submitting an AppEEARS Area Request, you are able to input a region of interest, subset by date and by product/layer, and select output file type and reprojection options. If your specific region of interest covers more than one MODIS tile, AppEEARS will automatically returned a mosaic output clipped to the extent of your region of interest. There are also Jupyter Notebook tutorials for working with AppEEARS outputs (see below), which demonstrate how you can use Python to download your AppEEARS outputs and perform additional processing steps such as date conversion, applying scale factors, and filtering by quality.

Useful Links:

AppEEARS-related Jupyter Notebook Python Tutorials:

Videos:

If you have additional questions about LP DAAC data or services, contact the LP DAAC User Services at:
Voice: 605-594-6116
Toll Free: 866-573-3222 (866-LPE-DAAC)
Fax: 605-594-6963
E-mail: LPDAAC@usgs.gov

Related Question