Skip to content

Commit

Permalink
Add PACE workshop notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
giswqs committed Aug 31, 2024
1 parent 1ce1f0d commit 8774350
Show file tree
Hide file tree
Showing 2 changed files with 209 additions and 1 deletion.
207 changes: 207 additions & 0 deletions docs/workshops/pace.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"[![image](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/opengeos/HyperCoast/blob/main/docs/workshops/pace.ipynb)\n",
"\n",
"# Working with NASA PACE data in HyperCoast\n",
"\n",
"This notebook demonstrates how to visualize Plankton, Aerosol, Cloud, ocean Ecosystem ([PACE](https://pace.gsfc.nasa.gov/)) data interactively with HyperCoast.\n",
"\n",
"## Environment setup\n",
"\n",
"Uncomment and run the following cell to install the required packages."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# %pip install \"hypercoast[extra]\""
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Import library."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import hypercoast"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"To download and access the data, you will need to create an Earthdata login. You can register for an account at [urs.earthdata.nasa.gov](https://urs.earthdata.nasa.gov). Once you have an account, run the following cell and enter your NASA Earthdata login credentials."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hypercoast.nasa_earth_login()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Search for PACE data\n",
"\n",
"Search for PACE data programmatically. Specify the bounding box and time range of interest. Set `count=-1` to return all results or set `count=10` to return the first 10 results."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"results, gdf = hypercoast.search_pace(\n",
" bounding_box=(-83, 25, -81, 28),\n",
" temporal=(\"2024-07-20\", \"2024-08-01\"),\n",
" short_name=\"PACE_OCI_L2_AOP_NRT\",\n",
" count=10, # use -1 to return all datasets\n",
" return_gdf=True,\n",
")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot the footprints of the returned datasets on a map."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"gdf.explore()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Uncomment the following cell to download the first dataset from the search results. Note that the download may take some time."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"hypercoast.download_pace(results[:1], out_dir=\"data\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Search for PACE data interactively. Specify pan and zoom to the area of interest. Specify the time range of interest from the search dialog, then click on the Search button."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"m = hypercoast.Map(center=[30.0262, -90.1345], zoom=8)\n",
"m.search_pace()\n",
"m"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Uncomment the following cell to display the GeoDataFrame of the search results."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# m._NASA_DATA_GDF.head()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Similarly, you can download the first dataset from the search results by uncommenting the following cell."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# hypercoast.download_pace(results[:1], out_dir=\"data\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Download a sample PACE dataset\n",
"\n",
"Let's download a sample PACE dataset for the demonstration."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"url = \"https://github.com/opengeos/datasets/releases/download/hypercoast/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc\"\n",
"filepath = \"data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc\"\n",
"hypercoast.download_file(url, filepath, quiet=True)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "hyper",
"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.10.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
3 changes: 2 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ plugins:
"image_slicing.ipynb",
"temperature.ipynb",
"pace_oci_l1.ipynb",
"pace_cyano.ipynb"
"pace_cyano.ipynb",
]

markdown_extensions:
Expand Down Expand Up @@ -110,6 +110,7 @@ nav:
- examples/field_data.ipynb
- Workshops:
- workshops/emit.ipynb
- workshops/pace.ipynb
- API Reference:
- aviris module: aviris.md
- common module: common.md
Expand Down

0 comments on commit 8774350

Please sign in to comment.