Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update viz doc to clarify its current status (partial functionality - incompatible with OA API changes) #540

Merged
merged 5 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions doc/source/example_notebooks/IS2_data_visualization.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
"source": [
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved
"# Visualizing ICESat-2 Elevations\n",
"\n",
"This notebook ({nb-download}`download <IS2_data_visualization.ipynb>`) demonstrates interactive ICESat-2 elevation visualization by requesting data from [OpenAltimetry](https://www.openaltimetry.org/) based on metadata provided by [icepyx](https://icepyx.readthedocs.io/en/latest/). We will show how to plot spatial extent and elevation interactively. "
"This notebook ({nb-download}`download <IS2_data_visualization.ipynb>`) demonstrates interactive ICESat-2 elevation visualization by requesting data from [OpenAltimetry](https://www.openaltimetry.org/) based on metadata provided by [icepyx](https://icepyx.readthedocs.io/en/latest/). We will show how to plot spatial extent and elevation interactively.\n",
"\n",
"> ⚠️ **Some of this notebook is currently non-functional**\n",
">\n",
"> Visualizations requiring the\n",
"> [OpenAltimetry API](https://openaltimetry.earthdatacloud.nasa.gov/data/openapi/swagger-ui/index.html)\n",
"> are currently unavailable (since ~October 2023).\n",
"> The API changed and we haven't yet updated this notebook correspondingly."
]
},
{
Expand All @@ -33,7 +40,7 @@
"id": "57f2cfd8",
"metadata": {},
"source": [
"Create an ICESat-2 query object\n",
"## Create an ICESat-2 query object\n",
"\n",
"Set the desired parameters for your data visualization.\n",
"\n",
Expand Down Expand Up @@ -148,6 +155,7 @@
"execution_count": null,
"id": "93a712af-ab1f-4d79-834d-c2735a5677a8",
"metadata": {
"scrolled": true,
"tags": []
},
"outputs": [],
Expand Down Expand Up @@ -222,16 +230,16 @@
"### Alternative Access Options to Visualize ICESat-2 elevation using OpenAltimetry API\n",
"\n",
"You can also view elevation data by importing the visualization module directly and initializing it with your query object or a list of parameters:\n",
" ```\n",
" ```python\n",
" from icepyx.core.visualization import Visualize\n",
" ```\n",
" - passing your query object directly to the visualization module\n",
" ```\n",
" ```python\n",
" region2 = ipx.Query(short_name, spatial_extent, date_range)\n",
" vis = Visualize(region2)\n",
" ```\n",
" - creating a visualization object directly without first creating a query object\n",
" ```\n",
" ```python\n",
" vis = Visualize(product=short_name, spatial_extent=spatial_extent, date_range=date_range)\n",
" ```"
]
Expand Down Expand Up @@ -264,7 +272,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.12.4"
}
},
"nbformat": 4,
Expand Down
13 changes: 9 additions & 4 deletions icepyx/core/visualization.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,13 @@
--------
request_OA_data
"""
return requests.get(base_url, params=payload)
response = requests.get(base_url, params=payload)

Check warning on line 315 in icepyx/core/visualization.py

View check run for this annotation

Codecov / codecov/patch

icepyx/core/visualization.py#L315

Added line #L315 was not covered by tests
if not response.ok:
raise RuntimeError(

Check warning on line 317 in icepyx/core/visualization.py

View check run for this annotation

Codecov / codecov/patch

icepyx/core/visualization.py#L317

Added line #L317 was not covered by tests
f"Status {response.status_code} requesting url {response.request.url}"
)
mfisher87 marked this conversation as resolved.
Show resolved Hide resolved

return response

Check warning on line 321 in icepyx/core/visualization.py

View check run for this annotation

Codecov / codecov/patch

icepyx/core/visualization.py#L321

Added line #L321 was not covered by tests

def request_OA_data(self, paras) -> da.array:
"""
Expand All @@ -331,9 +337,8 @@
"""

warnings.warn(
"NOTICE: visualizations requiring the OpenAltimetry API are currently (October 2023) "
"unavailable while hosting of OpenAltimetry transitions from UCSD to NSIDC."
"A ticket has been issued to restore programmatic API access."
"NOTICE: visualizations requiring the OpenAltimetry API are currently"
" (August 2024) unavailable until we can adapt to API changes."
)

base_url = "http://openaltimetry.earthdatacloud.nasa.gov/data/api/icesat2"
Expand Down