nextgis / ee_downloader

0 stars 1 forks source link

Implement download_scenes_by_ids #1

Open karavanjo opened 6 years ago

karavanjo commented 6 years ago

Implemented, here by https://github.com/nextgis/ee_downloader/commit/ad189a580c27f58b921e1b67285b8ee0c9d8a572.

Parameters: login- login password - password identifiers - array of scene identifiers temp_dir - temporary directory for store the scene archive product_name - name of the product from config (e.g. 'Landsat 8 OLI/TIRS C1 Level-1' or 'Sentinel-2') product_format - file format name from config (e.g. 'Level-1 GeoTIFF Data Product' or 'LandsatLook Quality Image') result_dir - directory for store the scene archive. Optional - if not defined will be used temp_dir

Return array of scenes info.

Note: Each scene info includes key file_name which contained path to downloaded file of the scene.

Example of use:

scenes = download_scenes_by_ids(
    login='login',
    password='password',
    identifiers=['S2A_OPER_MSI_L1C_TL_SGS__20160716T080034_20160716T113445_A005566_T39UWB_N02_04_01'],
    temp_dir='/tmp',
    product_name='Sentinel-2',
    product_format='L1C Tile in JPEG2000 format'
)

print scene[0]['file_name']
>> /tmp/S2A_OPER_MSI_L1C_TL_SGS__20160716T080034_20160716T113445_A005566_T39UWB_N02_04_01.tif
print scene[0]
>> {  
   ‘NW Corner Long':‘50\xb059\'58.85"E',
   ‘Entity ID':‘S2A_OPER_MSI_L1C_TL_SGS__20160716T080034_20160716T113445_A005566_T39UWB_N02_04_01',
   'file_name':'/tmp/S2A_OPER_MSI_L1C_TL_SGS__20160716T080034_20160716T113445_A005566_T39UWB_N02_04_01.tif',
   ‘Agency':‘ESA',
   ‘Orbit Number':‘135',
   ‘Production Date':   ‘2016-07-20T11:40:56.000025   Z',
   ‘Platform':‘SENTINEL-2A',
   ‘Tile Number':‘T39UWB',
   ‘Datatake Type':‘INS-NOBS',
   ‘Units':‘METER',
   ‘Data Type':‘UINT16',
   ‘Archiving Center':‘SGS_',
   ‘Vendor Product ID':‘S2A_OPER_PRD_MSIL1C_PDMC_20160720T114056_R135_V20160716T074828_20160716T074828',
   'id':‘151997',
   ‘SE Corner Long':‘52\xb042\'50.35"E',
   ‘Vendor':‘SGS_',
   ‘EPSG Code':‘32639',
   ‘NE Corner Long dec':‘52.7572757',
   ‘SW Corner Long dec':‘50.9996877',
   ‘Sun Azimuth Angle  Mean':‘161.935739928885',
   ‘Vendor Software Version':‘02.04',
   ‘Full Resolution Browse in GeoTIFF format (5.5 MB)':   ‘https://earthexplorer.usgs.gov/download/10880/151997/FRB/EE',
   ‘Cloud Cover':‘2.0619',
   ‘NW Corner Lat':‘55\xb056\'44.64"N',
   ‘Product Type':‘S2MSI1C',
   ‘Orbit Direction':‘Descending Orbit',
   'metadata':   ‘https://earthexplorer.usgs.gov/form/metadatalookup/?collection_id=10880&entity_id=151997',
   ‘Processing Level':‘LEVEL-1C',
   ‘Acquisition Start Date':   ‘2016-07-16T07:48:28.944   Z',
   ‘L1C Tile in JPEG2000 format (627.8 MB)':   ‘https://earthexplorer.usgs.gov/download/10880/151997/STANDARD/EE',
   ‘Vendor Tile ID':‘S2A_OPER_MSI_L1C_TL_SGS__20160716T113445_A005566_T39UWB_N02.04',
   ‘NW Corner Long dec':‘50.9996798',
   ‘NE Corner Lat dec':‘55.9332025',
   ‘Acquisition End Date':   ‘2016-07-16T08:00:34.106   Z',
   ‘Map Projection':‘UTM',
   ‘SE Corner Long dec':‘52.7139855',
   ‘UTM Zone':‘39N',
   ‘Center Longitude dec':‘51.8676573',
   ‘SW Corner Lat dec':‘54.9590989',
   ‘Resolution':‘10,
   20,
   60   ', ‘Datatake Identifier':‘GS2A_20160716T074612_005566_N02.04',
   ‘SW Corner Long':‘50\xb059\'58.88"E',
   ‘Center Latitude':‘55\xb026\'57.70"N',
   ‘NE  Corner Long':‘52\xb045\'26.19"E',
   'preview':   ‘https://earthexplorer.usgs.gov/browse/s2/s2a/2016/07/16/S2A_OPER_MSI_L1C_TL_SGS__20160716T080034_20160716T113445_A005566_T39UWB_N02_04_01.jpg',
   ‘NE  Corner Lat':‘55\xb055\'59.53"N',
   ‘Datastrip ID':‘S2A_OPER_MSI_L1C_DS_SGS__20160716T113445_S20160716T074828_N02.04',
   ‘SE Corner Lat dec':‘54.9470178',
   ‘Sun Zenith Angle Mean':‘35.1711986081538',
   ‘Datum':‘WGS84',
   ‘SE Corner Lat':‘54\xb056\'49.26"N',
   ‘Center Latitude dec':‘55.4493612',
   ‘Product Format':‘JPEG2000',
   ‘Quantification':‘10000',
   ‘Center Longitude':‘51\xb052\'03.57"E',
   ‘SW Corner Lat':‘54\xb057\'32.76"N',
   ‘NW  Corner Lat dec':‘55.9457344'
}