This article describes how an Earth OnDemand query can be copied and imported into the EarthAI Notebook environment through use of %%eod
cell magic.
We first use Earth OnDemand to identify imagery that we'd like to load into EarthAI Notebook. Below we show a screenshot of Earth OnDemand where we selected a Landsat 8 grid square from Aug 10, 2018, centered on Yellowstone Lake in Yellowstone National Park. The cloud cover query parameter was selected to be 10%.
In the upper right hand portion of the screen, click the to Notebook button; a message stating that the query was copied to the clipboard for use in EarthAI Notebook should be generated.
Log into EarthAI Notebook and launch a new notebook. Click within the blank cell and paste from the clipboard. For the Earth OnDemand query shown above, the cell looks like this:
%%eod
{
"collections": [
"landsat8_c2l1t1"
],
"geo": [
-110.83557128906251,
44.19795903948531,
-109.87976074218751,
44.6569317328873
],
"max_cloud_cover": 10,
"start_datetime": "2018-08-09T00:00:00.565Z",
"end_datetime": "2018-08-11T00:00:00.565Z"
}
The cell has been populated with cell magic. Magic commands or functions are an iPython enhancement that act as convenience functions where Python syntax is not the most natural one. Cell magics, which are prefixed with %%
, operate on all of the lines in a cell. The %%eod
cell magic takes JSON-formatted data related to the Earth OnDemand query.
If you run the cell, you will see a variable named eod0 returned. Click on the black arrow to the left of eod0
metadata to see all of the data columns in this GeoDataFrame, including a geometry column:
It is often helpful to assign a variable name to the query. In the code above, you can replace %%eod
with %%eod --name cat
to name the output GeoDataFrame cat instead of eod0.
Comments
0 comments
Please sign in to leave a comment.