目录
00 前言
API是成都信息工程大学遥感12级李彬个人开发的Python包,解决常用卫星数据下载,文件处理。(下面是原文)
lb_toolkits之downloadcentre (qq.com)
包括MODIS、OCO、CALIPSO、ERA5、FY、GFS、Landsat、Sentinel、葵花8号卫星数据的下载
01 downloadCALIPSO
from lb_toolkits.downloadcentre import downloadCALIPSO
down = downloadCALIPSO(username, password)
nowdate = datetime.datetime.strptime('20180329', '%Y%m%d')
fils = down.searchfile(nowdate)
for file in fils :
print(file)
down.download(r'./data', file)
02 downloadERA5
from lb_toolkits.downloadcentre import download_era5_profile, download_era5_surface
nowdate = datetime.datetime.strptime('20210102', '%Y%m%d')
# 下载廓线数据
variable = ['fraction_of_cloud_cover',
'geopotential',
'ozone_mass_mixing_ratio',
'potential_vorticity',
'relative_humidity',]
pressure_level = [
'1', '2', '3',
'5', '7', '10',
'20', '30', '50',
'70', '100', '125',
'150', '175', '200',]
download_era5_profile( outname='prof.nc', nowtime=nowdate,
variable=variable,
pressure=pressure_level)
# 下载地面数据
variable = ['2m_dewpoint_temperature',
'2m_temperature',]
download_era5_surface(outname='surf.nc', nowtime=nowdate,
variable=variable)
03 downloadFY
from lb_toolkits.downloadcentre import downloadFY
mdown = downloadFY(username, password)
nowdate = datetime.datetime.strptime('20220903 0000', '%Y%m%d %H%M')
mdown.download_fy_l1(dstpath='./data', starttime=nowdate, geoflag=True)
mdown = downloadFY(username, password)
nowdate = datetime.datetime.strptime('20220923 0000', '%Y%m%d %H%M')
mdown.download_fy_l2(dstpath='./data', satid='FY4B', instid='AGRI', starttime=nowdate, prodid='CTH')
mdown = downloadFY(username, password)
nowdate = datetime.datetime.strptime('20220923 0000', '%Y%m%d %H%M')
mdown.download_fy_l1(dstpath='./data', starttime=nowdate, geoflag=True,
satid='FY3D', instid='MERSI', resolution=0.01)
mdown = downloadFY(username, password)
nowdate = datetime.datetime.strptime('20220803 0000', '%Y%m%d %H%M')
# seachfile('/L2L3')
#
# mdown.download_fy_l2(dstpath='./data', starttime=nowdate, prodid='CTH',
# satid='FY3D', instid='MERSI', resolution=0.01)
04 downloadGFS
from lb_toolkits.downloadcentre import downloadGFS
downloadGFS('./data', datetime.datetime.utcnow())
05 downloadH8
from lb_toolkits.downloadcentre import downloadH8
nowdate = datetime.datetime.strptime('20221027', '%Y%m%d')
down = downh8file(username=FTP_USER, password=FTP_PAWD)
filelist = down.search_ahi8_l1_netcdf(nowdate)
down.download('./data', filelist)
filelist = down.search_ahi8_l1_hsd(nowdate)
down.download('./data', filelist)
06 downloadLandsat
from lb_toolkits.downloadcentre import downloadLandsat
product = 'LANDSAT_8_C1'
lat = 30.6
lon = 104.07start_date=datetime.datetime.strptime('2020-06-01', '%Y-%m-%d')
end_date=datetime.datetime.strptime('2022-08-01', '%Y-%m-%d')
cloud_max = 50
output_dir = './data'
down = downloadLandsat(username, password)
Landsat_name = down.searchfile(product, latitude=lat, longitude=lon,startdate=start_date, enddate=end_date, cloud_cover_max=cloud_max)
down.download(Landsat_name, output_dir)
# down = downloadLandsat(username_nasa, password_nasa)
# urllist = down.searchfileByCMR(starttime=start_date, endtime=end_date)
# for url in urllist :
# down.downloadByCMR(output_dir, url, skip=True)
07 downloadMODIS
from lb_toolkits.downloadcentre import downloadMODIS
down = downloadMODIS(username, password)
nowdate = datetime.datetime.strptime('20180329', '%Y%m%d')
fils = down.searchfile(nowdate)
for file in fils :
print(file)
down.download(r'./data', file)
08 downloadOCO
from lb_toolkits.downloadcentre import downloadOCO
down = downloadOCO(username, password)
nowdate = datetime.datetime.strptime('20210112', '%Y%m%d')
fils = down.searchfile(nowdate, prodversion='OCO3_L2_Lite_FP')
# print(fils)
for file in fils :
print(file)
down.download(r'./data', file)
09 downloadSentinel
from lb_toolkits.downloadcentre import downloadSentinel
down = downloadSentinel(username, password )
urllist = down.searchfile(starttime=datetime.datetime.utcnow()-datetime.timedelta(days=29),endtime=datetime.datetime.utcnow()-datetime.timedelta(days=28))
for url in urllist :
print(url)
down.download('./data', url)