gabriel-desharnais / modis-python-suite Goto Github PK
View Code? Open in Web Editor NEWPython module to download modis data
License: MIT License
Python module to download modis data
License: MIT License
Salut Gabriel,
Nous avons encore des problèmes de connection avec NSIDC, leur serveur est down donc nous devons juste attendre, par contre cela force le programme à s'arrêter même lorsque qu'on demande un téléchargement des images MOD09 uniquement, sur le site de la NASA (URL2="https://e4ftl01.cr.usgs.gov") qui lui fonctionne, il y -t-il moyen de découpler les deux ?
Merci!
Véronique
Hi, I tested the following code
import modisSuite
#Create object
print ("start..")
prod="MOD35_L2"
username="XXX"
password="XXX"
startdate="2010-02-20"
d=1 #Download days
tiles=['h13v04']
folder="/" #will download all file in the folder test
doo=modisSuite.downloader(prod,username,password,date=startdate,delta=d,tuiles=tiles,output=folder)
for day in doo.telechargerTout():
print([aFile.name for aFile in day.files])
day.mosaic()
and I get the following error on every try
Traceback (most recent call last):
File "Desktop/modisSuite_test.py", line 15, in <module>
for day in doo.telechargerTout():
File "/anaconda3/lib/python3.6/site-packages/modisSuite/Downloader.py", line 218, in telechargerTout
for date in LListeDate:
UnboundLocalError: local variable 'LListeDate' referenced before assignment
I already tested my credentials and they work fine, also no connection problems on my end.
would this be a problem on the lib or on my end?
I wrote this script to download snow data from the NSIDC:
import modisSuite
username = ""
password = ""
product = "MOD10A2.006"
tiles = ["h20v02"]
start_date = "2011-01-01"
d = 20
folder = "../test_data"
doo = modisSuite.downloader(product, username, password, date=start_date, delta=d, tuiles=tiles, output=folder)
for x, y in doo.telechargerTout():
print(x, y)
I then recieved this error:
/usr/bin/python2.7 /home/tim/Documents/Research/arctic-browning/scripts/snow.py
Traceback (most recent call last):
File "/home/tim/Documents/Research/arctic-browning/scripts/snow.py", line 11, in <module>
doo = modisSuite.downloader(product, username, password, date=start_date, delta=d, tuiles=tiles, output=folder)
File "build/bdist.linux-x86_64/egg/modisSuite/Downloader.py", line 41, in __init__
File "build/bdist.linux-x86_64/egg/modisSuite/Downloader.py", line 139, in authentification
File "build/bdist.linux-x86_64/egg/modisSuite/Downloader.py", line 138, in authentificationNSIDC
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 480, in get
return self.request('GET', url, **kwargs)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 454, in request
prep = self.prepare_request(req)
File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 388, in prepare_request
hooks=merge_hooks(request.hooks, self.hooks),
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 293, in prepare
self.prepare_url(url, params)
File "/usr/lib/python2.7/dist-packages/requests/models.py", line 353, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '>\n<!--[if lt IE 7]><html class=': No schema supplied. Perhaps you meant http://>
<!--[if lt IE 7]><html class=?
Process finished with exit code 1
Has anyone experienced this issue before?
Salut Gabriel!
Je ne vois pas de changement avec les url sur les sites de download de NSDIC ou USGS qui fonctionnent dans un navigateur, mais le pg Downloader.py plante avec l'erreur suivante...
une idée?
Véronique
telechargeur=disSuite.downloader(nomProduit,UTILISATEUR,MOTPASSE,date۴eATraiter[0],delta=n(dateATraiter)-1,tuiles=ILES,output=p_temp,ignore=steDejaFait).telechargerTout() #,log=g,ignore=steDejaFait
File "/usr/local/lib/python2.7/dist-packages/modisSuite/Downloader.py", line 40, in init
self.authentification(self.session)
File "/usr/local/lib/python2.7/dist-packages/modisSuite/Downloader.py", line 154, in authentification
authentificationNSIDC()
File "/usr/local/lib/python2.7/dist-packages/modisSuite/Downloader.py", line 150, in authentificationNSIDC
session.get(h.text[a:b])
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 521, in get
return self.request('GET', url, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 494, in request
prep =lf.prepare_request(req)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 437, in prepare_request
hooks=rge_hooks(request.hooks, self.hooks),
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 305, in prepare
self.prepare_url(url, params)
File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 379, in prepare_url
raise MissingSchema(error)
requests.exceptions.MissingSchema: Invalid URL '>\n<!--[if lt IE 7]><html class= No schema supplied. Perhaps you meant http://>
Hello,
Maintenant que le site de NSIDC est revenu il y a un autre problème avec la connexion USGS:
File "/usr/local/lib/python2.7/dist-packages/modisSuite/Downloader.py", line 40, in init
self.authentification(self.session)
File "/usr/local/lib/python2.7/dist-packages/modisSuite/Downloader.py", line 157, in authentification
authentificationUSGS()
File "/usr/local/lib/python2.7/dist-packages/modisSuite/Downloader.py", line 126, in authentificationUSGS
h=ssion.get(h.headers["Location"],auth=elf.utilisateur,self.motdepasse),allow_redirectsúlse)
File "/usr/local/lib/python2.7/dist-packages/requests/structures.py", line 54, in getitem
return self._store[key.lower()][1]
KeyError: 'location'
est-ce que c'est parce que la ligne précédente (125 dans DOWNLOADER.py) fait référence à un fichier qui n'existe plus?
h=session.get("https://e4ftl01.cr.usgs.gov/MOLT/MOD09A1.005/2000.02.18/MOD09A1.A2000049.h00v08.005.2006268222532.hdf",auth=(self.utilisateur,self.motdepasse),allow_redirects=False)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.