I want to use the LDOPE tool unpack_sds_bits to extract the bit information from the State QA layer of the MYD09GA Aqua Surface Reflectance product.

However, I have never run a command line before and have no experience with LDOPE. I have it installed. How do I go about writing a simple line to extract the bits?


1 Answer 1


Let us start from the top. Assuming you have LDOPE installed on Windows, you can start working with it.

To open the command line, you open start and search for and run cmd.
With the command line open, you can maneuver to the place where you have your data. To maneuver around you need to use the cd-command. cd is short for 'change directory'. If you need to get to another harddrive on your computer, you must do that specifically. For example, to get to the d-drive, you type d:\
Once you are in the right folder (where your data is located), you can run the commands as described in the manual, for example:

unpack_sds_bits -sds=Cloud_Mask.1 -bit=1-2 -of=cloud_bits.hdf MYD35_L2.A2002189.2040.003.2002191125354.hdf

Which would take the raw MODIS file, go into the Cloud_Mask.1 sds, extract bits 1-2 and write that to cloud_bits.hdf.

Assuming your installation of the software went correctly, the above should work. If you get errors you should check your environmental variables (which is well documented on numerous sites findable using google). You have to make sure that the folder where you installed LDOPE is in the PATH variable.

If you get it to work on one file, the next lesson would be to automate the processing of many files. This is best done using what is commonly referred to as bat-files, which in essence simple run many command line commands in a row, which you can have pre-fabricated using many different approaches.

  • I was able to unpack the QA info from the QA band using this tool, however, the output file doesn't have the projection information. While i know how to add projection to the output files in other ways, i was wondering if there is a way to extract the projection information from the MODIS HDF file directly using LDOPE while the QA information is being extracted? Thanks!
    – TonyC
    Apr 18, 2020 at 19:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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