Post on 01-Jun-2019
Reading and Mapping Aerosol Data From a MODIS HDF4 File
NASAARSETh"p://arset.gsfc.nasa.gov/
ForPythonhelp,contact:
Jus5nRoberts-Piereljus5n.roberts-pierel@nasa.gov
Mapping AOD Derived PM 2.5 Data
• Objec5ve:ExtractAODdatafromaMODISHDF4file(orseriesoffiles),calculatePM2.5fromthedata,andcreateamapoftheresults• Thispythonscriptwilldothefollowing:
1. ReadatextfilecontainingthenamesoftheHDF4filesyouareanalyzing2. ReadineachMODISAerosolProductL2HDF4file3. Displayinforma5on(average,standarddevia5on,etc.)aboutAODineachfile.By
defaultitwilldisplaythefollowingSDSdependingonresolu5on:• MOD04_L2(10km):AOD_550_Dark_Target_Deep_Blue_Combined• MOD04_3K(3km):Op5cal_Depth_Land_And_Ocean
4. AsksuseriftheywouldliketoprovideaslopeandinterceptforPM2.5calcula5on.Iftheuserdeclines,thendefaultvaluesareused:• Slope:40• Intercept:3
5. AsksuseriftheywouldliketoseeamapofthePM2.5data,opensifdesired.Oncemapisclosed,asksuseriftheywouldliketosavethemap• Ifdesired,savesthemapasa.pngfilewiththesamenameastheHDF4file
6. Movesontothenextfileinyourfilelist,ifapplicable
What you can expect… Thisisthepythoncodefromthepm25_modis.pyfile
ThisistheassociatedREADMEFile,andtheinforma5onrequiredtorunthescript
Thesearetherequiredpackagestorunthisscript
Folder Contents
Thisisthewhattheinsideofyourtargetfolder(whereyousavethedownloadedfiles)shouldlooklike.Thereshouldbe“fileList.txt”containingthelistoffilenamesyouwouldliketoanalyze,anyhdf4filesyouareanalyzing,andthepm25_modis.pyfile
Hereisthecorrectformatforthe“fileList.txt”file.
Accessing your target folder and viewing the contents
Followthesestepstoaccessyourtargetfolderandviewitscontents
Thecommand“cd”changesyourcurrentdirectory
Thecommand“dir”displaysthecontentsofthecurrent
directory
Python file outputs
Executethefileusingthe“python”command.Aberexecu5ngthefile,youwillbeaskedifyouwouldliketoanalyzeeachfileinyourfilelist
Python file outputs
Informa5onaboutthefilewillbeprinted,andyouwillbeaskedifyouwouldliketoprovideaslopeandinterceptforPM2.5calcula5on
Python file outputs
Defaultvaluesarechosenifyouselect“No”,andthenyouareaskedifyouwouldliketoseeamapoftheresul5ngdata
Python file outputs
Python file outputs
Youwillbeaskedifyouwouldliketosavethemap,andthen(ifyourlisthasmorethanonefile)theprogramwillaskyouifyouwouldliketoanalyzethenextfileinyourlist
Python file outputs
Python file outputs
Hereisthemapsavedinyourtargetfolderasa.pngfile