联系作者:QQ:3176038642,wx: ilovework2200
目录
1、数据下载
1.1 DAAC下载
下载链接:
USAGE:
Daac2Disk_win.exe --version
OR
Daac2Disk_win.exe --shortname <SHORTNAME> --versionid <VER>
[--noscience]
[--nometadata]
[--browse]
[--qa]
[--begin <YYYY-MM-DD> --end <YYYY-MM-DD>]
[--bbox <llLon llLat urLon urLat>] or
[--tile <horizMin> <horizMax> <vertMin> <vertMax>]
[--outputdir <output directory>]
[--test]
NOTE: The versionid is not a number. It is a string and as
such much match exactly. ie '5' is not the same as '005'
OR
Daac2Disk_win.exe --inputfile <input file name>
[--output <output directory>]
OR
Daac2Disk_win.exe --orderurl <URL from order email>
[--output <output directory>]
OR
Daac2Disk_win.exe --url <Single URL>
[--output <output directory>]
NOTE: The output location defaults to the current directory.
NOTE: The Science files are downloaded by default, to turn that off, use --noscience
NOTE: The Metadata files are downloaded by default, to turn that off, use --nometadata
user guide链接(https://lpdaac.usgs.gov/documents/603/DAAC2DiskUserGuide_20200313.pdf)
Daac2Disk_win.exe --shortname MOD13A1 --versionid 061 --begin 2018-01-01 --end 2018-01-05 --bbox 73 18 135 54 --output D:\Proj
1.2 wget下载
1.2.1 wget工具下载
1.2.2 得到所有数据的link(python代码)
#encoding='utf8'
from urllib.request import urlopen
from bs4 import BeautifulSoup
import datetime
import re
def getlinks_i(url,otxt):
print(url,datetime.datetime.now())
try:
html = urlopen(url)
bsObj = BeautifulSoup(html, 'html.parser')
t1 = bsObj.find_all('a')
f = open(otxt,'a')
for t2 in t1:
t3 = t2.get('href')
if t3.endswith('.hdf'):
f.write('%s%s\n'%(url,t3))
f.close()
except Exception:
print('sleep, ',datetime.datetime.now())
time.sleep(60*5)
getlinks(url,otxt)
def getlinks():
url0 = 'https://e4ftl01.cr.usgs.gov/MOLT/MOD13A1.061/'
html = urlopen(url0)
bsObj = BeautifulSoup(html, 'html.parser')
links = bsObj.find_all('a')
re_exp = '^[0-9]{4}.[0-9]{2}.[0-9]{2}$'
for lk in links:
lk = lk.get('href')
if re.search(re_exp,lk[-11:-1]):
getlinks_i(lk,'all_links.txt')
if __name__ == '__main__':
getlinks()
1.2.3 用wget下载
在cmd里运行如下命令:
wget --load-cookies .urs_cookies --save-cookies .urs_cookies --auth-no-challenge=on --keep-session-cookies --user=YOUR ACCOUNT --password=YOUR PASSWORD --content-disposition -c -i FILENAME
1.2.4 wget options
Use the Content Management Shell (CMShell)
Available options
The <OPTION> variable displayed in the above example can be populated with one or more of the following options:
Option Description
Startup Use these options for the startup phase.
-B, --base=<URL> When a wget download is initiated using both the -F and -i options, a specific file of URLs is targeted, and the format of that file is to be read as HTML. Include this option and specify a desired <URL> to be pre-pended to relative links found in this file, if applicable.
-h, --help Display in-line Help for the call.
Logging and Input File Use these options to specify log and input files.
-F, --force-html Include this in addition to the -i option to denote that its targeted <FILE> should be treated as HTML format.
-i, --input-file=<FILE> Download from a list of URLs specified in a file input as the <FILE> variable. This file must exist on the local system. Ensure that the complete path to the this file, including file name and extension are included.
-o, --output-file=<FILE> Include to have log messages saved to the named <FILE>. (Ensure that you include the appropriate extension.)
-q, --quiet When included, no output will be generated.
-v, --verbose Display the operation’s execution step by step.
Download These options are for download operations.
--connect-timeout=<#> Set the <#> variable to a value, in seconds that should serve as a connection timeout.
--dns-timeout=<#> Set the <#> variable to a value, in seconds that should serve as a DNS timeout.
--escape-filename-ctrl Include this option to escape control characters in targeted filenames.
--limit-rate=<RATE> To set a download rate limit, include this option and set the <RATE> variable to a desired rate (in Mbps)
-N, --timestamping When this option is included, files will not be retrieved if their timestamp is older than that of an existing instance of the file.
--no-clobber Do not overwrite existing files.
-O, --output-document=<FILE> Include output information in a file specified as the <FILE> variable.
-Q, --quota=<#> Include this to set a file retrieval quota to a specific number, defined as the <#> variable.
--password=<PASSWORD> Include this (along with the --user option) and set its variable to the appropriate password if username/password values are required to access content at the specified URL.
--random-wait Include to set a random wait time between retrievals -- from 0-2 seconds.
--read-timeout=<#> Set the <#> variable to a value, in seconds that should serve as a read timeout.
--retry-connrefused Include this option to attempt a retry if the connection is refused.
-S, --server-response Include this option to have the server response displayed for each retrieval.
--spider Include this option do block all downloading (i.e., if you wish to use other options to review information).
-T, --timeout=<#> Include this option to define a read timeout. Set the <#> variable to the desired time, in seconds.
-t, --tries=<#> Set the <#> variable to the number of retries that should be attempted before reporting a failure (“0” = unlimited)
--user=<USER> Include this option and set its variable to the appropriate user name if username/password values are required to access content at the specified URL.
--upload-quota=<#> Include this option to define a <#> to serve as the maximum quota of uploads. (The default = 1,000,000.)
-w, --wait=<#> Include this option and set the <#> variable to define a wait time between retrievals, in seconds.
--waitretry=<#> Include this option and set the <#> variable to define a wait time between retries of a retrieval, in seconds.
Directories These options control directory handling.
-nd, --no-directories When included, directories will not be created. All files captured in the wget will be copied directly in to the active directory.
-nH, --no-host-directories When included, host directories will not be created.
-P, --directory-prefix-<PREFIX> When included, files will be saved to a subdirectory of the active directory. Define this sub-directory using the <PREFIX> variable).
-x, --force-directories Include to force the creation of directories. Directory paths within the target URL will be automatically created in the active directory.
--protocol-directories Use the protocol name as a directory component of local file names. For example, with this option, ‘wget -r http://host’ will save locally as ‘http/host/<content>’ rather than just to ‘host/<content>’
--cut-dirs=number Ignore number directory components. This can be combined with -nH to simplify directory depth.
HTTP options These options set how to handle various HTTP operations.
--header-<STRING> Include this value and define a <STRING> value to have this content included in headers located via the targeted URL.
--http-passwd=<PASSWORD> Set the HTTP password to the value set as the <PASSWORD> variable.
--http-user=<USER> Set the HTTP username to the value set as the <USER> variable.
-E, --html-extension Save HTML documents with an ".html" extension.
--ignore-length Ignore the Content-Length header.
--ignore-robots Include this option to ignore any “robots.txt” files and the “metatag”.
--load-cookies=<FILE> Load cookies from the target <FILE> before initiating any retrievals
--load-regex=<FILE> Follow URLs within the specified <FILE> that match regular expression.
--no-cache Include to block references to the local cache as a result of accessing the target URL.
--no-check-certificate Include to block the checking of local certificate files as a result of accessing the target URL.
--no-cookies Include to block the loading of any cookies as a result of accessing the target URL.
--no-http-keep-alive Include this option to disable persistent connections)
--no-redirect-link Include this option to disable the use of redirect links.
--referer=<URL> Include this and set the <URL> variable for use as an applicable referer site
--save-cookies=<FILE> Save all cookies to a specific file, named as the <FILE> variable. This file will be saved in the active directory along with the wget content.
--save-headers Include this option to have headers in target content saved. They will be saved in the active directory along with the wget content.
FTP options These options are available for FTP connections.
--ftp-password=<PASSWORD> To utilize FTP to process the wget include the applicable FTP password necessary to access the content.
--ftp-user=<USER> To utilize FTP to process the wget include the applicable FTP password necessary to access the content.
-g, --glob=<ON/OFF> Include and set the variable to ON to turn on file name globbing. By default, “globbing” with wget is set to OFF.
Note: While this is supported, be aware the sequence of the resulting output is not guaranteed to be in an expected (alphanumeric) order.
--passive-ftp Include this option to set the transfer mode to “passive”. Default FTP mode is “active”.
--retr-symlinks If incorporating any of the Recursive Retrieval options, include this option for FTP to download linked-to files rather than directories.
Recursive Retrieval These options specify recursive traversal.
-r, --recursive When included, the wget will recursively traverse subdirectories in order to obtain all content.
Note: By default, the maximum recursion depth for this option is ten levels from the target directory ( /<TARGET>/1/2/3/4/5/6/7/8/9/10). To deviate from this default, include the -L, --LEVEL=<#> option to specify the desired depth.
-k, --convert-links Include this option to convert non-relative links to relative.
-K, --backup-converted When converting a file, back up the original version with a ‘.orig’ suffix. Affects the behavior of ‘-N’ Time-Stamping.
-l, --level=<#> Limit recursion depth to a specific number of levels, by setting the <#> variable to the desired number.
-m, --mirror This is used to perform a “mirror” copy of the target directory. This option turns on recursion and time-stamping, defaults to a recursion depth of ten levels ( <target directory>/1/2/3/4/5/6/7/8/9/10) and keeps FTP directory listings.
Note: To deviate from the default ten level recursion depth, include the -L, --LEVEL=<#> option to specify the desired depth.
-p, --page-requisites Include this option to ensure that all files required to properly display a targeted HTML file are also included (images, scripts, etc.).
-z, --convert-absolute Include this option to convert non-absolute links to absolute.
Recursive Accept/Request All of the options discussed here only apply if the -r(or --recursive) Recursive Retrieval option has been included with this command.
-A, --accept=<LIST> When using recursion, you can specify specific file extensions for file formats you wish included in the wget and all other file formats will be ignored. Set the <LIST> variable to a comma-separated list of desired extensions, with no whitespaces between each entry. For example, -A=htm, jpg,mp4 could be input to include only these file formats.
-R, --reject=<LIST> When using recursion, you can specify specific file extensions for file formats you wish excluded from the wget and all other file formats will be included. Set the <LIST> variable to a comma-separated list of desired extensions, with no whitespaces between each entry. For example, -A=htm, jpg,mp4 could be input to specifically exclude these file formats.
-D, --domains-<LIST> Set the <LIST> variable to a comma separated list of domains that should be included in the wget , and only these domains will be included.
--exclude-domains=<LIST> Set the <LIST> variable to a comma separated list of domains that should be excluded from the wget.
--follow-tags=<LIST> Set the <LIST> variable to a comma separated list of HTML tags that correspond to content that should be included in the wget.
--follow-ftp When included, FTP links within targeted HTML content will be found (and the content there will be included in the wget as well).
-G, --ignore-tags=<LIST> Set the <LIST>variable to a comma separated list of HTML tags that correspond to content that should be excluded from the wget.
-H, --span-hosts When included, recursion will traverse links to foreign locations (and include content from those locations in the wget).
-I, --include-directories=<LIST> Set the <LIST> variable to a comma-separated list of specific directories that should be allowed for inclusion.
-L, --relative Include this option to have recursion only include content from relative links.
--no-parent When included, the recursion of directories will not ascend to the parent directory.
-X, --exclude-directories=<LIST> Set the <LIST> variable to a comma-separated list of specific directories that should be blocked from inclusion.
2、处理工具HEG下载安装
以前是用MODIS Reprojection Tool (MRT) 进行处理,但是根据USGS网站, 以上工具已经退休:
The downloadable MODIS Reprojection Tool (MRT) and MRTSwath tool have been retired. Users are encouraged to use NASA's HDF-EOS to GeoTIFF (HEG) downloadable conversion tool or the Application for Extracting and Exploring Analysis Ready Samples (AppEEARS) web platform as alternatives for transforming and working with MODIS data. Please subscribe to the LP DAAC listserv for updates on all the tools from the LP DAAC.
于是下载安装HDF-EOS to GeoTIFF(HEG)工具。
下载链接:
Release 2.15 (April 2019) - Data Access Services - Earthdata Wiki
根据官方说明安装,需要提前下载安装jdk(Java Downloads | Oracle):
Installation on Windows 7, 8, and 10
Download hegWINv2.15.zip file.
0. Place the zip file hegWINv2.15.zip in a directory that does
NOT HAVE ANY SPACES in the directory pathname. HEG will be installed
under this path tree.
1. Install java (jdk1.8 or jre8 or newer windows version).
2. Unzip hegWINv2.15.zip to the current directory.
3. Double click on install.bat and follow the instruction in
MS-DOS window that appears.
4. A file HEGTool.bat will be created by the installation in
HEG\HEG_Win\bin directory.
5. Go to this bin directory, where HEGTool.bat file is, and
right click on HEGTool.bat. Click on the Create Shortcut.
You can change the icon for this shortcut as in step 6.
6. Right click on the HEGTool.bat Shortcut. Click on the
Properties and then click on the Change Icon. Now click on
Browse and select the file "heg.ico" in the HEG_Win\bin
directory
7. To run HEG Double click on the created shortcut(s) or the
HEGTool.bat in the HEG_Win\bin directory.
Note: Sometimes after clicking on install.bat a MS-DOS window
appears for a very short time and then disappears. If that is
the case, then some error has caused it. To see what the error
was and to correct the problem, first open MS-DOS Command Prompt
window yourself. In that window change the directory to the one that HEG
install.bat is. Type install.bat and push Enter. You may now see
what the error is and take appropriate action to correct the problem.
Also if you succeed in installing HEG and creating HEGTool.bat you
may get error during opening HEGTool.bat. If after clicking on HEGTool.bat
the MS-DOS window appears for a very short time and then disappears, then
you are having some kind of error in HEGTool.bat. To see what the error
is and to correct it do the following:
1. Open MS-DOS Command Prompt window yourself. In that window change
the directory to the one that HEG's bin directory is.
2. Type HEGTool.bat and press Return. You will get an error. Correct the
problem (Which more likely is a path problem) and continue.
双击HEG.bat弹出GUI,成功。
3、用HEG转GeoTIFF(单个转)
4、用HEG转GeoTIFF(批量转)
把批量待处理的数据放到相同文件夹
打开HEGTool,
选中1个