使用 podaac-data-downloader 下载数据
1、安装
(1)环境要求:Python >= 3.7
(2)通过pip安装:pip install podaac-data-downloader
(3)检查是否成功安装(访问downloader命令行界面):
$> podaac-data-downloader -h
usage: PO.DAAC bulk-data downloader [-h] -c COLLECTION -d OUTPUTDIRECTORY [--cycle SEARCH_CYCLES] [-sd STARTDATE] [-ed ENDDATE] [-f] [-b BBOX] [-dc] [-dydoy] [-dymd] [-dy] [--offset OFFSET] [-e EXTENSIONS] [-gr GRANULENAME] [--process PROCESS_CMD] [--version] [--verbose] [-p PROVIDER] [--limit LIMIT] [--dry-run]
optional arguments:
-h, --help show this help message and exit
-c COLLECTION, --collection-shortname COLLECTION
The collection shortname for which you want to retrieve data.
-d OUTPUTDIRECTORY, --data-dir OUTPUTDIRECTORY
The directory where data products will be downloaded.
--cycle SEARCH_CYCLES
Cycle number for determining downloads. can be repeated for multiple cycles
-sd STARTDATE, --start-date STARTDATE
The ISO date time after which data should be retrieved. For Example, --start-date 2021-01-14T00:00:00Z
-ed ENDDATE, --end-date ENDDATE
The ISO date time before which data should be retrieved. For Example, --end-date 2021-01-14T00:00:00Z
-f, --force Flag to force downloading files that are listed in CMR query, even if the file exists and checksum matches
-b BBOX, --bounds BBOX
The bounding rectangle to filter result in. Format is W Longitude,S Latitude,E Longitude,N Latitude without spaces. Due to an issue with parsing arguments, to use this command, please use the -b="-180,-90,180,90" syntax when calling from the command line.
Default: "-180,-90,180,90".
-dc Flag to use cycle number for directory where data products will be downloaded.
-dydoy Flag to use start time (Year/DOY) of downloaded data for directory where data products will be downloaded.
-dymd Flag to use start time (Year/Month/Day) of downloaded data for directory where data products will be downloaded.
-dy Flag to use start time (Year) of downloaded data for directory where data products will be downloaded.
--offset OFFSET Flag used to shift timestamp. Units are in hours, e.g. 10 or -10.
-e EXTENSIONS, --extensions EXTENSIONS
Regexps of extensions of products to download. Default is [.nc, .h5, .zip, .tar.gz, .tiff]
-gr GRANULENAME, --granule-name GRANULENAME
Flag to download specific granule from a collection. This parameter can only be used if you know the granule name. Only one granule name can be supplied. Supports wildcard search patterns allowing the user to identify multiple granules for download by using `?` for single- and `*` for multi-character expansion.
--process PROCESS_CMD
Processing command to run on each downloaded file (e.g., compression). Can be specified multiple times.
--version Display script version information and exit.
--verbose Verbose mode.
-p PROVIDER, --provider PROVIDER
Specify a provider for collection search. Default is POCLOUD.
--limit LIMIT Integer limit for number of granules to download. Useful in testing. Defaults to no limit.
--dry-run Search and identify files to download, but do not actually download them
--subset Flag to enable subsetting on the specified collection
2、配置.netrc文件以记住 NASA EARTH DATA 账号密码
(1)netrc 文件应该放在您的 HOME 目录中。查找 HOME 目录的位置:
【UNIX】echo $HOME
【Windows】打开cmd输入echo %HOMEDRIVE%%HOMEPATH%
得到.netrc文件位置
*如果该目录下没有.netrc文件就新建一个 (2)设置您的 NASA EARTH DATA 登录(编辑.netrc文件)
machine urs.earthdata.nasa.gov
login <your username>
password <your password>
示例:
machine urs.earthdata.nasa.gov
login podaacUser
password podaacIsAwesome
3、完成上述步骤后,即可使用 podaac-data-downloader 命令行下载数据
示例:
(下载指定区域和时间的模拟 SWOT 栅格数据)
podaac-data-downloader -c SWOT_SIMULATED_NA_CONTINENT_L2_HR_Raster_V1 -d ./SWOT_SIMULATED_NA_CONTINENT_L2_HR_Raster_V1 --start-date 2022-08-02T00:00:00Z --end-date 2022-08-22T00:00:00Z -b="-97,32.5,-96.5,33"
-c 产品名称
-d 下载数据保存到的路径
--start-date/--end-date 下载数据的时间范围
-b 矩形选择器,下载数据的经纬度范围(W Longitude,S Latitude,E Longitude,N Latitude)