-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add PACE workshop notebook * Update PACE notebooks * Add hypoxia notebook * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add openpyxl * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Add fiona and geopandas * Update PACE notebook * Update EARTHDATA secrets * Update NASA EARTHDATA API Key * Check file path * Add earthaccess login test * Use earthaccess.login * Fix os import error * Add earthaccess notebook * Add env variables * Update env variable * Update notebook * Update PACE notebook * Update PACE notebook * Deprecate Python 3.8 --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
1ce1f0d
commit a2cd637
Showing
17 changed files
with
1,519 additions
and
49 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -15,10 +15,6 @@ jobs: | |
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
env: | ||
EARTHDATA_USERNAME: ${{ secrets.EARTHDATA_USERNAME }} | ||
EARTHDATA_PASSWORD: ${{ secrets.EARTHDATA_PASSWORD }} | ||
|
||
- name: Install GDAL | ||
run: | | ||
python -m pip install --upgrade pip | ||
|
@@ -38,6 +34,9 @@ jobs: | |
- name: Build docs | ||
run: | | ||
mkdocs build | ||
env: | ||
EARTHDATA_USERNAME: ${{ secrets.EARTHDATA_USERNAME }} | ||
EARTHDATA_PASSWORD: ${{ secrets.EARTHDATA_PASSWORD }} | ||
- name: Deploy to Netlify | ||
uses: nwtgck/[email protected] | ||
with: | ||
|
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
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
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,120 @@ | ||
{ | ||
"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/examples/_earthaccess.ipynb)\n", | ||
"\n", | ||
"# Testing earthaccess login" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# %pip install \"hypercoast[extra]\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"import earthaccess\n", | ||
"import hypercoast" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# os.environ[\"EARTHDATA_USERNAME\"] = \"your_username\"\n", | ||
"# os.environ[\"EARTHDATA_PASSWORD\"] = \"your_password\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"if os.environ.get(\"EARTHDATA_USERNAME\") is None:\n", | ||
" raise ValueError(\"Please set the EARTHDATA_USERNAME environment variable\")\n", | ||
"if os.environ.get(\"EARTHDATA_PASSWORD\") is None:\n", | ||
" raise ValueError(\"Please set the EARTHDATA_PASSWORD environment variable\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"earthaccess.login(persist=True)" | ||
] | ||
}, | ||
{ | ||
"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-30\", \"2024-08-15\"),\n", | ||
" short_name=\"PACE_OCI_L2_AOP_NRT\",\n", | ||
" count=10,\n", | ||
" return_gdf=True,\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"hypercoast.download_pace(results[:1], out_dir=\"data\")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"filepath = \"data/PACE_OCI.20240730T181157.L2.OC_AOP.V2_0.NRT.nc\"\n", | ||
"if not os.path.exists(filepath):\n", | ||
" raise FileNotFoundError(filepath)" | ||
] | ||
} | ||
], | ||
"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 | ||
} |
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
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,151 @@ | ||
{ | ||
"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/examples/hypoxia.ipynb)\n", | ||
"\n", | ||
"# Visualizing Hypoxia Cruise Sampling Locations in the Gulf of Mexico" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"# %pip install -U openpyxl hypercoast" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"import pandas as pd\n", | ||
"import hypercoast" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"url = \"https://github.com/opengeos/datasets/releases/download/hypercoast/Hypoxia_Data_Sheet.xlsx\"\n", | ||
"xls_path = \"data/Hypoxia_Data_Sheet.xlsx\"\n", | ||
"hypercoast.download_file(url, xls_path, overwrite=True)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df = pd.read_excel(xls_path)\n", | ||
"df.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"df_filtered = df.dropna(subset=[\"Lon\", \"Lat\"]).reset_index(drop=True)\n", | ||
"df_filtered.head()" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"url = (\n", | ||
" \"https://github.com/opengeos/datasets/releases/download/hypercoast/Hypoxia_Path.kml\"\n", | ||
")\n", | ||
"kml_path = \"data/Hypoxia_Path.kml\"\n", | ||
"hypercoast.download_file(url, kml_path)" | ||
] | ||
}, | ||
{ | ||
"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)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"dataset = hypercoast.read_pace(filepath)\n", | ||
"# dataset" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"m = hypercoast.Map()\n", | ||
"m.add_basemap(\"Hybrid\")\n", | ||
"wavelengths = [450, 550, 650]\n", | ||
"m.add_pace(\n", | ||
" dataset, wavelengths, indexes=[3, 2, 1], vmin=0, vmax=0.02, layer_name=\"PACE\"\n", | ||
")\n", | ||
"m.add(\"spectral\")\n", | ||
"style = {\"weight\": 2, \"color\": \"red\"}\n", | ||
"m.add_kml(kml_path, style=style, layer_name=\"Hypoxia Path\", info_mode=None)\n", | ||
"m.add_points_from_xy(\n", | ||
" df_filtered,\n", | ||
" x=\"Lon\",\n", | ||
" y=\"Lat\",\n", | ||
" max_cluster_radius=50,\n", | ||
" layer_name=\"Hypoxia Data Points\",\n", | ||
")\n", | ||
"m.set_center(-91.46118, 28.89758, zoom=8)\n", | ||
"m" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"![image](https://github.com/user-attachments/assets/9a4bc3b7-2a69-4a94-a4f8-297103cb80d3)" | ||
] | ||
} | ||
], | ||
"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 | ||
} |
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,9 @@ | ||
# Install jupytext using: conda install jupytext -c conda-forge | ||
# Always pair ipynb notebooks to md files. | ||
# formats = "ipynb,md" | ||
formats = "ipynb,myst" | ||
|
||
# jupytext --to ipynb *.md # convert all .md files to notebooks with no outputs | ||
# jupytext --to ipynb --execute *.md # convert all .md files to notebooks and execute them | ||
# jupytext --set-formats ipynb,md --execute *.md # convert all .md files to paired notebooks and execute them | ||
# jupytext --to md *.ipynb # convert all .ipynb files to .md files |
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
Oops, something went wrong.