-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Renamed notebook and added code for download
- Loading branch information
1 parent
93b1eb2
commit 5c5b237
Showing
2 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "3ea2a574-fd07-442f-bbe9-45bdb2614b0f", | ||
"metadata": {}, | ||
"source": [ | ||
"# Downloading MODIS Data" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "47917187-bb0d-424b-b94d-c84f420402d3", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# !pip install modis-tools" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"id": "c74e2768-7f73-4da1-89a9-7b5122c66e45", | ||
"metadata": {}, | ||
"source": [ | ||
"**Need to Sign up**! - [clickhere](https://urs.earthdata.nasa.gov/profile)\n", | ||
"\n", | ||
"I also used the references from GEE found [here](https://developers.google.com/earth-engine/datasets/catalog/modis). \n", | ||
"It was very difficult to navigate to the many, many, many files found on cmr.earthdata.\n", | ||
"\n", | ||
"In this example, we're looking at the MOD09GQ.061 Terra Surface Reflectance Daily Global 250m. More info can be found at the [usgs database](https://lpdaac.usgs.gov/products/mod09gqv061/) but I highly recommend [GEE summaries](https://developers.google.com/earth-engine/datasets/catalog/MODIS_061_MOD09GQ) or [gibs wiki](https://nasa-gibs.github.io/gibs-api-docs/available-visualizations/#visualization-product-catalog)." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "270f2489-380e-404b-a1d4-6d3489e7caae", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from modis_tools.auth import ModisSession\n", | ||
"from modis_tools.resources import CollectionApi, GranuleApi\n", | ||
"from modis_tools.granule_handler import GranuleHandler\n", | ||
"\n", | ||
"username = \"anna.jungbluth\" # Update this line\n", | ||
"password = \"wakqo4-qipbeX-nomjip\" # Update this line\n", | ||
"\n", | ||
"# Authenticate a session\n", | ||
"session = ModisSession(username=username, password=password)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"[Collection(id='C2565788901-LPCLOUD', title='MODIS/Terra Vegetation Indices 16-Day L3 Global 500m SIN Grid V061', dataset_id='MODIS/Terra Vegetation Indices 16-Day L3 Global 500m SIN Grid V061', coordinate_system='CARTESIAN', time_start='2000-02-18T00:00:00.000Z', updated=datetime.datetime(2015, 9, 30, 10, 47, 53, 384000, tzinfo=datetime.timezone.utc), links=[CollectionLink(hreflang='en-US', href=AnyUrl('https://e4ftl01.cr.usgs.gov/MOLT/MOD13A1.061/', scheme='https', host='e4ftl01.cr.usgs.gov', tld='gov', host_type='domain', path='/MOLT/MOD13A1.061/'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://search.earthdata.nasa.gov/search?q=C2565788901-LPCLOUD', scheme='https', host='search.earthdata.nasa.gov', tld='gov', host_type='domain', path='/search', query='q=C2565788901-LPCLOUD'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://appeears.earthdatacloud.nasa.gov/', scheme='https', host='appeears.earthdatacloud.nasa.gov', tld='gov', host_type='domain', path='/'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://earthexplorer.usgs.gov/', scheme='https', host='earthexplorer.usgs.gov', tld='gov', host_type='domain', path='/'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://doi.org/10.5067/MODIS/MOD13A1.061', scheme='https', host='doi.org', tld='org', host_type='domain', path='/10.5067/MODIS/MOD13A1.061'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://lpdaac.usgs.gov/', scheme='https', host='lpdaac.usgs.gov', tld='gov', host_type='domain', path='/'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://lpdaac.usgs.gov/documents/621/MOD13_User_Guide_V61.pdf', scheme='https', host='lpdaac.usgs.gov', tld='gov', host_type='domain', path='/documents/621/MOD13_User_Guide_V61.pdf'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://lpdaac.usgs.gov/documents/104/MOD13_ATBD.pdf', scheme='https', host='lpdaac.usgs.gov', tld='gov', host_type='domain', path='/documents/104/MOD13_ATBD.pdf'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://ladsweb.modaps.eosdis.nasa.gov/filespec/MODIS/61/MOD13A1', scheme='https', host='ladsweb.modaps.eosdis.nasa.gov', tld='gov', host_type='domain', path='/filespec/MODIS/61/MOD13A1'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://modis-land.gsfc.nasa.gov/MODLAND_val.html', scheme='https', host='modis-land.gsfc.nasa.gov', tld='gov', host_type='domain', path='/MODLAND_val.html'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://modis-land.gsfc.nasa.gov/ValStatus.php?ProductID=MOD13', scheme='https', host='modis-land.gsfc.nasa.gov', tld='gov', host_type='domain', path='/ValStatus.php', query='ProductID=MOD13'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://opendap.cr.usgs.gov/opendap/hyrax/DP131/MOLT/MOD13A1.061/contents.html', scheme='https', host='opendap.cr.usgs.gov', tld='gov', host_type='domain', path='/opendap/hyrax/DP131/MOLT/MOD13A1.061/contents.html'), type=None), CollectionLink(hreflang='en-US', href=AnyUrl('https://cmr.earthdata.nasa.gov/browse-scaler/browse_images/granules/G2618479670-LPCLOUD?h=85&w=85', scheme='https', host='cmr.earthdata.nasa.gov', tld='gov', host_type='domain', path='/browse-scaler/browse_images/granules/G2618479670-LPCLOUD', query='h=85&w=85'), type=None)], processing_level_id='3', short_name='MOD13A1', summary='The MOD13A1 Version 6.1 product provides Vegetation Index (VI) values at a per pixel basis at 500 meter (m) spatial resolution. There are two primary vegetation layers. The first is the Normalized Difference Vegetation Index (NDVI), which is referred to as the continuity index to the existing National Oceanic and Atmospheric Administration-Advanced Very High Resolution Radiometer (NOAA-AVHRR) derived NDVI. The second vegetation layer is the Enhanced Vegetation Index (EVI), which has improved sensitivity over high biomass regions. The algorithm for this product chooses the best available pixel value from all the acquisitions from the 16 day period. The criteria used is low clouds, low view angle, and the highest NDVI/EVI value. \\n\\nProvided along with the vegetation layers and two quality assurance (QA) layers are reflectance bands 1 (red), 2 (near-infrared), 3 (blue), and 7 (mid-infrared), as well as four observation layers. \\n\\nValidation at stage 3 (https://modis-land.gsfc.nasa.gov/MODLAND_val.html) has been achieved for the MODIS Vegetation Index product suite. Further details regarding MODIS land product validation for the MOD13 data products are available from the MODIS Land Team Validation site (https://modis-land.gsfc.nasa.gov/ValStatus.php?ProductID=MOD13).\\n\\nImprovements/Changes from Previous Versions\\n\\n* The Version 6.1 Level-1B (L1B) products have been improved by undergoing various calibration changes that include: changes to the response-versus-scan angle (RVS) approach that affects reflectance bands for Aqua and Terra MODIS, corrections to adjust for the optical crosstalk in Terra MODIS infrared (IR) bands, and corrections to the Terra MODIS forward look-up table (LUT) update for the period 2012 - 2017.\\n* A polarization correction has been applied to the L1B Reflective Solar Bands (RSB).', version_id='061')]\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"\n", | ||
"# Query the MODIS catalog for collections\n", | ||
"collection_client = CollectionApi(session=session)\n", | ||
"\n", | ||
"# TODO: Code works for Level-3, but not Level-1 yet\n", | ||
"# collections = collection_client.query(short_name=\"MYD021KM\", version=\"061\")\n", | ||
"collections = collection_client.query(short_name=\"MOD13A1\", version=\"061\")\n", | ||
"print(collections)\n", | ||
"\n", | ||
"# Query the selected collection for granules\n", | ||
"granule_client = GranuleApi.from_collection(collections[0], session=session)\n", | ||
"\n", | ||
"# Filter the selected granules via spatial and temporal parameters\n", | ||
"# Filter the selected granules via spatial and temporal parameters\n", | ||
"nigeria_bbox = [2.1448863675, 4.002583177, 15.289420717, 14.275061098]\n", | ||
"nigeria_granules = granule_client.query(start_date=\"2018-10-01\", end_date=\"2018-10-02\", bounding_box=nigeria_bbox)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"GranuleHandler.download_from_granules(nigeria_granules, session)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "base", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.9.13" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |