Open RajasBharambe opened 1 year ago
Hi @RajasBharambe , can you share the code you used to download the files (omitting your login credentials) so that can try and replicated on my side.
Sure, here's the code:
from modis_tools.auth import ModisSession from modis_tools.resources import CollectionApi, GranuleApi from modis_tools.granule_handler import GranuleHandler
username = "" password = ""
session = ModisSession(username=username, password=password)
collection_client = CollectionApi(session=session) collections = collection_client.query(short_name="MOD11A1", version="061")
granule_client = GranuleApi.from_collection(collections[0], session=session)
india_bbox = [71.00, 29.00, 86.50, 18.00] granules = granule_client.query(start_date="", end_date="", bounding_box=india_bbox)
file_paths = GranuleHandler.download_from_granules(granules, session, ext = ("hdf", "h5", "nc", "xml"))
GranuleHandler.download_from_granules(granules, session=session, path="")
Can you provide the start and end dates that you used as well?
Sure, i want to download the data from 1990 to 2022
@RajasBharambe, I'm not able to recreate that error on my end using a subset of years for that product. Just a few things that might help you troubleshoot further: The bounding box you provided looks incorrect. The box should take the form [xmin, ymin, xmax, ymax]. You can try this box for India to see if that changes anything for you:
india_bbox = [68.17822, 6.755953, 97.41529, 35.67455]
Querying 32 years of data at a time raises some concerns as well. I recommend querying in smaller batches to ensure you have sufficient storage, bandwidth, etc. (I suspect this will reach terrabytes of data) and to ensure the data quality in older time frames works for your use case.
If you still get this error, please provide any changes to the code you are using as well.
Ohk @cearlefraym, I will try it, thanks for your suggestion. I haven't done any changes, but if I did, I would surely describe it,
Any update on this @RajasBharambe? If this is resolved I can close out the issue
No, its not. Im getting the same error after trying. Could you please tell me any alternative way ?
Can you post your most recent code used to reproduce the error?
Sure, the code is as follows:
from modis_tools.auth import ModisSession
from modis_tools.resources import CollectionApi, GranuleApi
from modis_tools.granule_handler import GranuleHandler
username =
password =
# Authenticate a session
session = ModisSession(username=username, password=password)
# Query the MODIS catalog for collections
collection_client = CollectionApi(session=session)
collections = collection_client.query(short_name="MOD11A1", version="061")
# Query the selected collection for granules
granule_client = GranuleApi.from_collection(collections[0], session=session)
# Filter the selected granules via spatial and temporal parameters
india_bbox = [55.00, 5.00, 105.00, 45.00]
india_granules = granule_client.query(start_date="2020-01-01", end_date="2023-01-01", bounding_box=india_bbox)
# Download the granules
GranuleHandler.download_from_granules(india_granules, session)
Sir, please tell me what should I do ?
The code you posted above is working for me, although it takes a while to start up as you are querying 3 years of data which is over 31000 files.
I can only recommend you double check your login credentials, restart your kernel to make sure you don't have out-dated variables in memory for your bounding box, and chunk your time frame into smaller periods to avoid throttling, long download times, disk space issues etc.
Yes, I tried doing all the possible ways you mentioned, but same error is occuring.
Can you send the full stack trace?
Are you still getting this error? And if so, can you please provide a stack trace along with your code to help troubleshoot further?
Yes I am getting the same error, after many hits and trials
Describe the bug I downloaded the hdf files using modis-tools, but unable to open the file: It says File Signature not found when I browse through some solutions it says, maybe the file is corrupted.
Your Environment:
modis_tools
version used:pip freeze
orconda list
orpoetry show
):