Download
get_daily_window(daily_start, end_time)
computes tuple of start and end date/time for each day for earthaccess call
Source code in rs_tools/_src/data/modis/download.py
modis_download(start_date, end_date=None, start_time='00:00:00', end_time='23:59:00', day_step=1, satellite='Terra', save_dir='.', processing_level='L1b', resolution='1KM', bounding_box=(-180, -90, 180, 90), earthdata_username='', earthdata_password='', day_night_flag=None, identifier='02')
Downloads MODIS satellite data for a specified time period and location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_date |
str
|
The start date of the data download in the format 'YYYY-MM-DD'. |
required |
end_date |
str
|
The end date of the data download in the format 'YYYY-MM-DD'. If not provided, the end date will be the same as the start date. |
None
|
start_time |
str
|
The start time of the data download in the format 'HH:MM:SS'. Default is '00:00:00'. |
'00:00:00'
|
end_time |
str
|
The end time of the data download in the format 'HH:MM:SS'. Default is '23:59:00'. |
'23:59:00'
|
day_step |
int
|
The time step (in days) between downloads. This is to allow the user to download data every e.g. 2 days. If not provided, the default is daily downloads. |
1
|
satellite |
str
|
The satellite. Options are "Terra" and "Aqua", with "Terra" as default. |
'Terra'
|
save_dir |
str
|
The directory where the downloaded files will be saved. Default is the current directory. |
'.'
|
processing_level |
str
|
The processing level of the data. Default is 'L1b'. |
'L1b'
|
resolution |
str
|
The resolution of the data. Options are "QKM" (250m), "HKM (500m), "1KM" (1000m), with "1KM" as default. Not all bands are measured at all resolutions. |
'1KM'
|
bounding_box |
tuple
|
The region to be downloaded. |
(-180, -90, 180, 90)
|
earthdata_username |
str
|
Username associated with the NASA Earth Data login. Required for download. |
''
|
earthdata_password |
str
|
Password associated with the NASA Earth Data login. Required for download. |
''
|
day_night_flag |
str
|
The time of day for the data. Options are "day" and "night". If not provided, both day and night data will be downloaded. |
None
|
identifier |
str
|
The MODIS data product identifier. Options are "02" and "35". Default is "02". |
'02'
|
Returns: list: A list of file paths for the downloaded files.
Examples:
=========================
MODIS LEVEL 1B Test Cases
=========================
one day - successfully downloaded 4 granules (all nighttime)
python scripts/modis-download.py 2018-10-01 --start-time 08:00:00 --end-time 8:10:00 --save-dir ./notebooks/modisdata/test_script/
multiple days - finds 62 granules, stopped download for times sake but seemed to work
python scripts/modis-download.py 2018-10-01 --end-date 2018-10-9 --day-step 3 --start-time 08:00:00 --end-time 13:00:00 --save-dir ./notebooks/modisdata/test_script/
test bounding box - successfully downloaded 4 files (all daytime)
python scripts/modis-download.py 2018-10-01 --start-time 08:00:00 --end-time 13:00:00 --save-dir ./notebooks/modisdata/test_script/ --bounding-box -10 -10 20 5
test day/night flag - successfully downloaded 1 file (daytime only)
python scripts/modis-download.py 2018-10-15 --save-dir ./notebooks/modisdata/test_script/ --bounding-box -10 10 -5 15 --day-night-flag day
=========================
MODIS LEVEL 2 CLOUD MASK Test Cases
=========================
one day - successfully downloaded 4 granules (all nighttime)
python scripts/modis-download.py 2018-10-01 --start-time 08:00:00 --end-time 8:10:00 --save-dir ./notebooks/modisdata/ --processing-level L2 --identifier 35
====================
FAILURE TEST CASES
====================
bounding box input invalid - throws error as expected
python scripts/modis-download.py 2018-10-01 --bounding-box a b c d
end date before start date - throws error as expected
python scripts/modis-download.py 2018-10-01 --end-date 2018-09-01
empty results - warns user as expected
python scripts/modis-download.py 2018-10-01 --start-time 07:00:00 --end-time 7:10:00 --save-dir ./notebooks/modisdata/test_script/ --bounding-box -10 -10 -5 -5
Source code in rs_tools/_src/data/modis/download.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|